BerriAI/litellm · error · ValueError

Unknown items in responses API response

Error message

Unknown items in responses API response: {output_items}

What it means

The response contained output items, but none of them could be converted into chat-completion choices, and incomplete_details gave no reason. The bridge's converter recognizes a fixed set of output item types (message, function_call, custom_tool_call, reasoning via specific paths); any other item type in output yields zero choices and triggers this error, listing the unrecognized output_items. It usually means a newer Responses API feature the installed litellm does not map.

Solutions

  1. Upgrade litellm to the latest version — new output item types get mappers quickly
  2. Read the output_items in the error text to identify which type is unmapped, then disable the feature producing it (e.g. drop tools=[{"type":"web_search"}] style built-ins) for chat-bridged calls
  3. Call litellm.responses(...) directly for responses-native features instead of bridging them into chat format
  4. If you control the tool, restructure output as message or function_call items

Example fix

// before
resp = litellm.completion(model="openai/gpt-5", messages=msgs,
                          tools=[{"type": "web_search_preview"}])  # ValueError: Unknown items in responses API response: [{'type': 'web_search_call', ...}]

// after
resp = litellm.responses(model="openai/gpt-5", input=msgs,
                         tools=[{"type": "web_search_preview"}])  # consume native Responses API output
Defensive patterns

Strategy: try-catch

Validate before calling

null

Try / catch

try:
    resp = litellm.completion(model=m, messages=msgs, tools=tools)
except ValueError as e:
    if "Unknown items in responses API response" in str(e):
        # output contains unmapped item types: use the native Responses API instead
        return litellm.responses(model=m, input=msgs, tools=tools)
    raise

Prevention

When it happens

Trigger: Responses API output containing item types like web_search_call, file_search_call, computer_call, mcp_tool_call, code_interpreter_call, or new provider-specific items; built-in tools (web search, file search) enabled on a model routed through the chat bridge; a litellm version predating support for a newly added output type.

Common situations: Enabling Responses-API built-in tools and then calling the model via litellm.completion (which forces chat-format translation); a provider shipping a new output item type before litellm adds a mapper; guardrails/filters rewriting output into unusual shapes; staying on an old litellm while the provider API evolves.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/dafe1c53619ab67f. Report an issue: GitHub.

Appendix: source

Thrown at litellm/completion_extras/litellm_responses_transformation/transformation.py:770

            if recovered_output_items:
                output_items = cast(Any, recovered_output_items)
                raw_response.output = cast(Any, recovered_output_items)
                verbose_logger.warning(
                    "Recovered empty Responses API output from raw SSE for model=%s",
                    model,
                )

        # Convert response output to choices using the static helper
        choices: Final = self._convert_response_output_to_choices(
            output_items=output_items,
            handle_raw_dict_callback=self._handle_raw_dict_response_item,
        )

        if len(choices) == 0:
            if raw_response.incomplete_details is not None and raw_response.incomplete_details.reason is not None:
                raise ValueError(f"{model} unable to complete request: {raw_response.incomplete_details.reason}")
            else:
                raise ValueError(f"Unknown items in responses API response: {output_items}")

        setattr(model_response, "choices", choices)

        model_response.model = model

        setattr(
            model_response,
            "usage",
            ResponseAPILoggingUtils._transform_response_api_usage_to_chat_usage(raw_response.usage),
        )

        # Preserve hidden params from the ResponsesAPIResponse, especially the headers
        # which contain important provider information like x-request-id
        raw_response_hidden_params: Final = getattr(raw_response, "_hidden_params", {})
        if raw_response_hidden_params:
            if not hasattr(model_response, "_hidden_params") or model_response._hidden_params is None:
                model_response._hidden_params = {}
            # Merge the raw_response hidden params with model_response hidden params

View on GitHub (pinned to 77b7c6c40c)