Use Adaptive Thinking and Effort in the Claude API
- “Extended thinking” is the older name for letting Claude reason before it answers. The docs now call the current approach adaptive thinking:
thinking: {"type": "adaptive"}, and Claude decides per request whether and how much to think. - The old manual form,
thinking: {"type": "enabled", "budget_tokens": N}, is labeled legacy and deprecated. The docs say Claude 4.7 and later models reject it with a 400 error, including Opus 5.5, Sonnet 5.5, and Haiku 5.5. - On Claude 5 models (including Opus 5.5, Sonnet 5.5, Haiku 5.5) thinking is on by default. Their thinking text is hidden unless you set
display: "summarized". Hiding it speeds up streaming but does not lower the bill. - Depth is controlled with
output_config.effort(low,medium,high,xhigh,max), not with a token budget. Opus 5.5 and Haiku 5.5 default tomedium; most other models default tohigh. Effort is soft guidance;max_tokensis the hard cap. - Thinking tokens are billed as output tokens and count toward
max_tokens. The response’susage.output_tokens_details.thinking_tokenstells you how many were spent thinking. - Changing the thinking mode,
budget_tokens, or the top-level effort invalidates prompt-cache breakpoints. Opus 5.5 cannot turn thinking off; Sonnet 5.5 and Haiku 5.5 have their own rules (see the table). - We read four official pages on 2026-11-02 and ran our script’s printing logic against a local stub. We made no real API call (no API key, no
anthropicpackage here), so the SDK code follows the docs but is not tested end to end.
What you’ll be able to do after this tutorial
Section titled “What you’ll be able to do after this tutorial”- Explain the difference between adaptive thinking and the legacy
budget_tokensmode, and pick the right one for your model. - Make a request with thinking on, read the thinking and text blocks, and see how many tokens went to thinking.
- Tune depth and cost with
effortandmax_tokensinstead of a token budget. - Avoid the common traps: a 400 error from the old syntax, an empty thinking field, truncated answers, and lost cache hits.
Concepts to know first
Section titled “Concepts to know first”A model that answers in one pass has to get everything right on the first try. With thinking on, Claude works through the problem first (restating the question, trying approaches, checking intermediate results) and then answers. The docs say this helps on complex work such as math, coding, analysis, and long agentic tasks. It costs tokens and time, so you do not want it on every request.
| Term | Meaning |
|---|---|
| Thinking block | A thinking content block that arrives before the text block. It has a thinking field and an encrypted signature. |
| Adaptive thinking | thinking: {"type": "adaptive"}. Claude decides for each request whether to think and how deeply. |
| Extended thinking (manual mode) | thinking: {"type": "enabled", "budget_tokens": N}. A fixed budget. Legacy and deprecated, per the docs. |
display |
"summarized" returns a readable summary of the reasoning; "omitted" returns an empty thinking field. |
effort |
output_config.effort. How much work Claude puts into the whole response, including how often and how deeply it thinks. |
What you read in a thinking block is never the raw chain of thought: the docs say it is a summary, produced by a different model. You are billed for the full thinking, not for the summary you see.
This tutorial builds on Dev 2, where effort is introduced as a cost lever, and on Dev 15, which shows the thinking_delta stream events. If you use batches, thinking works there too (Dev 16).
Step-by-step guide
Section titled “Step-by-step guide”-
Check what your model does with each setting
The docs have a per-model table. These are the rows for the models this site uses most (a 400 error means the API rejects the request):
Model No thinkingfield"adaptive""enabled"+budget_tokens"disabled"Opus 5.5 Adaptive thinking Adaptive thinking 400 error 400 error Sonnet 5.5 Adaptive thinking Adaptive thinking 400 error 400 error (use "between_tools")Haiku 5.5 Adaptive thinking Adaptive thinking 400 error Thinking off at higheffort or belowOpus 4.8 / 4.7 Thinking off Adaptive thinking 400 error Thinking off Opus 4.6 / Sonnet 4.6 Thinking off Adaptive thinking Extended thinking (deprecated) Thinking off Opus 4.5 / Sonnet 4.5 / Haiku 4.5 Thinking off 400 error Extended thinking Thinking off Read it as: on the Claude 5.5 models you do not need to configure anything to get thinking, and the old budget syntax is rejected. Only the 4.5 generation still takes
budget_tokenswithout a deprecation note, and on those models"adaptive"is the one that errors. Sonnet 5.5’s lowest setting isthinking: {"type": "between_tools"}, which turns off up-front thinking (accepted athigheffort or below). The docs also say you can readcapabilities.thinking.typesfrom the Models API to check support before sending; we did not open that page (unconfirmed details). -
Make a request and read the blocks
Save this as
think_demo.py. It asks for a summarized thinking text, sets a medium effort, and prints the blocks and the token split.import anthropicclient = anthropic.Anthropic()response = client.messages.create(model="claude-opus-5-5",max_tokens=16000, # thinking tokens count toward this limitthinking={"type": "adaptive", "display": "summarized"},output_config={"effort": "medium"},messages=[{"role": "user","content": "What is the greatest common divisor of 1071 and 462?",}],)def show(response):saw_thinking = Falsefor block in response.content:if block.type == "thinking":saw_thinking = Trueprint("Thinking summary:", block.thinking or "(empty)")elif block.type == "text":print("Answer:", block.text)if not saw_thinking:print("(Claude chose not to think on this request)")usage = response.usagedetails = getattr(usage, "output_tokens_details", None)thinking_tokens = getattr(details, "thinking_tokens", None)print("stop_reason:", response.stop_reason)print("billed output_tokens:", usage.output_tokens)print("of which thinking_tokens:", thinking_tokens)show(response)The request shape (
thinkingwithtypeanddisplay, andmax_tokens: 16000, modelclaude-opus-5-5) is the docs’ own example. The docs show the summary as short text such as the Euclidean algorithm steps, followed by the answer, but the exact wording differs on every run. Puttingeffortinoutput_configalongsidethinkingis documented on the effort page; we did not find a page example that combines both in one request, so treat the combination as our composition of two documented parameters. -
Choose
displayon purposedisplayhas two stable values:"summarized": thethinkingfield holds a readable summary. This is the default on Opus 4.6, Sonnet 4.6, and earlier models."omitted": thethinkingfield is empty, but the encryptedsignatureis still there. This is the default on the Claude 5.5 models, Opus 4.8, and Opus 4.7. The docs say its benefit is a faster time to the first text token when streaming, because no thinking text is streamed.
Billing is identical either way: you pay for the full thinking tokens, and “omitting reduces latency, not cost.” A third value,
"updates", is marked beta and needs a beta header; we do not cover it. If Claude skips thinking on an easy request, there is simply no thinking block, whateverdisplaysays. Never write code that assumes every answer starts with one. -
Tune depth with
effort, not a budgetIn adaptive mode you do not set a thinking token budget. The docs name two controls:
Control What it does output_config.effortSoft guidance on how often and how deeply Claude thinks (and how verbose the whole response is). max_tokensA hard cap on total output, thinking plus answer. The levels, from the docs:
lowminimizes thinking and may skip it on simple tasks;mediumis moderate and may skip thinking on simple queries;highthinks on most requests that benefit;xhighandmaxgo deeper (availability varies by model). Opus 5.5 and Haiku 5.5 default tomedium, other models tohigh, and setting the default explicitly behaves the same as leaving it out. The docs advise setting effort explicitly and testing on your own task, and say lowering effort is the first lever to try when thinking costs too much.adaptiveis a thinking mode, not an effort value; never pass it aseffort.Prompt wording can steer too (for example “respond directly when in doubt” in the system prompt), but the docs call it wording-sensitive and say lowering effort is usually the better first lever. They also note that on Sonnet 5.5 and Haiku 5.5, telling the model in the prompt to think less is not reliable.
-
Watch the token and cost side
Thinking tokens are billed as output tokens even when the text is omitted, and they count toward
max_tokens. Ifstop_reasonismax_tokens, the answer was cut off. The docs give two fixes: raisemax_tokens, or lower the effort. Raise the cap if those requests need the reasoning; lower effort if they were over-thought.The response’s
usage.output_tokens_details.thinking_tokensis the part ofoutput_tokensspent on reasoning (the docs’ sample: 348 output tokens, 312 of them thinking).output_tokensremains the billed total. When streaming, this breakdown appears only on the finalmessage_deltaevent. For prices, use the official pricing page; we did not open it, so this tutorial gives no price table (unconfirmed). -
Use it with streaming, tools, and caching
- Streaming (Dev 15): thinking blocks arrive as
thinking_deltaevents, then onesignature_deltajust before the block ends. Withdisplay: "omitted"each thinking block sends athinking_deltawith an empty string, then its signature. The docs also say the SDK requires streaming whenmax_tokensis greater than 21,333, a client-side check to avoid HTTP timeouts. You can call the SDK’s.stream()and take the final message if you do not need events. - Tools: within a tool-use turn you must pass the assistant’s thinking blocks back complete and unmodified, next to the
tool_useblock; modified blocks are rejected with a 400 error. If you filter blocks by type, also keepredacted_thinkingblocks. Whether older turns’ thinking stays in context depends on the model; the API filters it for you, so passing everything back is the docs’ recommendation. Do not switch thinking on or off in the middle of a tool-use turn; the docs say the API silently disables thinking for that request. - Forced tool use: adaptive thinking allows
tool_choiceofanyor a named tool, except on Opus 5.5, Sonnet 5.5, Fable 5.2, Mythos 5.2, Fable 5.1, and Mythos 5.1, which reject it with a 400 error. Useautowith strict tool use or structured outputs there. - Caching (Dev 2): switching thinking modes, changing
budget_tokens, or changing top-level effort starts a new cache prefix, and message-level breakpoints always miss. Pick one setting per cached conversation. The docs also suggest the 1-hour cache duration for thinking-heavy work. - Batches (Dev 16): Dev 16 reports that the official batch page lists extended thinking among the batchable features. We did not reopen that page for this tutorial, and the Thinking page itself only recommends batches for legacy budgets above 32k.
Copy and paste this promptI’m calling the Claude API from Python with the anthropic SDK on the model claude-opus-5-5. Write a small script that sends one hard reasoning question with thinking type adaptive and display summarized, and output_config effort set to low, then the same question at high. Print each answer, whether a thinking block appeared, output_tokens, and usage.output_tokens_details.thinking_tokens, and give me a short table comparing the two runs. Use only parameters documented on the official thinking and effort pages.
- Streaming (Dev 15): thinking blocks arrive as
Other limits to know (from the Thinking page)
Section titled “Other limits to know (from the Thinking page)”- Sampling parameters: on the listed newer models, including Opus 5.5, Sonnet 5.5, and Haiku 5.5, non-default
temperature,top_p, ortop_kreturn a 400 error whether or not thinking is used. The docs also say that starting with API version2026-10-21these parameters return a 400 error on every model. We did not open that migration page. - Prefill: Claude 4.6 and later reject a prefilled final assistant turn with a 400 error, thinking or not.
- Maximum output: the table lists 128K output tokens for Opus 5.5, Sonnet 5.5, and Haiku 5.5, and 64K for the 4.5 models.
- Legacy mode rules (only if you stay on a 4.5-generation model):
budget_tokensmust be at least 1,024 and less thanmax_tokens; it is a target, not a strict cap. The docs suggest starting near 1,024 for simple tasks and 16,000 or more for complex ones, and using batch processing for budgets above 32k. - Migrating: remove
budget_tokens, setthinking: {"type": "adaptive"}, and control depth withoutput_config: {"effort": ...}. The docs warn it is a behavior change, not only syntax: a fixed budget thinks on every request, while adaptive may skip thinking on easy ones.
Quick reference
Section titled “Quick reference”| Item | Value (official docs, 2026-11-02) |
|---|---|
| Turn on (current) | thinking: {"type": "adaptive"} (on by default for Claude 5 models) |
| Legacy | thinking: {"type": "enabled", "budget_tokens": N}, deprecated; 400 error on Claude 4.7 and later |
| Show text | thinking: {"type": "adaptive", "display": "summarized"} |
| Effort | output_config: {"effort": "low" | "medium" | "high" | "xhigh" | "max"} |
| Defaults | medium on Opus 5.5 and Haiku 5.5; high on other models |
| Hard cap | max_tokens (thinking plus answer) |
| Billing | Thinking is billed as output tokens, full amount, whatever display is |
| Token split | usage.output_tokens_details.thinking_tokens |
| Cache | Changing thinking mode, budget_tokens, or effort invalidates cache breakpoints |
| Managed Agents | Thinking is always on and set by Managed Agents; the agent has no thinking field |
Common sticking points
Section titled “Common sticking points”A 400 error mentioning budget_tokens or type: "enabled"
Section titled “A 400 error mentioning budget_tokens or type: "enabled"”- Cause: The model is Claude 4.7 or later, which rejects the legacy form.
- Fix: Use
thinking: {"type": "adaptive"}and setoutput_config.effort. The docs’ troubleshooting page maps each error message to its fix; we did not open it.
The thinking field is empty
Section titled “The thinking field is empty”- Cause:
displayis"omitted", which is the default on the Claude 5.5 models. - Fix: Set
display: "summarized"if you want to read it. The thinking is still billed either way.
There is no thinking block at all
Section titled “There is no thinking block at all”- Cause: Adaptive thinking is optional for the model. On easy requests, or at low effort, Claude can skip it.
- Fix: This is normal. Raise
effortif you need more thinking, and do not assume a block exists.
The answer is cut off (stop_reason: "max_tokens")
Section titled “The answer is cut off (stop_reason: "max_tokens")”- Cause: Thinking used up
max_tokensbefore the answer finished. - Fix: Raise
max_tokens, or lowereffort.
Cache hits disappeared
Section titled “Cache hits disappeared”- Cause: The thinking mode,
budget_tokens, or top-level effort changed between requests. - Fix: Hold those steady inside one cached conversation. Some models support a per-message effort change (beta) that keeps the cache; see the effort page.
My thinking text does not match the billed tokens
Section titled “My thinking text does not match the billed tokens”- Cause: The visible text is a summary. You are billed for the full thinking.
- Fix: Use
usage.output_tokens_details.thinking_tokensfor the real number.
Practical tips
Section titled “Practical tips”- Start with the model’s default, then compare
lowandhighon a small sample of your own tasks. Measure quality, latency, andoutput_tokens. - Keep
max_tokensgenerous when thinking is on. A value sized for a short answer is often too small. - Use
display: "omitted"when your app never shows the reasoning, mainly to speed up streaming. - Do not ask the model to write out its reasoning in the answer text to read it. The docs say some models may refuse such requests (
reasoning_extraction); read the thinking blocks instead. - We did not run this against the real API. Treat your first run as a test and check the results by hand.
Next tutorials
Section titled “Next tutorials”- 2. Cut API costs with prompt caching, batches, and effort — effort and caching as cost levers
- 15. Streaming responses — read
thinking_deltaevents live - 16. Large jobs with the Batches API — thinking inside batches
- 14. Token counting API — estimate input cost before you send
- C16. Getting started with the Claude API
- Developer guide
Sources
Last verified: Nov 16, 2026
- Thinking platform.claude.com
- Steering thinking platform.claude.com
- Effort platform.claude.com
- Extended thinking (legacy manual mode) platform.claude.com
Prices, limits, and menu names change often. Before making an important decision, check the official pages above for the latest details.
Finished this tutorial?
Progress is saved only in this browser and never sent anywhere.