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 practical API examples for Opus and Sonnet models.
This guide explains how to enable and optimize Claude's extended thinking feature for complex reasoning tasks. You'll learn about adaptive thinking with the effort parameter, manual budget tokens, and how to handle thinking content blocks in API responses for models like Claude Opus 4.7 and Sonnet 4.6.
Mastering Extended Thinking in Claude: Adaptive Thinking, Effort, and Best Practices
Claude's extended thinking feature unlocks enhanced reasoning capabilities for complex tasks, giving you visibility into the model's step-by-step thought process before it delivers its final answer. Whether you're building a research assistant, a code analysis tool, or a multi-step problem solver, understanding how to configure and use extended thinking effectively is crucial.
This guide covers everything you need to know: from the new adaptive thinking mode on Claude Opus 4.7 to manual budget tokens on older models, plus practical code examples and best practices.
What Is Extended Thinking?
Extended thinking allows Claude to "think out loud" by generating internal reasoning content blocks before producing its final text response. The API response includes one or more thinking blocks followed by text blocks. This transparency helps you understand how Claude arrived at its answer and debug complex reasoning chains.
Example response structure:
{
"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 content verification and is required when streaming.
Adaptive Thinking vs. Manual Extended Thinking
Claude now offers two modes for extended thinking, and the right choice depends on your model version.
Adaptive Thinking (Recommended for Opus 4.7, Opus 4.6, Sonnet 4.6)
Adaptive thinking lets Claude dynamically decide how much reasoning to use based on the complexity of the task. Instead of setting a fixed token budget, you specify an effort level. This is the only supported mode on Claude Opus 4.7.
Effort levels:low– Minimal reasoning, suitable for simple tasks.medium– Balanced reasoning for most use cases.high– Maximum reasoning for complex, multi-step problems.
- You want Claude to automatically scale reasoning effort.
- You're using Claude Opus 4.7 (required).
- You prefer simplicity over manual tuning.
Manual Extended Thinking (Deprecated on Opus 4.6/Sonnet 4.6, Not Supported on Opus 4.7)
Manual extended thinking uses type: "enabled" with a budget_tokens parameter. This is still functional on Claude Opus 4.6 and Claude Sonnet 4.6 but is deprecated and will be removed in a future release. It is not accepted on Claude Opus 4.7 (returns a 400 error).
- You're using an older model (Opus 4.6, Sonnet 4.6) and need precise control over token usage.
- You have a fixed token budget you must not exceed.
How to Use Extended Thinking in the API
Adaptive Thinking with Effort (Claude Opus 4.7)
Here's how to enable adaptive thinking with the effort parameter:
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": "Solve this complex math problem: integrate x^2 * sin(x) from 0 to pi"}
]
)
Access thinking blocks
for block in response.content:
if block.type == "thinking":
print("Thinking:", block.thinking)
elif block.type == "text":
print("Final answer:", block.text)
TypeScript (using the Anthropic SDK):
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic();
const response = await client.messages.create({
model: 'claude-opus-4-7',
max_tokens: 4096,
thinking: {
type: 'adaptive',
effort: 'high'
},
messages: [
{ role: 'user', content: 'Analyze the pros and cons of quantum computing for cryptography.' }
]
});
for (const block of response.content) {
if (block.type === 'thinking') {
console.log('Thinking:', block.thinking);
} else if (block.type === 'text') {
console.log('Final answer:', block.text);
}
}
Manual Extended Thinking with Budget Tokens (Claude Opus 4.6, Sonnet 4.6)
For older models, you can still use manual mode:
Python:response = client.messages.create(
model="claude-opus-4-6",
max_tokens=8192,
thinking={
"type": "enabled",
"budget_tokens": 4096 # Max tokens for reasoning
},
messages=[
{"role": "user", "content": "Explain the proof of Fermat's Last Theorem in simple terms."}
]
)
Important: The budget_tokens value must be less than max_tokens. A good rule of thumb is to set budget_tokens to about half of max_tokens.
Streaming with Extended Thinking
When streaming, thinking blocks appear as content_block_delta events with type: "thinking_delta". You need to handle these separately from text deltas.
with client.messages.stream(
model="claude-opus-4-7",
max_tokens=4096,
thinking={"type": "adaptive", "effort": "high"},
messages=[{"role": "user", "content": "Write a short story about a robot learning to paint."}]
) as stream:
for event in stream:
if event.type == "content_block_delta":
if event.delta.type == "thinking_delta":
print(event.delta.thinking, end="")
elif event.delta.type == "text_delta":
print(event.delta.text, end="")
Differences Across Model Versions
| Model | Adaptive Thinking | Manual Thinking | Notes |
|---|---|---|---|
| Claude Opus 4.7 | ✅ Required | ❌ Not supported (400 error) | Use effort parameter |
| Claude Opus 4.6 | ✅ Recommended | ✅ Deprecated but functional | Migrate to adaptive |
| Claude Sonnet 4.6 | ✅ Recommended | ✅ Deprecated but functional | Interleaved mode deprecated |
| Claude Mythos Preview | ✅ Default | ✅ Accepted | thinking: {"type": "disabled"} not supported; display defaults to "omitted" |
Best Practices for Extended Thinking
1. Choose the Right Effort Level
- Low effort: Use for straightforward Q&A, simple translations, or basic formatting tasks.
- Medium effort: Use for typical analysis, code generation, or moderate problem-solving.
- High effort: Use for complex reasoning, multi-step math, legal analysis, or research synthesis.
2. Set Appropriate Token Budgets (Manual Mode)
If you're still using manual mode on Opus 4.6 or Sonnet 4.6:
- Start with
budget_tokensat 50-60% ofmax_tokens. - Increase for tasks requiring deep reasoning (e.g., mathematical proofs).
- Decrease for simpler tasks to save costs and reduce latency.
3. Handle Thinking Blocks in Your Application
- Always check for
thinkingblocks in the response content. - If you're displaying results to users, consider showing the thinking process in a collapsible section.
- Use the
signaturefield for content verification if needed.
4. Migrate from Manual to Adaptive
If you're currently using type: "enabled" with budget_tokens, plan to migrate to adaptive thinking. On Claude Opus 4.7, manual mode is already blocked. On Opus 4.6 and Sonnet 4.6, it's deprecated.
# Old (manual) – deprecated
thinking={"type": "enabled", "budget_tokens": 4096}
New (adaptive) – recommended
thinking={"type": "adaptive", "effort": "high"}
5. Combine with Other Features
Extended thinking works well with:
- Tool use – Claude can reason about which tools to call and how to interpret results.
- Structured outputs – Use thinking to plan the structure before outputting JSON.
- Citations – Claude can reason about source material before citing it.
Common Pitfalls to Avoid
- Setting
budget_tokenstoo high – This can cause Claude to run out of tokens before producing a final answer. Keep it well belowmax_tokens. - Ignoring thinking blocks – If you only process
textblocks, you'll miss valuable reasoning that could be displayed to users or used for debugging. - Using manual mode on Opus 4.7 – This will return a 400 error. Always use adaptive thinking.
- Not handling streaming deltas – When streaming, thinking content arrives as
thinking_deltaevents, nottext_delta.
Conclusion
Extended thinking is a powerful feature that gives Claude the ability to reason step-by-step before answering. With the introduction of adaptive thinking and the effort parameter on Claude Opus 4.7, configuring extended thinking is simpler than ever. By following the best practices in this guide, you can leverage Claude's full reasoning capabilities while maintaining control over token usage and response quality.
Key Takeaways
- Adaptive thinking with the
effortparameter is the recommended and only supported mode on Claude Opus 4.7. Uselow,medium, orhigheffort levels to control reasoning depth. - Manual extended thinking (
type: "enabled"withbudget_tokens) is deprecated on Opus 4.6 and Sonnet 4.6, and not supported on Opus 4.7. Migrate to adaptive thinking as soon as possible. - Always handle
thinkingcontent blocks in your application code – they contain valuable reasoning that can be displayed to users or used for debugging. - When streaming, differentiate between
thinking_deltaandtext_deltaevents to correctly process thinking content. - Set
budget_tokensto about 50-60% ofmax_tokenswhen using manual mode to ensure Claude has enough tokens for both reasoning and the final answer.