Mastering Claude's Extended Thinking: A Complete Guide to Enhanced Reasoning
Learn how to use Claude's extended thinking feature for complex tasks. Covers adaptive thinking, manual mode, effort parameters, and practical API examples for Claude Opus and Sonnet models.
This guide teaches you how to enable and configure Claude's extended thinking for complex reasoning tasks, including adaptive thinking with the effort parameter, manual budget tokens, and handling thinking blocks in API responses.
Mastering Claude's Extended Thinking: A Complete Guide to Enhanced Reasoning
Claude's extended thinking capability is one of its most powerful features for tackling complex, multi-step problems. Whether you're analyzing mathematical proofs, debugging intricate code, or reasoning through philosophical questions, extended thinking gives Claude the space to work through problems step-by-step—and optionally shows you its reasoning process.
This guide covers everything you need to know: from the latest adaptive thinking mode to practical API implementation patterns.
What Is Extended Thinking?
Extended thinking enables Claude to perform deeper reasoning before generating its final response. When activated, Claude produces internal "thinking" content blocks where it works through the problem, then uses those insights to craft a more accurate and nuanced final answer.
The API response includes these thinking blocks alongside the final text output, giving you varying levels of transparency into Claude's reasoning process.
Adaptive Thinking vs. Manual Extended Thinking
Anthropic has evolved how extended thinking works across model versions. Understanding the differences is crucial for building robust applications.
Adaptive Thinking (Recommended)
For Claude Opus 4.7 and later models, adaptive thinking is the only supported mode. Instead of setting a fixed token budget, you specify an effort level that tells Claude how much reasoning to apply.
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-opus-4-7",
max_tokens=32000,
thinking={
"type": "adaptive",
"effort": "high" # Options: "low", "medium", "high"
},
messages=[
{
"role": "user",
"content": "Prove that the square root of 2 is irrational."
}
]
)
for block in response.content:
if block.type == "thinking":
print(f"Thinking: {block.thinking[:200]}...")
elif block.type == "text":
print(f"Answer: {block.text}")
The effort parameter accepts three values:
low: Minimal reasoning, suitable for simple tasksmedium: Balanced reasoning for most use caseshigh: Maximum reasoning depth for complex problems
Manual Extended Thinking (Deprecated on Newer Models)
Manual extended thinking (thinking: {type: "enabled", budget_tokens: N}) is no longer supported on Claude Opus 4.7 or later models—it returns a 400 error. However, it remains functional (though deprecated) on:
- Claude Opus 4.6
- Claude Sonnet 4.6
- Claude Sonnet 3.7
# Works on Claude Opus 4.6 and Sonnet 4.6 (deprecated)
response = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=16000,
thinking={
"type": "enabled",
"budget_tokens": 10000
},
messages=[
{
"role": "user",
"content": "Are there an infinite number of prime numbers such that n mod 4 == 3?"
}
]
)
Important: Thebudget_tokensvalue must be less thanmax_tokens. A good rule of thumb is to allocate 60-80% of your total token budget to thinking.
Model-Specific Behavior
Different Claude models handle extended thinking differently. Here's a quick reference:
| Model | Adaptive Thinking | Manual Thinking | Notes |
|---|---|---|---|
| Claude Opus 4.7+ | ✅ Required | ❌ Returns 400 error | Use effort parameter |
| Claude Mythos Preview | ✅ Default | ✅ Accepted | Adaptive is default; display: "summarized" for summaries |
| Claude Opus 4.6 | ✅ Recommended | ✅ Deprecated | Migrate to adaptive |
| Claude Sonnet 4.6 | ✅ Recommended | ✅ Deprecated | Interleaved mode deprecated |
| Claude Sonnet 3.7 | ❌ Not supported | ✅ Supported | Legacy behavior |
Special Case: Claude Mythos Preview
Claude Mythos Preview has unique behavior:
- Adaptive thinking is the default mode
- Manual
thinking: {type: "enabled", budget_tokens: N}is also accepted thinking: {type: "disabled"}is not supported- The
displayparameter defaults to"omitted"(no thinking content returned) - Pass
display: "summarized"to receive summaries of the thinking process
const response = await client.messages.create({
model: "claude-mythos-preview",
max_tokens: 32000,
thinking: {
type: "adaptive",
effort: "high",
display: "summarized" // Get summaries instead of full thinking
},
messages: [
{
role: "user",
content: "Explain the implications of quantum entanglement for information theory."
}
]
});
Handling Thinking Blocks in Responses
When extended thinking is enabled, the API response contains a mix of thinking and text content blocks. Here's how to handle them:
response = client.messages.create(
model="claude-opus-4-6",
max_tokens=16000,
thinking={"type": "enabled", "budget_tokens": 10000},
messages=[{"role": "user", "content": "Solve this complex math problem..."}]
)
Process each content block
for block in response.content:
if block.type == "thinking":
# Store or display the thinking process
thinking_text = block.thinking
signature = block.signature # Important for verification
# Option 1: Log for debugging
print(f"[Thinking] {thinking_text}")
# Option 2: Store signature for later verification
store_signature(signature)
elif block.type == "text":
# This is the final answer
final_answer = block.text
print(f"[Answer] {final_answer}")
Streaming with Extended Thinking
Extended thinking works with streaming responses. The thinking blocks stream before the text blocks:
import anthropic
client = anthropic.Anthropic()
with client.messages.stream(
model="claude-sonnet-4-6",
max_tokens=16000,
thinking={"type": "enabled", "budget_tokens": 8000},
messages=[{"role": "user", "content": "Design a sorting algorithm that works in O(n log n) time."}]
) as stream:
for event in stream:
if event.type == "content_block_delta":
if event.delta.type == "thinking_delta":
print(f"Thinking: {event.delta.thinking}", end="")
elif event.delta.type == "text_delta":
print(f"Text: {event.delta.text}", end="")
Best Practices for Extended Thinking
1. Choose the Right Effort Level
Don't use "high" effort for simple tasks—it wastes tokens and adds latency. Match the effort to the complexity:
| Task Type | Recommended Effort |
|---|---|
| Simple Q&A, summarization | "low" |
| Code generation, analysis | "medium" |
| Mathematical proofs, complex reasoning | "high" |
2. Set Appropriate Token Budgets
For manual mode, allocate your budget wisely:
- Thinking budget: 60-80% of
max_tokens - Response budget: 20-40% of
max_tokens
3. Handle Signatures for Verification
Thinking blocks include a cryptographic signature field. Store these signatures if you need to verify the integrity of Claude's thinking process later.
4. Migrate to Adaptive Thinking
If you're still using manual extended thinking on Claude Opus 4.6 or Sonnet 4.6, plan your migration to adaptive thinking now. Manual mode will be removed in a future model release.
Common Pitfalls
- Budget tokens > max_tokens: This causes an API error. Always ensure
budget_tokens < max_tokens. - Using manual mode on Opus 4.7+: Returns a 400 error. Switch to adaptive thinking.
- Ignoring streaming order: Thinking blocks always stream before text blocks. Don't assume text arrives first.
- Forgetting display parameter on Mythos: Without
display: "summarized", you won't receive any thinking content.
Key Takeaways
- Adaptive thinking (
type: "adaptive"witheffortparameter) is the modern, recommended approach for Claude Opus 4.7+ and should be used on all newer models. - Manual extended thinking (
type: "enabled"withbudget_tokens) is deprecated on Claude Opus 4.6 and Sonnet 4.6, and returns errors on Opus 4.7+. - Match effort to task complexity: Use
"low"for simple tasks,"medium"for most work, and"high"only for complex reasoning. - Handle thinking blocks separately from text blocks in your application logic, especially when streaming.
- Plan your migration to adaptive thinking if you're still using manual mode on older models—it will be removed in future releases.