fix(responses): forward allowed_openai_params through the chat completions bridge - #35885
Conversation
…tions bridge Resolves #35878 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
|
Greptile SummaryThe PR fixes the Responses-to-chat-completions bridge by forwarding the caller’s
Confidence Score: 5/5The PR appears safe to merge with no actionable defects identified. The newly forwarded argument is accepted through the handler’s keyword collection and preserved when constructing both synchronous and asynchronous completion arguments, while the regression test verifies the affected asynchronous path.
|
| Filename | Overview |
|---|---|
| litellm/responses/main.py | Explicitly forwards the named allowlist parameter through the chat-completions bridge without changing native Responses behavior. |
| tests/test_litellm/responses/test_responses_api_bridge_flag.py | Adds a focused mocked regression test that exercises the asynchronous bridge and verifies the allowlist reaches acompletion. |
Reviews (1): Last reviewed commit: "fix(responses): forward allowed_openai_p..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 11c3bd3. Configure here.
TLDR
Problem this solves:
allowed_openai_paramsis ignored on the responses to chat completions bridgeUnsupportedParamsErrorfor params the caller allowedHow it solves it:
allowed_openai_paramsexplicitly intoresponse_api_handlerlitellm.completion/acompletionthrough kwargsRelevant issues
Fixes #35878
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
allowed_openai_paramsis a named parameter ofresponses(), so it never sits inkwargs. The bridge branch forwarded only**kwargstolitellm_completion_transformation_handler.response_api_handler, which builds itscompletion_argsfrom those kwargs, so the allowlist was lost andlitellm.acompletionrejected the very param the config allowedConfig used for both runs (real Anthropic API through its OpenAI compatible endpoint, so the model has no
reasoning_effortsupport and the allowlist is what makes the call legal):Before, at
b35947b358with the one line fix reverted:{"error":{"message":"litellm.UnsupportedParamsError: openai does not support parameters: ['reasoning_effort'], for model=claude-haiku-4-5-20251001. To drop these, set `litellm.drop_params=True` or for proxy:\n\n`litellm_settings:\n drop_params: true`\n. \n If you want to use these params dynamically send allowed_openai_params=['reasoning_effort'] in your request.. Received Model Group=bridged-model\nAvailable Model Group Fallbacks=None","type":"None","param":null,"code":"400"}}After, same curl at
b35947b358:{"id":"resp_Gsvjwo82g3ixQdfVgF5NAqwy_dl31wBon-LCVp51X4tDfn3qu57AKq5fD1IrU6xs12Y83R8RaLRRbGKhaYgqYk76rYK...","created_at":1785895708,"model":"bridged-model","object":"response","output":[{"type":"message","id":"msg_011Cdina61cvYZqiZ3z1ytH9","status":"completed","role":"assistant","content":[{"type":"output_text","text":"Hi, how are you?","annotations":[]}]}],"parallel_tool_calls":false,"temperature":0.0,"tool_choice":"auto"}The new regression test fails on the unfixed tree and passes with the fix, and the rest of
tests/test_litellm/responses/stays green (415 passed)Type
🐛 Bug Fix
Changes
litellm/responses/main.pynow passesallowed_openai_params=allowed_openai_paramsalongside**kwargswhen it hands off to the chat completions bridge. The handler already spreads its kwargs into thecompletion/acompletioncall, andcompletionreads the allowlist out of kwargs, so nothing else needs to change. The native responses path already forwarded it, and so did the emulated file_search path, which is why this only ever bit the bridgetests/test_litellm/responses/test_responses_api_bridge_flag.pygains a test that drivesaresponseswithuse_chat_completions_api=Trueplusallowed_openai_params=["reasoning_effort"]and asserts the allowlist arrives atlitellm.acompletionIssue #35878 also reports that
namespaceandtool_searchtools are dropped by the bridge. That part is deliberately left out of this PR:tool_searchis in fact forwarded verbatim today, andnamespaceis dropped on purpose by #32258 because most chat completions providers reject it, even though the Anthropic chat transformation does know how to flatten it. Deciding between dropping and flattening per provider is a design call for the owner of that transformationFinal Attestation
Note
Low Risk
Single-parameter forwarding on an existing code path with a targeted regression test; no auth, security, or broad API behavior changes beyond fixing the bridge allowlist.
Overview
Fixes bridged
/v1/responsescalls (e.g.use_chat_completions_apior providers without native Responses support) incorrectly raisingUnsupportedParamsErrorwhen callers passallowed_openai_paramsto permit params likereasoning_effort.Because
allowed_openai_paramsis a named argument onresponses(), it was not included in**kwargspassed tolitellm_completion_transformation_handler.response_api_handler, so the allowlist never reachedlitellm.completion/acompletion. The change explicitly passesallowed_openai_params=allowed_openai_paramson that bridge handoff (native Responses and emulated file_search paths already forwarded it).Adds a regression test on
aresponseswith the bridge enabled that assertsallowed_openai_paramsis present on the mockedacompletioncall.Reviewed by Cursor Bugbot for commit 11c3bd3. Bugbot is set up for automated code reviews on this repo. Configure here.