Skip to content

bug: Anthropic /v1/messages -> Responses API adapter drops required detail field on images and mislabels thinking as output_text #37175

Closed

Description

@abhishekkumar-sing

Related to #23841 (same file, different specific bugs).

Environment: litellm main-stable, target backend: self-hosted vLLM 0.27.1 (OpenAI-compatible /v1/responses), via /v1/messages -> litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py.

Bug 1: input_image missing required detail field -> 400

translate_messages_to_responses_input, btype == "image" branch:

user_parts.append({"type": "input_image", "image_url": url})

The Responses API's ResponseInputImageParam requires detail: "low"|"high"|"auto"|"original". Without it the backend rejects the request with a large Pydantic union-validation error, which litellm's own MaskedHTTPStatusError then hides -- confirmed by reproducing the identical error directly against vLLM with the same field missing, and confirmed fixed by adding it.

Repro: send any image content block (e.g. a PDF page rendered by Claude Code's Read tool) through /v1/messages to an OpenAI-Responses-API-compatible backend.

Fix:

- user_parts.append({"type": "input_image", "image_url": url})
+ user_parts.append({"type": "input_image", "image_url": url, "detail": "auto"})

Bug 2: assistant thinking blocks mislabeled as output_text

Same function, btype == "thinking" branch:

asst_parts.append({"type": "output_text", "text": thinking_text})

Prior reasoning content gets folded into the message's regular visible text instead of a proper reasoning item, so on multi-turn replay the model can no longer distinguish its own prior thinking from prior final answers. The response-side translation in this same file already builds real reasoning/ResponseReasoningItem items -- this is only the request-side/history-replay path.

Fix:

- asst_parts.append({"type": "output_text", "text": thinking_text})
+ input_items.append({"type": "reasoning", "id": block.get("signature") or f"reasoning_{len(input_items)}", "summary": [{"type": "summary_text", "text": thinking_text}]})

Happy to open a PR with both fixes if useful.

Activity

  1. abhishekkumar-sing commented on Aug 17, 2026

    @abhishekkumar-sing
    Author

    Opened a fix for both bugs above: #37176

    Summary of the fix (3 lines, one file):

    • input_image blocks (direct + tool_result-embedded) now include the required detail: "auto" field.
    • thinking blocks now become a proper top-level {"type": "reasoning", ...} item instead of being folded into output_text.

    Both verified against a live self-hosted vLLM /v1/responses backend before opening the PR.

  2. curious-broccoli commented on Sep 4, 2026

    @curious-broccoli
    Contributor

    I think the issue for the image detail is that vLLM currently requires the parameter while openai apparently doesn't require it, see vllm-project/vllm#32685

    It's not a litellm bug as far as I know

  3. mateo-berri commented on Oct 15, 2026

    @mateo-berri
    Contributor

    Closing as completed. #46720 adds detail auto to image parts on this bridge, and thinking blocks replay as reasoning items since 2bca7ff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions