Fix/21193 chatgpt codex unsupported params - #21209
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile OverviewGreptile SummaryThis PR fixes ChatGPT Codex (e.g.,
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| litellm/llms/chatgpt/responses/transformation.py | Replaces individual pop() calls with an allowlist filter for ChatGPT Codex Responses API params. Clean approach, but the parent's get_supported_openai_params is not overridden to match the actual allowed set. |
| tests/test_litellm/llms/chatgpt/responses/test_chatgpt_responses_transformation.py | Adds a comprehensive unit test validating that unsupported params are dropped and supported params are preserved. No network calls; mock-safe. |
Flowchart
flowchart TD
A[User calls litellm.responses\nwith ChatGPT Codex model] --> B[OpenAIResponsesAPIConfig\n.transform_responses_api_request]
B --> C[Returns full request dict\nwith all optional params]
C --> D[ChatGPTResponsesAPIConfig\n.transform_responses_api_request]
D --> E[Prepend default instructions\nForce stream=True, store=False\nAdd reasoning.encrypted_content]
E --> F{Filter through\nallowed_keys set}
F -->|Allowed| G[model, input, instructions,\nstream, store, include,\ntools, tool_choice, reasoning,\nprevious_response_id, truncation]
F -->|Dropped| H[user, temperature, top_p,\ncontext_management, metadata,\nmax_output_tokens, stream_options, etc.]
G --> I[Send filtered request\nto ChatGPT Responses API]
Last reviewed commit: cf94802
| allowed_keys = { | ||
| "model", | ||
| "input", | ||
| "instructions", | ||
| "stream", | ||
| "store", | ||
| "include", | ||
| "tools", | ||
| "tool_choice", | ||
| "reasoning", | ||
| "previous_response_id", | ||
| "truncation", | ||
| } | ||
|
|
||
| return {k: v for k, v in request.items() if k in allowed_keys} |
There was a problem hiding this comment.
Allowlist may silently drop valid future parameters
The allowlist approach is a sound improvement over the previous pop() pattern, but it has a maintainability trade-off: any new parameter that ChatGPT's Responses API starts supporting in the future will be silently dropped until this allowlist is updated. Consider adding a code comment noting this so future developers know to update allowed_keys when the ChatGPT Responses API evolves.
Additionally, the parent class's get_supported_openai_params() is not overridden in ChatGPTResponsesAPIConfig, so it still advertises all OpenAI Responses API params as "supported" even though they'll be stripped here. Overriding get_supported_openai_params to return only the allowed keys would give callers accurate information about what's actually supported and enable LiteLLM's drop_params logic to surface warnings when unsupported params are provided.
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!
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
cf94802 to
35bbcf9
Compare
…-unsupported-params Fix/21193 chatgpt codex unsupported params
Summary
Fixes ChatGPT Codex (chatgpt/gpt-5.2-codex, etc.) failures where the Responses API bridge forwards unsupported params (like user, temperature, context_management) and the API rejects the request.
What changed
Updated ChatGPTResponsesAPIConfig.transform_responses_api_request() to use an allowlist of supported Responses API keys and drop everything else.
Keeps required ChatGPT defaults (streaming enabled + reasoning.encrypted_content included).
Why this works
Codex’s Responses endpoint is strict about accepted parameters. By only sending known-supported keys, we prevent “Unsupported parameter: …” errors without needing to chase every new unsupported param via pop().
Tests
Added/updated unit test in tests/test_litellm/llms/chatgpt/responses/test_chatgpt_responses_transformation.py to assert unsupported keys are removed and supported keys remain.
Fixes #21193