Repository navigation
fix(responses): backport request-param leak fixes to rc/1.102.0 (#41018, #41141, #41144) - #41342
Conversation
fix(utils): keep litellm params out of provider request bodies (cherry picked from commit 1f46e58)
…ers_body_leak fix(openai): keep extra_headers out of the chat request body on the httpx handler path (cherry picked from commit de55e22)
…rs_unknown_params fix(responses): filter bridged kwargs like the native Responses path (cherry picked from commit 41b5d47)
|
|
Greptile SummaryThis backport aligns bridged Responses parameter filtering with native dispatch, registers additional internal parameters, and keeps forwarded headers out of OpenAI request bodies
Confidence Score: 4/5The PR needs changes before merging because GitHub Copilot custom headers are dropped on the experimental base-handler path and an explicit comment rule is violated The main fixes are well covered, but the changed dispatch loses user-provided Copilot headers whenever the base HTTP handler is enabled Files Needing Attention: litellm/main.py, tests/test_litellm/test_utils.py Important Files Changed
Reviews (1): Last reviewed commit: "Merge pull request #41144 from BerriAI/l..." | Re-trigger Greptile |
| if extra_headers is not None and not use_base_llm_http_handler: | ||
| optional_params["extra_headers"] = extra_headers |
There was a problem hiding this comment.
Copilot headers are dropped When the base HTTP handler is enabled, user extra headers stay separate from dispatched headers and never reach the provider
Knowledge Base Used: Model invocation runtime
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| """Bridges (chat <-> Responses, agentic loop follow-ups) forward litellm_params as | ||
| `completion()` kwargs. Any key the param builder does not recognize is swept into | ||
| extra_body, and OpenAI rejects the call with `Unknown parameter: 'model_alias_map'`. | ||
| """ |
There was a problem hiding this comment.
Disallowed test comment This explanatory docstring violates the repository directive limiting comments to complex logic, tool input, or TODOs, so it must be removed before merging
| """Bridges (chat <-> Responses, agentic loop follow-ups) forward litellm_params as | |
| `completion()` kwargs. Any key the param builder does not recognize is swept into | |
| extra_body, and OpenAI rejects the call with `Unknown parameter: 'model_alias_map'`. | |
| """ |
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
TLDR
Problem this solves:
/v1/responsesforwards params the native path dropsHow it solves it:
extra_headersout of the body on the httpx pathStraight backport of three PRs already merged to
main, onto the 1.102.0 release line so they ship in 1.102.0 stable: #41018, #41141, #41144User Flow
Before: a developer calling the gateway's Responses endpoint gets a 400 naming a parameter they never sent
chat_template_kwargsonto the gpt-5.4 deployment, and their load balancer addsx-forwarded-forto every request{"model": "gpt-5.4", "input": "Reply with exactly one word: hello"}and no extra parametersOpenAIException - Unknown parameter: 'chat_template_kwargs'Unknown parameter: 'extra_headers'Unknown parameter: 'model_alias_map'/v1/chat/completions, so the failure depends on which endpoint they call, not on what they sentAfter: the same requests come back 200, and the provider only ever sees parameters the caller actually chose
x-forwarded-forreaches the provider as an HTTP header, not as a body field"allowed_openai_params": ["chat_template_kwargs"], and it reaches the providerRelevant issues
Linear ticket
Resolves LIT-7695
Resolves LIT-7711
Resolves LIT-7694
Pre-Submission checklist
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Live proxy on both sides, same config, real calls to the xAI API. The check is what the gateway actually puts on the wire to the provider, read out of the proxy's own debug log
Shared setup, identical for both runs:
Before (16f6d92)
A bridged Responses request leaks the caller's unknown param to the provider
chat_template_kwargsis in the body. A provider that validates its request schema rejects this with a 400After (262978e)
A bridged Responses request leaks the caller's unknown param to the provider
The param is gone, matching what native Responses dispatch already did
Type
🐛 Bug Fix
Caveats (if any)
Medium
/v1/responsesnow drops unknown provider paramsdataSourceson an Azure deployment reaches the provider at 16f6d92 and does not at 262978eallowed_openai_paramsmainalready behaves this way, this backport just brings the line in lineLow
extra_headersandmodel_alias_mapare covered by tests, not by the live run above, because they only surface on an OpenAI-family provider