Skip to content

[Bug] use_chat_completions_api bridge: allowed_openai_params not forwarded + namespace/tool_search tools dropped #35878

Description

@W0921

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:

  1. responses/main.py line ~1083: calls response_api_handler(... **kwargs)allowed_openai_params is NOT in kwargs (it is a named param of responses())
  2. handler.py async_response_api_handler: builds acompletion_args from kwargs — no allowed_openai_params
  3. 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 {

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions