Extended thinking in the Claude API has changed a lot. The old budget_tokens setting is now a legacy feature, and the current models use adaptive thinking with an effort level instead. This guide shows you exactly how it works today, with Python code you can run.
You will learn how to turn thinking on, stream it, read summaries, use it with tools, and work out what it costs. Every parameter here comes from the official Claude docs, checked on 28 November 2026.
- New way: use
thinking={"type": "adaptive"}and control depth withoutput_config={"effort": "..."}. - Old way:
budget_tokensreturns a 400 error on Claude 4.7 and later models, including Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.2. - Always on: Opus 5.5 and Fable 5.2 think by default and cannot turn thinking off.
- See the reasoning: add
"display": "summarized". The default on new models is"omitted"(empty thinking text). - Billing: you pay for the full thinking tokens as output tokens, even when you only see a summary or nothing.
What Extended and Adaptive Thinking Are
When thinking is active, Claude works through the problem before it answers. It restates the task, tries approaches, checks its work and drops ideas that fail. That work comes back as thinking content blocks placed before the normal text block.
This helps most on hard tasks. Think of math, tricky bugs, data analysis and long agent runs. For a simple lookup or a short chat reply, thinking adds cost and delay with little gain.
- Extended thinking (legacy): you set a fixed token budget with
budget_tokens, and Claude thinks against it on every turn. - Adaptive thinking (current): Claude decides per request whether to think and how much. You steer it with the effort level.
- Signature: each thinking block has a
signaturefield. It is an encrypted copy of the full reasoning that you send back unchanged in multi-turn and tool conversations.
Note: New to the SDK? Start with my Claude API Python tutorial first, then come back here. If you still need a key, see how to get a Claude API key.
budget_tokens vs Effort vs Adaptive: What the Docs Say Now
This is the part most older tutorials get wrong. The official extended thinking page now opens with a warning: extended thinking is a legacy feature, and Claude 4.7 and later models reject it with a 400 error.
| Setting | Where it goes | What it does | Status |
|---|---|---|---|
{"type": "enabled", "budget_tokens": N} |
thinking |
Fixed thinking budget, minimum 1,024 tokens, must be less than max_tokens |
Deprecated on Opus 4.6 / Sonnet 4.6, rejected on 4.7 and later |
{"type": "adaptive"} |
thinking |
Claude decides when and how much to think | Recommended on every current model |
"low" to "max" |
output_config.effort |
Soft guidance for how much work goes into the whole reply, thinking included | GA, no beta header |
max_tokens |
top level | Hard cap on total output (thinking plus answer) | Always applies |
So the mental model is simple. thinking picks the mode. effort picks how hard Claude tries. max_tokens is the only strict limit on spend.
The five effort levels
- max: thinks the most, with no limit on thinking length. Slowest and most expensive.
- xhigh: deeper than high, made for long agentic and coding tasks.
- high: the default on most models. Thinks on most requests that benefit from it.
- medium: the default on Opus 5.5 and Haiku 5.5. May skip thinking on simple queries.
- low: minimal thinking. Good for subagents, chat and simple high-volume work.
Warning: Opus 5.5 defaults to medium, one level below Opus 5. If you move code from Opus 5 and leave effort unset, it will think less. Set effort explicitly. I cover the cost side of each level in reasoning effort settings and API cost.
Which Models Support Thinking
Every current Claude model supports thinking, but the defaults differ. This table comes from the official per-model configuration table, with prices from the Claude pricing page.
| Model (API ID) | Thinking mode | Default | Can you turn it off? | Default effort | Input / output per 1M |
|---|---|---|---|---|---|
Fable 5.2 (claude-fable-5-2) |
Adaptive only | Always on | No | high | $8 / $40 |
Opus 5.5 (claude-opus-5-5) |
Adaptive only | Always on | No | medium | $4 / $20 |
Opus 5 (claude-opus-5) |
Adaptive only | On | Yes, at high effort or below | high | $5 / $25 |
Sonnet 5.5 (claude-sonnet-5-5) |
Adaptive, or between_tools |
On | Up-front thinking only, via between_tools |
high | $2 / $10 |
Sonnet 5 (claude-sonnet-5) |
Adaptive only | On | Yes | high | $2 / $10 |
Haiku 5.5 (claude-haiku-5-5) |
Adaptive only | On | Yes, at high effort or below | medium | $0.10 / $0.50 (prompts up to 100K) |
| Opus 4.8 / 4.7 | Adaptive only | Off | Yes | high | $5 / $25 |
| Opus 4.6 / Sonnet 4.6 | Adaptive, or extended (deprecated) | Off | Yes | high | $5 / $25 and $3 / $15 |
| Haiku 4.5 / Sonnet 4.5 / Opus 4.5 | Extended only (budget_tokens) |
Off | Yes | n/a (Opus 4.5 supports effort) | $1 / $5, $3 / $15, $5 / $25 |
Two recent changes matter here. Claude Fable 5.2 launched on 9 November 2026 with always-on adaptive thinking. On 23 November 2026, Anthropic announced that Opus 4.5 retires from the Claude API on 22 January 2027, so plan to move any budget_tokens code off it.
Tip: To check a model in code, read capabilities.thinking.types.disabled.supported from the Models API before you send a request.
Setup: Prerequisites and Install
You need very little to follow along. I checked every example against the anthropic Python SDK 2.14.0, the latest release on PyPI (24 November 2026).
- Python: 3.10 or newer (the SDK’s minimum).
- API key: from the Claude Console, with some credit on the account.
- SDK 2.x: version 2.0.0 and later sends API version
2026-10-21by default.
- Create a project folder and virtual environment. Run
python3 -m venv .venv, then activate it withsource .venv/bin/activate(on Windows,.venv\Scripts\activate). - Install the SDK. Run
pip install -U anthropicand confirm withpip show anthropic. - Set your key as an environment variable. Run
export ANTHROPIC_API_KEY="your-key"(Windows PowerShell:$env:ANTHROPIC_API_KEY="your-key"). Never paste the key into code. - Pick a model. The examples use
claude-opus-5-5. Swap inclaude-sonnet-5-5orclaude-haiku-5-5to save money. - Remove old sampling settings. On the new models, a non-default
temperature,top_portop_kreturns a 400 error. Leave them out.
Example 1: Turn On Thinking in Python
On Opus 5.5 thinking is already on, so you only add settings to see it and to set effort. This script prints the summary, the answer and how many output tokens went to thinking.
import anthropic
client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY
response = client.messages.create(
model="claude-opus-5-5",
max_tokens=16000,
thinking={"type": "adaptive", "display": "summarized"},
output_config={"effort": "high"},
messages=[
{
"role": "user",
"content": "What is the greatest common divisor of 1071 and 462?",
}
],
)
for block in response.content:
if block.type == "thinking":
print("THINKING SUMMARY:\n", block.thinking)
elif block.type == "text":
print("\nANSWER:\n", block.text)
usage = response.usage
details = usage.output_tokens_details
thinking_tokens = details.thinking_tokens if details else 0
print(f"\nInput tokens: {usage.input_tokens}")
print(f"Output tokens (billed): {usage.output_tokens}")
print(f"Of which thinking: {thinking_tokens}")
- display “summarized”: without it, the new models return the thinking block with an empty
thinkingfield. - max_tokens: thinking counts toward it, so leave plenty of room.
- No thinking block? That is normal in adaptive mode. Claude skips thinking on requests it judges simple.
Example 2: Stream Thinking as It Arrives
Streaming is the best choice for long replies. Thinking text arrives as thinking_delta events, then one signature_delta closes the block, then the answer streams as text_delta events.
import anthropic
client = anthropic.Anthropic()
with client.messages.stream(
model="claude-opus-5-5",
max_tokens=64000,
thinking={"type": "adaptive", "display": "summarized"},
output_config={"effort": "high"},
messages=[
{
"role": "user",
"content": "Plan a 3-step migration from a monolith to services for a small shop.",
}
],
) as stream:
for event in stream:
if event.type == "content_block_start":
print(f"\n--- {event.content_block.type} ---")
elif event.type == "content_block_delta":
if event.delta.type == "thinking_delta":
print(event.delta.thinking, end="", flush=True)
elif event.delta.type == "text_delta":
print(event.delta.text, end="", flush=True)
final = stream.get_final_message()
print("\n\nStop reason:", final.stop_reason)
print("Output tokens:", final.usage.output_tokens)
Use get_final_message() to rebuild complete thinking blocks with their signatures. Don’t join the deltas yourself. You will need the full blocks if you continue the chat.
Note: The SDK requires streaming when max_tokens is above 21,333. Thinking text can also arrive in “chunky” bursts. The docs say this batching is expected.
Summarized vs Omitted vs Full Thinking
The display field only changes what you see. It never changes what Claude thinks or what you pay. No setting returns the raw chain of thought.
| display value | What you get | Default on | Best for |
|---|---|---|---|
"summarized" |
A readable summary of the reasoning, written by a separate model | Opus 4.6, Sonnet 4.6 and earlier | Debugging prompts, showing “how I got here” to users |
"omitted" |
Thinking blocks with an empty thinking field, signature only |
Fable 5.x, Opus 5.5, Opus 5, Sonnet 5.5, Sonnet 5, Haiku 5.5, Opus 4.8 / 4.7 | Production apps; faster time to first text token |
"updates" (beta) |
Reasoning stays hidden, but short progress notes between tool calls come back as text | None (needs header thinking-display-updates-2026-08-18) |
Agent UIs that show a status line per step |
| Full raw thinking | Not available through any setting | n/a | Contact Anthropic sales in rare cases |
- Cost is identical: you pay for the full thinking tokens in every mode. Omitting cuts delay, not cost.
- Summary tokens are free: summary generation has no charge, so the visible token count is lower than the billed one.
- Don’t ask for reasoning in the answer: some models refuse with
stop_details.category: "reasoning_extraction". Read the thinking blocks instead.
Example 3: Interleaved Thinking with Tools
Interleaved thinking lets Claude think between tool calls. It reads each tool result and then decides the next step. With adaptive thinking this is automatic, with no beta header.
The key rule: pass the assistant content back exactly as received, thinking blocks included. A tool loop counts as one assistant turn, so you cannot switch thinking on or off in the middle of it.
import json
import anthropic
client = anthropic.Anthropic()
weather_tool = {
"name": "get_weather",
"description": "Get the current temperature for a city.",
"input_schema": {
"type": "object",
"properties": {"city": {"type": "string", "description": "City name"}},
"required": ["city"],
},
}
def get_weather(city: str) -> str:
# Replace with a real weather API call
fake = {"Paris": 14, "Rome": 19}
return f"{fake.get(city, 20)} C"
messages = [{"role": "user", "content": "Is it warmer in Paris or Rome right now?"}]
while True:
response = client.messages.create(
model="claude-opus-5-5",
max_tokens=16000,
thinking={"type": "adaptive", "display": "summarized"},
tools=[weather_tool],
messages=messages,
)
# Echo the whole assistant turn back, thinking blocks included
messages.append({"role": "assistant", "content": response.content})
if response.stop_reason != "tool_use":
break
results = []
for block in response.content:
if block.type == "tool_use":
args = block.input if isinstance(block.input, dict) else json.loads(block.input)
results.append({
"type": "tool_result",
"tool_use_id": block.id,
"content": get_weather(args["city"]),
})
# All tool results go back in ONE user message
messages.append({"role": "user", "content": results})
for block in response.content:
if block.type == "text":
print(block.text)
- Don’t filter blocks by type: if you keep only
"thinking"blocks you dropredacted_thinkingblocks and break the turn. - No forced tools: Opus 5.5, Sonnet 5.5, Fable 5.2 and Fable 5.1 reject
tool_choiceof"any"or a named tool. Use"auto"and say in the prompt when to use the tool. - Keep history append-only: on models with preserved thinking (Fable 5.2, Opus 5.5, Sonnet 5.5, Haiku 5.5 and others), editing
system,toolsor an earlier message can make replayed thinking blocks fail a check.
Example 4: Legacy budget_tokens and a curl Request
You only need budget_tokens on models that support extended thinking only, such as Haiku 4.5, Sonnet 4.5 and Opus 4.5. On those models, "adaptive" returns a 400 error.
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-haiku-4-5",
max_tokens=16000, # must be larger than the budget
thinking={"type": "enabled", "budget_tokens": 10000}, # minimum 1,024
messages=[{"role": "user", "content": "Are there infinitely many primes where n mod 4 == 3?"}],
)
for block in response.content:
if block.type == "thinking":
print("THINKING:", block.thinking)
elif block.type == "text":
print("ANSWER:", block.text)
To migrate to a newer model, delete budget_tokens, set thinking={"type": "adaptive"}, and set output_config={"effort": "high"} (or the level that fits). You can also drop the old interleaved-thinking-2025-05-14 beta header.
Here is the same adaptive request from Example 1 as a plain curl call:
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2026-10-21" \
-H "content-type: application/json" \
-d '{
"model": "claude-opus-5-5",
"max_tokens": 16000,
"thinking": {"type": "adaptive", "display": "summarized"},
"output_config": {"effort": "high"},
"messages": [
{"role": "user", "content": "What is the greatest common divisor of 1071 and 462?"}
]
}'
How Thinking Tokens Are Billed (Worked Example)
There is no separate thinking price. Thinking tokens are billed as normal output tokens at the model’s output rate. For base rates on every model, see my Claude API pricing guide.
- Current-turn thinking: billed as output tokens.
- Thinking from earlier turns: billed as input tokens when it stays in context. Newer models (Opus 4.5 and later, Sonnet 4.6 and later, Haiku 5.5, Fable) keep all prior turns by default.
- A hidden system prompt: when thinking is active, the API adds a small system prompt for it.

Worked example: one request on Opus 5.5
Say you send a 2,000-token prompt. The response reports output_tokens: 6000 and thinking_tokens: 4500. The visible summary might be only a few hundred tokens, but you pay for all 4,500.
| Line | Tokens | Opus 5.5 ($4 / $20) | Sonnet 5.5 ($2 / $10) | Haiku 5.5 ($0.10 / $0.50) |
|---|---|---|---|---|
| Input (prompt) | 2,000 | $0.008 | $0.004 | $0.0002 |
| Thinking (output) | 4,500 | $0.090 | $0.045 | $0.00225 |
| Answer text (output) | 1,500 | $0.030 | $0.015 | $0.00075 |
| Total per request | 8,000 | $0.128 | $0.064 | $0.0032 |
| Per 1,000 requests | $128 | $64 | $3.20 |
Here thinking is about 70% of the bill ($0.09 of $0.128 on Opus 5.5). That is why effort is the biggest cost lever. These token counts are an example, so measure your own with usage.output_tokens_details.thinking_tokens.
On the next turn, those 4,500 thinking tokens stay in context on Opus 5.5 and are billed as input. At full price that adds $0.018. As a cache read at $0.20 per million it adds about $0.0009, so caching matters. See prompt caching to cut API costs.
Limits You Should Know
| Limit | Value |
|---|---|
| Max output tokens (thinking plus answer) | 128K on Fable 5.x, Opus 5.5, Opus 5, Opus 4.6 to 4.8, Sonnet 5.5, Sonnet 5, Sonnet 4.6, Haiku 5.5; 64K on the 4.5 models |
Batch API output ceiling (beta header output-300k-2026-03-24) |
300K on Opus 5.5, Opus 5, Sonnet 5.5, Haiku 5.5 and others |
budget_tokens minimum (legacy) |
1,024, and less than max_tokens (except with interleaved thinking) |
| SDK streaming requirement | max_tokens above 21,333 |
| Large legacy budgets | Above 32K thinking tokens, the docs suggest the Batch API to avoid timeouts |
| Turning thinking off | 400 error on Opus 5.5 and Fable 5.x; Sonnet 5.5 uses between_tools at high effort or below |
| Effort level changes | Changing the top-level effort or thinking mode can invalidate the prompt cache |
Tips for Better Results and Lower Cost
- Lower effort first: to cut cost or delay, drop effort before you write “don’t think” prompts. The docs call effort a calibrated control.
- Tune per route: use
lowormediumfor chat and classification, andhighorxhighfor coding and agents. - Set a big max_tokens: at high effort and above, a small cap leads to
stop_reason: "max_tokens"with a cut-off answer. - Keep settings stable: hold the thinking mode and effort steady across a cached conversation.
- Use the 1-hour cache: thinking-heavy runs often last longer than the default 5-minute cache life.
- Steer with words when needed: append “Please think hard before responding.” to a user message to encourage thinking on that turn.
- Don’t assume a thinking block: adaptive mode can skip thinking on any turn, so never index
content[0]as thinking.
Tip: On Sonnet 5.5, Haiku 5.5 and Fable 5.2, the docs say prompt instructions to “answer directly” do not reliably reduce thinking. Lower the effort level instead.
Troubleshooting: Common Problems and Fixes
These are the real error messages from the official thinking troubleshooting page, with the fix for each.
| Error or symptom | Cause | Fix |
|---|---|---|
"thinking.type.enabled" is not supported for this model. Use "thinking.type.adaptive" and "output_config.effort" to control thinking behavior. |
You sent budget_tokens to a 4.7 or later model |
Switch to {"type": "adaptive"} plus effort |
"thinking.type.disabled" is not supported for this model. |
Opus 5.5 and Fable models cannot turn thinking off | Omit thinking; use display: "omitted" to hide text, and low effort to cut cost |
To turn thinking off on this model, send "thinking": {"type": "between_tools"} instead of {"type": "disabled"}. |
Sonnet 5.5 rejects disabled |
Send between_tools at high effort or below |
adaptive thinking is not supported on this model |
Model is extended-only (Haiku 4.5, Sonnet 4.5, Opus 4.5) | Use budget_tokens, or move to a newer model |
`thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified |
You edited, reordered or dropped thinking blocks | Echo response.content back unchanged |
Invalid `signature` in `thinking` block. The block is bound to a different conversation. |
Earlier history, system prompt or tools changed | Keep history append-only; strip that block and every later thinking block to recover |
| Thinking field is an empty string | display defaults to "omitted" on new models |
Add "display": "summarized" |
stop_reason: "max_tokens", answer cut off |
Thinking used up the output cap | Raise max_tokens or lower effort |
cache_read_input_tokens drops to 0 |
You changed thinking mode or effort | Keep both constant across the conversation |
For rate limits and overload errors that are not about thinking, see Claude API errors 429 and 529 fix.
Frequently Asked Questions
Is extended thinking still available in the Claude API?
Only as a legacy mode. budget_tokens still works on Opus 4.6 and Sonnet 4.6 (deprecated) and on the 4.5 models, but Claude 4.7 and later models reject it with a 400 error. Use adaptive thinking with effort instead.
How do I turn on thinking on Claude Opus 5.5?
You don’t need to. Thinking is always on for Opus 5.5. Add thinking={"type": "adaptive", "display": "summarized"} to see the summary, and set output_config={"effort": "high"} to control depth.
Am I charged for thinking I can’t see?
Yes. Thinking tokens are billed as output tokens even with display: "omitted", and summarized output is billed at the full thinking length. Check usage.output_tokens_details.thinking_tokens to see the real number.
What is the difference between effort and thinking?
The thinking parameter picks the mode (adaptive, legacy enabled, or off where allowed). Effort sets how much work Claude puts into the whole response, including how often and how deeply it thinks.
Can I see Claude’s raw chain of thought?
No. The API returns only a summary written by a separate model, or nothing. The docs say to contact Anthropic sales in rare cases where you need full thinking output.
Does interleaved thinking need a beta header?
Not with adaptive thinking, where it is automatic. The interleaved-thinking-2025-05-14 header is only for manual extended thinking on older models such as the 4.5 family.
Which model is cheapest for thinking?
Claude Haiku 5.5 at $0.10 input and $0.50 output per million tokens (prompts up to 100K). It defaults to medium effort and suits high-volume tasks like classification and routing.



