litellm - ✅(Solved) Fix [Bug]: thinking.display="summarized" not set for Claude Opus 4.7, causing silent loss of reasoning content [1 pull requests, 1 participants]

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…
GitHub stats
BerriAI/litellm#25965Fetched 2026-04-18 05:52:47
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Timeline (top)
referenced ×2cross-referenced ×1labeled ×1

Claude Opus 4.7 (released 2026-04-16) introduced a silent breaking change: thinking content is omitted by default. Callers must explicitly set thinking.display = "summarized" to restore the visible reasoning summary that was the default on Opus 4.6.

LiteLLM _map_reasoning_effort() in litellm/llms/anthropic/chat/transformation.py builds the thinking dict for Claude 4.6+ models but does not set the display field. Result: any litellm.completion(model="claude-opus-4-7", reasoning_effort=...) returns HTTP 200, charges thinking tokens, ships an empty thinking_blocks[].thinking field, and reasoning_content == "". No error is raised. Existing 4.6 code that relies on reasoning_content silently degrades after switching to 4.7.

Error Message

LiteLLM _map_reasoning_effort() in litellm/llms/anthropic/chat/transformation.py builds the thinking dict for Claude 4.6+ models but does not set the display field. Result: any litellm.completion(model="claude-opus-4-7", reasoning_effort=...) returns HTTP 200, charges thinking tokens, ships an empty thinking_blocks[].thinking field, and reasoning_content == "". No error is raised. Existing 4.6 code that relies on reasoning_content silently degrades after switching to 4.7.

Root Cause

litellm/llms/anthropic/chat/transformation.py:

if AnthropicConfig._is_claude_4_6_model(model) or AnthropicConfig._is_claude_4_7_model(model):
    return AnthropicThinkingParam(
        type="adaptive",
        # missing: display="summarized"
    )

AnthropicThinkingParam TypedDict in litellm/types/llms/anthropic.py is also missing the display field.

Fix Action

Fix / Workaround

resp = litellm.completion( model="vertex_ai/claude-opus-4-7", vertex_credentials="<sa.json>", vertex_project="<project>", vertex_location="global", messages=[{"role": "user", "content": "<any prompt that needs reasoning>"}], max_tokens=4096, reasoning_effort="max", # also requires #25958 patch to not raise ) msg = resp.choices[0].message print(repr(getattr(msg, "reasoning_content", None))) print(msg.thinking_blocks)

PR fix notes

PR #25967: fix(anthropic): default thinking.display="summarized" on Claude Opus 4.7

Description (problem / solution / changelog)

Relevant issues

Fixes #25965

Pre-Submission checklist

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Type

Bug Fix

Changes

Claude Opus 4.7 omits thinking content by default unless thinking.display="summarized" is set. _map_reasoning_effort doesn't set it, so callers using reasoning_effort against claude-opus-4-7 get empty reasoning_content while still being billed for thinking tokens.

Set display="summarized" on the 4.7 branch in _map_reasoning_effort. Caller-provided thinking dicts are passed through unchanged. Added a display field to AnthropicThinkingParam and tests.

Screenshots / Proof of Fix

Verified on vertex_ai/claude-opus-4-7 (locations/global): reasoning_content populated again with reasoning_effort="high".

Bedrock note

bedrock/chat/converse_transformation.py reuses _map_reasoning_effort, so Bedrock 4.7 will also send display. Couldn't verify on a real Bedrock account; happy to add a strip helper if it breaks.

Changed files

  • litellm/llms/anthropic/chat/transformation.py (modified, +29/-23)
  • litellm/types/llms/anthropic.py (modified, +1/-0)
  • tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py (modified, +221/-6)
  • uv.lock (modified, +3/-3)

Code Example

import litellm

resp = litellm.completion(
    model="vertex_ai/claude-opus-4-7",
    vertex_credentials="<sa.json>",
    vertex_project="<project>",
    vertex_location="global",
    messages=[{"role": "user", "content": "<any prompt that needs reasoning>"}],
    max_tokens=4096,
    reasoning_effort="max",   # also requires #25958 patch to not raise
)
msg = resp.choices[0].message
print(repr(getattr(msg, "reasoning_content", None)))
print(msg.thinking_blocks)

---

""
[{"type": "thinking", "thinking": "", "signature": "<1992 bytes>"}]

---

if AnthropicConfig._is_claude_4_6_model(model) or AnthropicConfig._is_claude_4_7_model(model):
    return AnthropicThinkingParam(
        type="adaptive",
        # missing: display="summarized"
    )
RAW_BUFFERClick to expand / collapse

Summary

Claude Opus 4.7 (released 2026-04-16) introduced a silent breaking change: thinking content is omitted by default. Callers must explicitly set thinking.display = "summarized" to restore the visible reasoning summary that was the default on Opus 4.6.

LiteLLM _map_reasoning_effort() in litellm/llms/anthropic/chat/transformation.py builds the thinking dict for Claude 4.6+ models but does not set the display field. Result: any litellm.completion(model="claude-opus-4-7", reasoning_effort=...) returns HTTP 200, charges thinking tokens, ships an empty thinking_blocks[].thinking field, and reasoning_content == "". No error is raised. Existing 4.6 code that relies on reasoning_content silently degrades after switching to 4.7.

Reproduction

litellm @ HEAD (f69b9d6, 2026-04-17), vertex_ai/claude-opus-4-7, locations/global endpoint:

import litellm

resp = litellm.completion(
    model="vertex_ai/claude-opus-4-7",
    vertex_credentials="<sa.json>",
    vertex_project="<project>",
    vertex_location="global",
    messages=[{"role": "user", "content": "<any prompt that needs reasoning>"}],
    max_tokens=4096,
    reasoning_effort="max",   # also requires #25958 patch to not raise
)
msg = resp.choices[0].message
print(repr(getattr(msg, "reasoning_content", None)))
print(msg.thinking_blocks)

Actual:

""
[{"type": "thinking", "thinking": "", "signature": "<1992 bytes>"}]

Expected: reasoning_content contains the human-readable summary.

Direct curl to Vertex AI confirms upstream returns the summary when display: "summarized" is explicitly set.

Root cause

litellm/llms/anthropic/chat/transformation.py:

if AnthropicConfig._is_claude_4_6_model(model) or AnthropicConfig._is_claude_4_7_model(model):
    return AnthropicThinkingParam(
        type="adaptive",
        # missing: display="summarized"
    )

AnthropicThinkingParam TypedDict in litellm/types/llms/anthropic.py is also missing the display field.

Suggested fix

  1. Add display: NotRequired[Literal["omitted", "summarized"]] to AnthropicThinkingParam.
  2. In _map_reasoning_effort for the 4.6/4.7 branch, set display="summarized" to preserve pre-4.7 behavior.
  3. Optionally allow opting out via a litellm setting for users that prefer the new omitted default for latency.

References

Environment

  • LiteLLM: main @ f69b9d6 (also reproducible on PyPI 1.83.9)
  • Provider: vertex_ai (the anthropic direct path is also affected; verified via transform_request unit-level inspection)
  • Model: claude-opus-4-7

extent analysis

TL;DR

To fix the issue with Claude Opus 4.7, update the AnthropicThinkingParam TypedDict to include the display field and set display="summarized" in _map_reasoning_effort for 4.6/4.7 models.

Guidance

  • Update AnthropicThinkingParam in litellm/types/llms/anthropic.py to include display: NotRequired[Literal["omitted", "summarized"]].
  • Modify _map_reasoning_effort in litellm/llms/anthropic/chat/transformation.py to set display="summarized" for 4.6/4.7 models.
  • Consider adding an optional litellm setting to allow users to opt out of the default summarized display and use the new omitted default instead.
  • Verify the fix by checking the reasoning_content field in the response and ensuring it contains the expected human-readable summary.

Example

# In litellm/types/llms/anthropic.py
from typing import NotRequired, Literal

class AnthropicThinkingParam(TypedDict):
    # ... existing fields ...
    display: NotRequired[Literal["omitted", "summarized"]]

# In litellm/llms/anthropic/chat/transformation.py
if AnthropicConfig._is_claude_4_6_model(model) or AnthropicConfig._is_claude_4_7_model(model):
    return AnthropicThinkingParam(
        type="adaptive",
        display="summarized"  # Add this line
    )

Notes

This fix assumes that the display field is the only missing piece to restore the pre-4.7 behavior. Additional changes might be required if other factors are contributing to the issue.

Recommendation

Apply the suggested fix to update the AnthropicThinkingParam and _map_reasoning_effort to preserve the pre-4.7 behavior and ensure the reasoning_content field is populated correctly.

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 - ✅(Solved) Fix [Bug]: thinking.display="summarized" not set for Claude Opus 4.7, causing silent loss of reasoning content [1 pull requests, 1 participants]