Skip to content

fix(sdk-litellm): keep the router's deployment config out of span metadata - #230

Merged
aikins01 merged 2 commits into
mainfrom
fix/sdk-litellm/router-metadata
Nov 21, 2026
Merged

aikins01 merged 2 commits into
mainfrom
fix/sdk-litellm/router-metadata

Conversation

@aikins01

Copy link
Copy Markdown
Contributor

LiteLLM's Router writes the deployment it picked into the caller's own metadata argument. On calls made outside the LiteLLM proxy, the integration exports every key of that argument, so a Router call's span carried td.metadata.api_base, whose URL can hold credentials (https://user:secret@host/v1), and td.metadata.model_info, which holds any fields an admin configured for the deployment. The proxy path already left both out. LiteLLM 1.110 also writes kubernetes_pod_routing, with the internal service host and pod IP of a deployment found through Kubernetes pod discovery.

These three keys are now dropped on every call. This also drops a caller's own metadata under those names. LiteLLM itself reads metadata.model_info and metadata.api_base, so they aren't usable as user keys anyway. The README lists them with the other dropped keys, and says that the Router's additions to tags include the deployment's tags and Credential: <name>, which stay exported.

The Router owner test now routes to a deployment with a credentialed api_base and a model_info, and passes a kubernetes_pod_routing value. One proxy case sends the same names in the request body's metadata.

Tests: the package's pytest suite against LiteLLM 1.90.2 (lowest) and 1.110.2 (highest). At 1.110.2, two unrelated tests fail on main until #229 merges. With #229 applied, all tests pass at both bounds.

…adata

LiteLLM's Router writes the deployment it picked into the caller's own
metadata argument. On calls made outside the LiteLLM proxy, every key of
that argument was exported, so spans carried td.metadata.api_base, whose
URL can hold credentials, and td.metadata.model_info, which holds any
fields an admin configured for the deployment. LiteLLM 1.110 also writes
kubernetes_pod_routing, with the internal service host and pod IP of a
pod-discovered deployment.

These three keys are now dropped on every call, as the proxy path already
did for api_base and model_info.
@aikins01 aikins01 self-assigned this Nov 21, 2026
@aikins01
aikins01 merged commit 07f38f6 into main Nov 21, 2026
10 checks passed
@aikins01
aikins01 deleted the fix/sdk-litellm/router-metadata branch November 21, 2026 08:44
@aikins01 aikins01 mentioned this pull request Nov 21, 2026
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