Bug Description
When using use_chat_completions_api: true to bridge /v1/responses → /v1/chat/completions, two issues cause failures with clients like Codex desktop that send Responses API requests with reasoning_effort and non-standard tool types.
Issue 1: allowed_openai_params not forwarded through the bridge path
When a model is configured with use_chat_completions_api: true and allowed_openai_params: ["reasoning_effort"], the allowed_openai_params is not forwarded from litellm.aresponses() to the underlying litellm.acompletion() call in the chat completions bridge path.
Root cause: In responses/main.py, allowed_openai_params is an explicit named parameter of the responses() / aresponses() function. When the bridge path calls litellm_completion_transformation_handler.response_api_handler(), it passes **kwargs — but allowed_openai_params has already been extracted as a named parameter and is not in kwargs. The handler then calls litellm.acompletion(**acompletion_args) without allowed_openai_params, causing UnsupportedParamsError.
Trace:
litellm.UnsupportedParamsError: openai does not support parameters: [reasoning_effort], for model=EB-GLM-5.2
Code path:
responses/main.py line ~1083: calls response_api_handler(... **kwargs) — allowed_openai_params is NOT in kwargs (it is a named param of responses())
handler.py async_response_api_handler: builds acompletion_args from kwargs — no allowed_openai_params
litellm.acompletion(**acompletion_args) — fails with UnsupportedParamsError
Fix applied (local patch):
responses/main.py: explicitly pass allowed_openai_params=allowed_openai_params to the response_api_handler() call
handler.py: read allowed_openai_params from kwargs and forward to litellm.acompletion() / litellm.completion()
Issue 2: namespace and tool_search tool types silently dropped
In transformation.py, the transform_responses_api_tools_to_chat_completion_tools() method handles tool conversion. The else branch drops namespace and tool_search types (and passes through unknown types verbatim, causing upstream 400 errors).
namespace tools contain sub-tools (all function type) that should be expanded into the flat tool list. Dropping them loses functionality (e.g., Codex sends collaboration namespace with 6 function tools for sub-agent management, and codex_app namespace with 3 function tools).
tool_search tools have description and parameters fields and can be converted to a function type tool. Dropping them loses tool discovery capability.
Error when tool_search is passed through verbatim (before any fix):
BadRequestError: OpenAIException - {"error":{"message":"name is a required property - tools.11.function","type":"invalid_request_error"}}
Fix applied (local patch):
namespace: recursively expand sub-tools via transform_responses_api_tools_to_chat_completion_tools()
tool_search: convert to function type with name="tool_search", description and parameters from original tool
- Only truly unsupported types (
computer_use, image_generation, shell) are still dropped
Environment
LiteLLM version: 1.95.0 (dev)
Python: 3.13
Deployment: Docker (docker-compose)
Model config (stored in DB via STORE_MODEL_IN_DB=True)
{
"model_name": "GLM-5.2",
"litellm_params": {
"custom_llm_provider": "openai",
"litellm_credential_name": "Hik",
"model": "EB-GLM-5.2",
"use_chat_completions_api": true,
"allowed_openai_params": ["reasoning_effort"]
}
}
The upstream provider supports /v1/chat/completions with reasoning_effort but does NOT support /v1/responses natively, hence use_chat_completions_api: true.
Reproduction
curl -X POST http://localhost:4000/v1/responses \
-H "Authorization: Bearer sk-1234" \
-H "Content-Type: application/json" \
-d {
Bug Description
When using
use_chat_completions_api: trueto bridge/v1/responses→/v1/chat/completions, two issues cause failures with clients like Codex desktop that send Responses API requests withreasoning_effortand non-standard tool types.Issue 1:
allowed_openai_paramsnot forwarded through the bridge pathWhen a model is configured with
use_chat_completions_api: trueandallowed_openai_params: ["reasoning_effort"], theallowed_openai_paramsis not forwarded fromlitellm.aresponses()to the underlyinglitellm.acompletion()call in the chat completions bridge path.Root cause: In
responses/main.py,allowed_openai_paramsis an explicit named parameter of theresponses()/aresponses()function. When the bridge path callslitellm_completion_transformation_handler.response_api_handler(), it passes**kwargs— butallowed_openai_paramshas already been extracted as a named parameter and is not inkwargs. The handler then callslitellm.acompletion(**acompletion_args)withoutallowed_openai_params, causingUnsupportedParamsError.Trace:
Code path:
responses/main.pyline ~1083: callsresponse_api_handler(... **kwargs)—allowed_openai_paramsis NOT inkwargs(it is a named param ofresponses())handler.pyasync_response_api_handler: buildsacompletion_argsfromkwargs— noallowed_openai_paramslitellm.acompletion(**acompletion_args)— fails withUnsupportedParamsErrorFix applied (local patch):
responses/main.py: explicitly passallowed_openai_params=allowed_openai_paramsto theresponse_api_handler()callhandler.py: readallowed_openai_paramsfromkwargsand forward tolitellm.acompletion()/litellm.completion()Issue 2:
namespaceandtool_searchtool types silently droppedIn
transformation.py, thetransform_responses_api_tools_to_chat_completion_tools()method handles tool conversion. Theelsebranch dropsnamespaceandtool_searchtypes (and passes through unknown types verbatim, causing upstream 400 errors).namespacetools contain sub-tools (allfunctiontype) that should be expanded into the flat tool list. Dropping them loses functionality (e.g., Codex sendscollaborationnamespace with 6 function tools for sub-agent management, andcodex_appnamespace with 3 function tools).tool_searchtools havedescriptionandparametersfields and can be converted to afunctiontype tool. Dropping them loses tool discovery capability.Error when tool_search is passed through verbatim (before any fix):
Fix applied (local patch):
namespace: recursively expand sub-tools viatransform_responses_api_tools_to_chat_completion_tools()tool_search: convert tofunctiontype with name="tool_search", description and parameters from original toolcomputer_use,image_generation,shell) are still droppedEnvironment
Model config (stored in DB via
STORE_MODEL_IN_DB=True){ "model_name": "GLM-5.2", "litellm_params": { "custom_llm_provider": "openai", "litellm_credential_name": "Hik", "model": "EB-GLM-5.2", "use_chat_completions_api": true, "allowed_openai_params": ["reasoning_effort"] } }The upstream provider supports
/v1/chat/completionswithreasoning_effortbut does NOT support/v1/responsesnatively, henceuse_chat_completions_api: true.Reproduction