Extended Thinking
APIDefinition
A Claude capability that allows the model to reason through complex problems step-by-step in a dedicated thinking block before producing its final response. Controlled via the 'thinking' parameter with a 'budget_tokens' limit. Thinking tokens are billed but improve accuracy on hard reasoning tasks.
Example Usage
Enable extended thinking for multi-step math proofs or complex code architecture decisions where intermediate reasoning improves final output.
Why It Matters for the CCA-F Exam
Exam questions test whether candidates know the current `adaptive` API shape (not the legacy `budget_tokens` shape), understand that `budget_tokens` causes HTTP 400 on current models, and can select appropriate effort levels for given scenarios. Questions also distinguish thinking blocks from chain-of-thought and test when extended thinking adds value versus adds unnecessary cost.
In Depth
Extended thinking is a Claude capability that gives the model a private scratchpad — a dedicated reasoning phase before it writes its visible response. During this phase Claude can plan approaches, consider edge cases, and self-correct before committing to an answer. The scratchpad content surfaces as a thinking content block in the response, distinct from the text block that users see.
Current implementation: adaptive thinking. On claude-opus-4-7, claude-opus-4-8, claude-fable-5, and claude-sonnet-4-6, thinking is controlled via thinking: {type: "adaptive"}. The model decides how much reasoning depth the problem warrants. You influence cost and depth through output_config: {effort: "low" | "medium" | "high" | "xhigh" | "max"}. This replaced the earlier budget_tokens mechanism, which is deprecated on Opus 4.6 / Sonnet 4.6 and returns HTTP 400 on all newer models.
When thinking display is enabled, the thinking.display field controls what you receive: "summarized" returns a human-readable summary of the reasoning chain; the default "omitted" returns an empty thinking block on Fable 5, Opus 4.7, and Opus 4.8 (preserving privacy while still paying the reasoning cost).
Thinking tokens are billed at the same rate as output tokens, so increasing effort increases both quality and cost. For the CCA-F exam, the practical tradeoff is:
| Effort | When to use |
|---|---|
low | Summarisation, classification, simple Q&A |
medium | Code generation, moderate reasoning |
high | Multi-step planning, complex analysis |
xhigh / max | Research synthesis, hard proofs, architecture decisions |
Extended thinking genuinely improves accuracy on tasks with many interdependent constraints — mathematical proofs, algorithmic planning, code that must satisfy several design invariants simultaneously. For single-step generation tasks it adds latency without measurable benefit, so gate it on task complexity.
The chain-of-thought prompting technique asks Claude to reason step-by-step in its text output; extended thinking moves that reasoning out of the visible response into a private block. The practical difference: chain-of-thought is readable by downstream processors in the message thread; thinking blocks are opaque unless you set display: "summarized" and the model is on a tier that supports it.
Example
Adaptive thinking with `effort: 'high'` on Opus 4.8. Note `thinking.display: 'summarized'` — omit it and the thinking block text is empty on current models.
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-opus-4-8",
max_tokens=16000,
thinking={"type": "adaptive", "display": "summarized"},
output_config={"effort": "high"},
messages=[
{
"role": "user",
"content": "Design a consistent hashing ring for a distributed cache with 1000 nodes. Show how to handle node addition without rehashing the entire key space."
}
]
)
for block in response.content:
if block.type == "thinking":
print("[Reasoning summary]")
print(block.thinking) # Non-empty because display='summarized'
elif block.type == "text":
print("[Answer]")
print(block.text)Frequently Asked Questions
Can I still use budget_tokens on current models?
No. `budget_tokens` is deprecated on Opus 4.6 and Sonnet 4.6, meaning it may be ignored or behave unexpectedly. On Opus 4.7, Opus 4.8, and Fable 5 it is fully removed — passing it returns an HTTP 400 error. Use `thinking: {type: 'adaptive'}` with `output_config: {effort: '...'}` instead.
Do thinking tokens appear in context for subsequent turns?
Thinking blocks are included in the conversation history and consume context window space in subsequent turns. For long agentic loops, be mindful that accumulated thinking blocks from earlier turns contribute to context length. The `summarized` display option helps by keeping thinking summaries shorter than raw chains.
When does extended thinking not help?
For tasks with a single obvious correct answer — simple retrieval, short summarisation, direct factual questions — extended thinking adds latency and cost without accuracy gains. Reserve higher effort levels for multi-constraint problems, creative planning tasks, or anything where the quality delta is worth the token cost.