~/academy $ claude learn thinking-in-the-api
Thinking and effort in the Claude API
How adaptive thinking and the effort parameter work on current Claude models, what replaced budget_tokens, how thinking is billed and when to raise or lower it. 8 min
$ Read
Thinking on current models
Thinking lets Claude work through a problem before it answers. It arrives as thinking blocks before the text blocks. The tokens it spends are billed as output tokens, even when you do not see the text, and they count towards max_tokens.
Current models use adaptive thinking: Claude decides when and how much to think. The older setting, thinking: {"type": "enabled", "budget_tokens": N}, returns a 400 error on Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.2 (checked 18 November 2026).
Can you turn it off? On Opus 5.5 and Fable 5.2, no: thinking is always on and disabled returns a 400 error. On Sonnet 5.5, send {"type": "between_tools"} to skip up-front thinking, at high effort or below. On Haiku 5.5, disabled is accepted at high effort or below.
Lesson notes: Thinking and effort in the Claude API
Everything in this lesson as text, for revision or to read without the interactive steps. By the end you will be able to: You set thinking and effort correctly for each kind of request and keep thinking blocks intact in tool loops.
Step 1 of 6 · Read
Thinking on current models
Thinking lets Claude work through a problem before it answers. It arrives as
thinkingblocks before thetextblocks. The tokens it spends are billed as output tokens, even when you do not see the text, and they count towardsmax_tokens.Current models use adaptive thinking: Claude decides when and how much to think. The older setting,
thinking: {"type": "enabled", "budget_tokens": N}, returns a 400 error on Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.2 (checked 18 November 2026).Can you turn it off? On Opus 5.5 and Fable 5.2, no: thinking is always on and
disabledreturns a 400 error. On Sonnet 5.5, send{"type": "between_tools"}to skip up-front thinking, athigheffort or below. On Haiku 5.5,disabledis accepted athigheffort or below.Step 2 of 6 · Read
Effort is your main control
Set
output_config={"effort": ...}to trade quality against cost and speed. The levels arelow,medium,high,xhighandmax. Defaults:mediumon Opus 5.5 and Haiku 5.5,highon Sonnet 5.5 and Fable 5.2.Effort affects every token: thinking, the answer and tool calls. Lower effort means fewer, terser tool calls and less preamble.
lowsuits simple, high-volume or latency-sensitive work such as subagents.highsuits complex reasoning and hard coding.xhighis for long-running agentic and coding work. Keepmaxfor problems where cost truly does not matter.Effort is a signal, not a hard budget, and the docs say to run your own tests at a few levels rather than copying settings from an older model. At high levels set a large
max_tokensand stream.Adaptive thinking with a visible summary 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": "Find the flaw in this pricing logic: ..."}], ) for block in response.content: if block.type == "thinking": print("Reasoning summary:", block.thinking) elif block.type == "text": print("Answer:", block.text)Step 3 of 6 · Read
Seeing thinking, and keeping it intact
displaycontrols what you see.omittedis the default on current models: thinking blocks come back with an emptythinkingfield, which also gets your text streaming sooner.summarizedreturns a readable summary. No setting returns the raw chain of thought, and you are billed for the full thinking either way, not the summary.Each thinking block carries a
signature. In multi-turn and tool use conversations, send thinking blocks back exactly as you received them, including empty ones. The simplest way is to append the wholeresponse.contentto your history, as the tool loop in lesson 5 does. Edited or dropped thinking blocks can cause a 400 error.Step 4 of 6 · Quiz
Check your understanding
An old script sends `thinking={"type": "enabled", "budget_tokens": 8000}` to `claude-opus-5-5` and fails. What is the fix?
- Raise budget_tokens to 16,000.
- Remove the thinking setting (or send `{"type": "adaptive"}`) and control depth with `output_config={"effort": ...}`.
- Send `{"type": "disabled"}` instead.
- Switch to an older model that accepts budget_tokens.
Show the answer
Remove the thinking setting (or send `{"type": "adaptive"}`) and control depth with `output_config={"effort": ...}`. Adaptive thinking replaced budget tokens on current models, and effort is the dial for how much it thinks.
Step 5 of 6 · Sort
Lower effort or higher effort?
Pick a starting direction for each request type, then confirm with your own tests.
- Routing support tickets into five queues
- A multi-hour agent refactoring a codebase
- Chat replies with a two-second target
- Checking a complex contract where mistakes are costly
- A subagent that fetches simple facts
- Finding the bug behind an intermittent payment failure
Show the answers
- Routing support tickets into five queues: Lower effort (low or medium). Simple and high volume. Low effort saves tokens and time.
- A multi-hour agent refactoring a codebase: Higher effort (high, xhigh or max). Long-horizon coding is where xhigh is recommended.
- Chat replies with a two-second target: Lower effort (low or medium). Latency-sensitive chat usually starts at low or medium.
- Checking a complex contract where mistakes are costly: Higher effort (high, xhigh or max). Accuracy outweighs cost, so give it room to think.
- A subagent that fetches simple facts: Lower effort (low or medium). The docs name subagents as a typical low-effort job.
- Finding the bug behind an intermittent payment failure: Higher effort (high, xhigh or max). Hard debugging benefits from deeper reasoning.
Step 6 of 6 · Quiz
Check your understanding
Your invoice shows far more output tokens than the text your users ever saw. Why?
- Thinking tokens are billed as output, even when the thinking text is omitted or summarised.
- Output tokens are billed at double weight.
- The SDK retries every request twice.
Show the answer
Thinking tokens are billed as output, even when the thinking text is omitted or summarised. You pay for the full thinking the model did. Lower effort if the extra depth is not earning its cost.