Mastering Claude's Extended Thinking: A Practical Guide to Adaptive Reasoning
Learn how to enable and optimize Claude's extended thinking for complex tasks. Covers adaptive thinking, effort parameters, and best practices for API integration.
This guide teaches you how to enable Claude's extended thinking feature using the API, including adaptive thinking with effort parameters, manual budget tokens, and best practices for complex reasoning tasks.
Introduction
Claude's Extended Thinking feature unlocks a new level of reasoning capability, allowing the model to "think through" complex problems step-by-step before delivering a final answer. This isn't just a gimmick—it's a powerful tool for tasks that require deep analysis, multi-step logic, or careful planning.
In this guide, you'll learn exactly how to enable extended thinking in the Claude API, understand the differences between adaptive and manual modes, and discover practical strategies to get the most out of it.
How Extended Thinking Works
When extended thinking is enabled, Claude generates internal reasoning in the form of thinking content blocks before producing the final text response. These blocks are returned in the API response alongside the final answer, giving you transparency into the model's thought process.
Here's what a typical response looks like:
{
"content": [
{
"type": "thinking",
"thinking": "Let me analyze this step by step...",
"signature": "WaUjzkypQ2mUEVM36O2TxuC06KN8xyfbJwyem2dw3URve/op91XWHOEBLLqIOMfFG/UvLEczmEsUjavL...."
},
{
"type": "text",
"text": "Based on my analysis..."
}
]
}
The thinking block contains Claude's internal reasoning, while the text block contains the final answer. The signature field is used for verification purposes.
Adaptive Thinking vs. Manual Extended Thinking
Claude now offers two approaches to extended thinking:
Adaptive Thinking (Recommended)
Adaptive thinking (thinking: {type: "adaptive"}) is the modern approach that dynamically allocates reasoning tokens based on the complexity of the task. You don't need to guess a token budget—Claude decides how much thinking is needed.
effort
The effort parameter controls how much reasoning Claude applies:
| Effort Level | Description |
|---|---|
low | Minimal reasoning, faster responses |
medium | Balanced reasoning (default) |
high | Deep reasoning for complex tasks |
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-opus-4-7",
max_tokens=4096,
thinking={
"type": "adaptive",
"effort": "high"
},
messages=[
{
"role": "user",
"content": "Analyze the potential impacts of quantum computing on modern cryptography."
}
]
)
print(response.content)
Manual Extended Thinking (Deprecated on Opus 4.7)
Manual extended thinking (thinking: {type: "enabled", budget_tokens: N}) lets you specify a fixed token budget for reasoning. While still functional on Claude Opus 4.6 and Claude Sonnet 4.6, it is deprecated and will be removed in future releases.
response = client.messages.create(
model="claude-opus-4-6",
max_tokens=8192,
thinking={
"type": "enabled",
"budget_tokens": 4096 # Max tokens for thinking
},
messages=[
{
"role": "user",
"content": "Explain the Riemann Hypothesis and its implications."
}
]
)
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 thinking: {type: "adaptive"} with effort |
| Claude Opus 4.6 | ✅ Recommended | ✅ Deprecated but functional | Migrate to adaptive thinking |
| Claude Sonnet 4.6 | ✅ Recommended | ✅ Deprecated (interleaved mode) | Migrate to adaptive thinking |
| Claude Mythos Preview | ✅ Default | ✅ Accepted | thinking: {type: "disabled"} not supported; use display: "summarized" for summaries |
Practical Tips for Using Extended Thinking
1. Choose the Right Effort Level
low: Use for simple tasks like basic Q&A or straightforward calculations.medium: Good for most tasks—balanced speed and depth.high: Reserve for complex reasoning, multi-step analysis, or tasks requiring careful planning.
2. Combine with Structured Outputs
Extended thinking works well with structured outputs. You can ask Claude to think through a problem and then output a JSON object:
response = client.messages.create(
model="claude-opus-4-7",
max_tokens=4096,
thinking={
"type": "adaptive",
"effort": "high"
},
messages=[
{
"role": "user",
"content": "Analyze this dataset and return a JSON summary with key insights."
}
]
)
3. Handle Thinking Blocks in Your Application
When processing responses, you may want to extract only the final text or display the thinking process to users:
for block in response.content:
if block.type == "thinking":
# Optionally log or display thinking
print(f"Thinking: {block.thinking[:100]}...")
elif block.type == "text":
# This is the final answer
final_answer = block.text
4. Manage Token Usage
Extended thinking consumes additional tokens. The budget_tokens (in manual mode) or the adaptive thinking algorithm determines how many tokens are used for reasoning. These tokens count toward your usage and cost.
- Adaptive thinking: Tokens are allocated dynamically based on task complexity.
- Manual thinking: You set a hard limit with
budget_tokens.
5. Use with Streaming
Extended thinking supports streaming responses. When streaming, thinking blocks appear before text blocks:
with client.messages.stream(
model="claude-opus-4-7",
max_tokens=4096,
thinking={"type": "adaptive", "effort": "high"},
messages=[{"role": "user", "content": "Solve this complex math problem."}]
) as stream:
for event in stream:
if event.type == "content_block_delta" and event.delta.type == "thinking_delta":
print(event.delta.thinking, end="")
elif event.type == "content_block_delta" and event.delta.type == "text_delta":
print(event.delta.text, end="")
When to Use Extended Thinking
Extended thinking is ideal for:
- Complex reasoning tasks: Mathematical proofs, logical puzzles, strategic planning
- Multi-step analysis: Research synthesis, code debugging, document analysis
- Tasks requiring careful consideration: Ethical dilemmas, risk assessment, decision trees
- Creative problem-solving: Brainstorming with structured evaluation
Key Takeaways
- Adaptive thinking (
thinking: {type: "adaptive"}) is the recommended approach for all current Claude models, especially Opus 4.7 where manual thinking is no longer supported. - Use the
effortparameter (low,medium,high) to control reasoning depth—reservehighfor complex tasks. - Extended thinking returns thinking content blocks before the final text, giving you transparency into Claude's reasoning.
- Manual extended thinking (
budget_tokens) is deprecated on Opus 4.6 and Sonnet 4.6—migrate to adaptive thinking. - Extended thinking works with streaming, structured outputs, and tool use, making it versatile for production applications.