Mastering Extended Thinking in Claude: Adaptive Thinking, Effort, and Best Practices
Learn how to use Claude's extended thinking for complex reasoning tasks. Covers adaptive thinking, effort parameter, budget tokens, and code examples for Opus 4.7 and Sonnet 4.6.
This guide explains how to enable and optimize Claude's extended thinking feature for complex reasoning tasks, covering adaptive thinking, the effort parameter, budget tokens, and practical API code examples for Claude Opus 4.7 and Sonnet 4.6.
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. Whether you're building a research assistant, a code analysis tool, or a multi-step reasoning agent, extended thinking gives Claude the space to produce more accurate, nuanced, and transparent outputs.
This guide covers everything you need to know to use extended thinking effectively in the Claude API, with a focus on the latest adaptive thinking mode and the effort parameter introduced for Claude Opus 4.7.
What Is Extended Thinking?
When extended thinking is enabled, Claude generates internal reasoning content blocks before producing its final text response. These blocks contain the model's step-by-step thought process, including intermediate conclusions, alternative approaches, and self-corrections. The API returns these blocks alongside the final answer, giving you full visibility into how Claude arrived at its conclusion.
A typical response looks like this:
{
"content": [
{
"type": "thinking",
"thinking": "Let me analyze this step by step...",
"signature": "WaUjzkypQ2mUEVM36O2TxuC06KN8xyfbJwyem2dw3URve/op91XWHOEBLLqIOMfFG/UvLEczmEsUjavL...."
},
{
"type": "text",
"text": "Based on my analysis..."
}
]
}
The signature field is used for verification and safety purposes. You can use it to confirm that the thinking content hasn't been tampered with.
Adaptive Thinking vs. Manual Extended Thinking
Claude now offers two modes for extended thinking:
- Adaptive thinking (
thinking: {type: "adaptive"}) – Claude dynamically decides how much thinking to do based on the complexity of the task. This is the recommended mode for all current models. - Manual extended thinking (
thinking: {type: "enabled", budget_tokens: N}) – You specify a fixed token budget for thinking. This mode is deprecated on Claude Opus 4.6 and Sonnet 4.6, and no longer supported on Claude Opus 4.7 (returns a 400 error).
Model Support Summary
| Model | Adaptive Thinking | Manual Extended Thinking |
|---|---|---|
| Claude Opus 4.7 | ✅ Recommended | ❌ Not supported (400 error) |
| Claude Opus 4.6 | ✅ Recommended | ⚠️ Deprecated but functional |
| Claude Sonnet 4.6 | ✅ Recommended | ⚠️ Deprecated but functional |
| Claude Mythos Preview | ✅ Default | ✅ Accepted (but disabled not supported) |
Using Adaptive Thinking with the Effort Parameter
For Claude Opus 4.7, you must use adaptive thinking with the effort parameter. The effort parameter controls how much reasoning Claude applies to the task. Here's the API shape:
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-opus-4-7",
max_tokens=4096,
thinking={
"type": "adaptive",
"effort": "high" # Options: "low", "medium", "high"
},
messages=[
{"role": "user", "content": "Write a detailed analysis of the economic impacts of quantum computing on global supply chains."}
]
)
for block in response.content:
if block.type == "thinking":
print(f"Thinking: {block.thinking}")
elif block.type == "text":
print(f"Final answer: {block.text}")
Effort Levels Explained
low– Minimal reasoning. Best for simple tasks where speed is more important than depth.medium– Balanced reasoning. Good for most standard tasks.high– Maximum reasoning. Use for complex, multi-step problems that require deep analysis.
Tip: Start withmediumeffort and increase tohighonly when you need deeper reasoning. Higher effort consumes more tokens and increases latency.
Using Adaptive Thinking on Claude Opus 4.6 and Sonnet 4.6
For Claude Opus 4.6 and Claude Sonnet 4.6, adaptive thinking is also recommended. Here's how to use it:
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=4096,
thinking={
"type": "adaptive"
},
messages=[
{"role": "user", "content": "Solve this complex math problem: A train leaves Station A at 60 mph..."}
]
)
On these models, adaptive thinking does not require an effort parameter. Claude automatically determines the appropriate level of reasoning.
Manual Extended Thinking (Deprecated but Still Functional)
If you're still using manual extended thinking on Claude Opus 4.6 or Sonnet 4.6, here's the syntax:
response = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=4096,
thinking={
"type": "enabled",
"budget_tokens": 2048 # Maximum tokens for thinking
},
messages=[
{"role": "user", "content": "Explain the theory of relativity in simple terms."}
]
)
Warning: This mode is deprecated and will be removed in a future model release. Migrate to adaptive thinking as soon as possible.
Task Budgets and Fast Mode (Beta)
Claude also supports task budgets and fast mode as beta features:
- Task budgets – Allows you to set a total token budget for the entire task (thinking + output).
- Fast mode – A research preview that reduces latency by limiting thinking depth. Useful for real-time applications.
thinking object:
response = client.messages.create(
model="claude-opus-4-7",
max_tokens=4096,
thinking={
"type": "adaptive",
"effort": "high",
"budget_tokens": 4096, # Total task budget
"fast_mode": True # Enable fast mode (beta)
},
messages=[...]
)
Best Practices for Extended Thinking
1. Use Adaptive Thinking by Default
Adaptive thinking is the future. It's more efficient, requires less manual tuning, and is the only supported mode on Claude Opus 4.7. Migrate all existing code to use type: "adaptive".
2. Match Effort to Task Complexity
- Low effort: Simple Q&A, basic summarization, straightforward translations.
- Medium effort: Code generation, analysis, moderate reasoning.
- High effort: Complex problem-solving, multi-step reasoning, research tasks.
3. Handle Thinking Blocks in Your Application
When streaming responses, you'll receive thinking blocks before text blocks. Make sure your UI or processing logic handles them correctly:
with client.messages.stream(
model="claude-opus-4-7",
max_tokens=4096,
thinking={"type": "adaptive", "effort": "high"},
messages=[{"role": "user", "content": "Analyze this code for security vulnerabilities..."}]
) as stream:
for event in stream:
if event.type == "content_block_delta" and event.delta.type == "thinking_delta":
# Handle thinking tokens
pass
elif event.type == "content_block_delta" and event.delta.type == "text_delta":
# Handle final answer tokens
pass
4. Set Appropriate max_tokens
Your max_tokens parameter should be large enough to accommodate both thinking and the final response. A good rule of thumb is to set max_tokens to at least 2x your expected thinking budget.
5. Monitor Token Usage
Extended thinking can significantly increase token consumption. Monitor your usage and adjust effort levels accordingly. Use the usage field in the API response to track thinking tokens vs. output tokens.
Common Pitfalls
- Using manual mode on Opus 4.7: This will return a 400 error. Always use adaptive thinking.
- Setting
budget_tokenstoo low: If you set a low budget, Claude may cut off its reasoning prematurely. - Forgetting to handle thinking blocks: If your application expects only text blocks, it may break when thinking blocks appear.
- Not updating deprecated code: Manual extended thinking will be removed in future releases. Update your code now.
Conclusion
Extended thinking is a powerful feature that makes Claude more capable for complex reasoning tasks. By adopting adaptive thinking and using the effort parameter wisely, you can get the best balance of depth, speed, and cost.
Remember:
- Use
type: "adaptive"on all current models. - On Claude Opus 4.7, you must include the
effortparameter. - Migrate away from manual extended thinking before it's removed.
- Handle thinking blocks in your application logic.
Key Takeaways
- Adaptive thinking is the recommended mode for all current Claude models. It dynamically adjusts reasoning depth based on task complexity.
- Claude Opus 4.7 requires adaptive thinking with the
effortparameter. Manual extended thinking is not supported and returns a 400 error. - Use the effort parameter to control reasoning depth:
lowfor simple tasks,mediumfor standard tasks,highfor complex problems. - Manual extended thinking is deprecated on Claude Opus 4.6 and Sonnet 4.6. Migrate to adaptive thinking to avoid future breakage.
- Handle thinking blocks in your application – they appear as separate content blocks in the API response and during streaming.