litellm - 💡(How to fix) Fix Responses API → Chat Completions transformation silently passes through unsupported built-in tool types [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Fix Action

Fixed

Code Example

from litellm.responses.litellm_completion_transformation.transformation import (
    LiteLLMCompletionResponsesConfig,
)

# This should be dropped, but was previously passed through
tools = [{"type": "local_shell"}]
result, _ = LiteLLMCompletionResponsesConfig.transform_responses_api_tools_to_chat_completion_tools(
    tools=tools
)
print(result)  # Before fix: [{"type": "local_shell"}]  → provider errors

---

unsupported_tool_types = [
       "local_shell",
       "file_search",
       "image_generation",
       "namespace",
   ]
RAW_BUFFERClick to expand / collapse

Problem

When LiteLLM converts an OpenAI Responses API request to the Chat Completions API, several built-in tool types that have no valid equivalent in the Chat Completions spec are silently passed through to the provider. This causes provider-side 400 errors such as:

"tools[N].type:type is illegal"

Affected tool types

  • local_shell — Codex CLI built-in shell tool (no Chat Completions equivalent)
  • file_search — OpenAI file search tool (handled separately by emulated handler, but still leaks through in transformation)
  • image_generation — OpenAI image generation tool
  • namespace — Codex CLI 0.130.0 tool namespace
  • mcp — MCP server tools are Responses-API-specific
  • code_interpreter — Has no native Chat Completions equivalent, but previously passed through raw
  • computer_use / computer_use_preview — Passed through raw, causing schema validation failures on generic providers
  • Unknown / passthrough types (e.g. tool_search, code_execution_20250825, Vertex AI native tools) — silently forwarded

Repro

from litellm.responses.litellm_completion_transformation.transformation import (
    LiteLLMCompletionResponsesConfig,
)

# This should be dropped, but was previously passed through
tools = [{"type": "local_shell"}]
result, _ = LiteLLMCompletionResponsesConfig.transform_responses_api_tools_to_chat_completion_tools(
    tools=tools
)
print(result)  # Before fix: [{"type": "local_shell"}]  → provider errors

Proposed Fix

PR #27652 addresses this by:

  1. Declaring unsupported built-in types via a class-level unsupported_tool_types constant:

    unsupported_tool_types = [
        "local_shell",
        "file_search",
        "image_generation",
        "namespace",
    ]
  2. Converting code_interpreter to a function tool so the model can still generate code via a named tool call.

  3. Mapping computer_use per provider:

    • Anthropic → preserves computer_use_preview type with function.parameters wrapper
    • Gemini/Vertex AI → flat dict with type="computer_use"
    • Generic providers → converted to a function tool
  4. Dropping MCP tools with a warning log instead of passing them through.

  5. Dropping unknown tool types with a warning log instead of passing them through.

  6. Adding comprehensive test coverage for all of the above.

Related

  • PR #27652 — fix implementation

Environment

  • LiteLLM version: main (post 1.79.1)
  • Python: 3.12+

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - 💡(How to fix) Fix Responses API → Chat Completions transformation silently passes through unsupported built-in tool types [1 pull requests]