Skip to content

feat(llm): attribute aiml-provider traffic with the AIMLAPI partner id - #5

Merged
Lookoff-AIMLAPI merged 1 commit into
mainfrom
feat/aiml-partner-attribution
Aug 21, 2026
Merged

feat(llm): attribute aiml-provider traffic with the AIMLAPI partner id#5
Lookoff-AIMLAPI merged 1 commit into
mainfrom
feat/aiml-partner-attribution

Conversation

@Lookoff-AIMLAPI

Copy link
Copy Markdown
Member

Reopened as #4 was auto-closed when its stacked base branch (sdk-upstream-sync-2026-08-21, merged as #3) got deleted on merge. Rebased onto main.

The aiml LiteLLM provider (VERIFIED_AIML_MODELS) currently sends no partner attribution, unlike the CLI fork's OAuth onboarding (openhands_cli/aimlapi/config.py, which sets X-AIMLAPI-Partner-ID / X-AIMLAPI-Source) — so AIMLAPI has no way to attribute SDK/Canvas traffic to OpenHands short of sniffing User-Agent.

Adds LLM._aiml_headers(), mirroring the existing _openrouter_headers()apply_extra_headers() pattern, but gated on the parsed LiteLLM provider actually being aiml (OpenRouter's headers are sent unconditionally today; an unrecognized X-AIMLAPI-Partner-ID header on every other provider's request would just be dead weight, so this one only fires for aiml/* models).

Same partner id as the CLI (part_uDVajKg3xPLrOdNdQetOtoGA, OpenHands' provisioned partner — valid on both staging and prod).

Tests: tests/sdk/llm/test_llm.py (direct _aiml_headers() gating) + tests/sdk/llm/test_chat_options.py (header actually lands in extra_headers via select_chat_options, and does not leak to a non-aiml model). Full tests/sdk suite: 5958 passed, 0 failed.

The aiml LiteLLM provider (VERIFIED_AIML_MODELS) sent no partner
attribution, unlike the CLI's OAuth onboarding (openhands_cli/aimlapi/
config.py), so AIMLAPI had no way to attribute this traffic to
OpenHands. Add _aiml_headers(), gated on the parsed provider being
"aiml" (unlike _openrouter_headers(), which is unconditional), mirroring
the existing OpenRouter HTTP-Referer/X-Title pattern in apply_extra_headers().

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Lookoff-AIMLAPI
Lookoff-AIMLAPI merged commit f920fd3 into main Aug 21, 2026
26 of 40 checks passed
@Lookoff-AIMLAPI
Lookoff-AIMLAPI deleted the feat/aiml-partner-attribution branch August 21, 2026 15:32
@github-actions

Copy link
Copy Markdown

REST API breakage checks (OpenAPI) — ✅ PASSED

Result:PASSED

Action log

@github-actions

Copy link
Copy Markdown

Python API breakage checks — ✅ PASSED

Result:PASSED

Action log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant