Mastering Extended Thinking in Claude: A Practical Guide to Adaptive and Manual Reasoning
Learn how to use Claude's extended thinking feature for complex tasks. Covers adaptive thinking, manual mode, budget tokens, and code examples for the Messages API.
This guide explains how to enable and configure Claude's extended thinking for step-by-step reasoning. You'll learn the difference between adaptive and manual modes, how to set budget tokens, and see practical API examples for Claude Opus 4.7, Sonnet 4.6, and Mythos.
Introduction
Claude's extended thinking feature unlocks a new level of reasoning capability. When enabled, Claude generates internal "thinking" content blocks where it works through a problem step by step before producing its final answer. This is especially valuable for complex tasks like multi-step math, code debugging, legal analysis, or strategic planning.
In this guide, you'll learn:
- How extended thinking works under the hood
- The difference between adaptive thinking and manual extended thinking
- Which Claude models support which mode
- How to configure budget tokens and effort parameters
- Practical API code examples in Python and TypeScript
How Extended Thinking Works
When you enable extended thinking, Claude's API response includes one or more thinking content blocks before the final text content block. Each thinking block contains:
type: Always"thinking"thinking: The raw reasoning textsignature: A cryptographic signature for verification (important for safety-critical applications)
{
"content": [
{
"type": "thinking",
"thinking": "Let me break this down... First, I need to check the constraints...",
"signature": "WaUjzkypQ2mUEVM36O2TxuC06KN8xyfbJwyem2dw3URve/op91XWHOEBLLqIOMfFG/UvLEczmEsUjavL...."
},
{
"type": "text",
"text": "Based on my analysis, the answer is 42."
}
]
}
Adaptive Thinking vs. Manual Extended Thinking
Claude now offers two modes for extended thinking. The right choice depends on your model and use case.
Adaptive Thinking (Recommended for Claude Opus 4.7)
Adaptive thinking (thinking: {type: "adaptive"}) lets Claude dynamically decide how much thinking is needed for each request. You control the effort level rather than a fixed token budget.
- Effort parameter: Accepts values like
"low","medium","high"(exact options may vary by model). - Best for: Claude Opus 4.7, where manual mode is no longer supported.
- Also recommended for: Claude Opus 4.6 and Claude Sonnet 4.6 (manual mode is deprecated on these models).
Manual Extended Thinking (Deprecated on Opus 4.7)
Manual mode (thinking: {type: "enabled", budget_tokens: N}) allows you to set a fixed token budget for reasoning.
budget_tokens: Maximum tokens Claude can use for thinking (e.g., 1024, 2048, 4096).- Supported on: All current Claude models except Claude Opus 4.7 (returns a 400 error).
- Status: Deprecated on Opus 4.6 and Sonnet 4.6; will be removed in a future release.
Special Case: Claude Mythos Preview
Claude Mythos Preview uses adaptive thinking by default. You can still pass thinking: {type: "enabled", budget_tokens: N} if needed, but thinking: {type: "disabled"} is not supported. Also, the response defaults to display: "omitted" (no thinking content returned). To see summaries, pass display: "summarized".
How to Configure Extended Thinking in the API
Python Example (Adaptive Thinking with Claude Opus 4.7)
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 step by step: What is the 100th prime number?"
}
]
)
Print thinking blocks
for block in response.content:
if block.type == "thinking":
print("Thinking:", block.thinking)
elif block.type == "text":
print("Final answer:", block.text)
Python Example (Manual Mode with Claude Sonnet 4.6)
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=4096,
thinking={
"type": "enabled",
"budget_tokens": 2048 # Fixed token budget for reasoning
},
messages=[
{
"role": "user",
"content": "Explain the difference between TCP and UDP in detail."
}
]
)
for block in response.content:
if block.type == "thinking":
print("Thinking:", block.thinking)
TypeScript Example (Adaptive Thinking)
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic();
async function main() {
const response = await client.messages.create({
model: 'claude-opus-4-7',
max_tokens: 4096,
thinking: {
type: 'adaptive',
effort: 'medium'
},
messages: [
{
role: 'user',
content: 'Write a Python function to merge two sorted lists.'
}
]
});
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);
}
}
}
main();
Best Practices for Using Extended Thinking
1. Choose the Right Mode for Your Model
| Model | Recommended Mode | Notes |
|---|---|---|
| Claude Opus 4.7 | Adaptive (type: "adaptive") | Manual mode returns 400 error |
| Claude Opus 4.6 | Adaptive (preferred) | Manual mode deprecated |
| Claude Sonnet 4.6 | Adaptive (preferred) | Manual mode deprecated |
| Claude Mythos Preview | Adaptive (default) | Cannot disable thinking |
2. Set Appropriate Budget Tokens (Manual Mode)
If you're using manual mode on a supported model, set budget_tokens based on task complexity:
- Simple reasoning (e.g., basic Q&A): 512–1024 tokens
- Moderate complexity (e.g., code review, analysis): 1024–2048 tokens
- High complexity (e.g., multi-step math, legal reasoning): 2048–4096+ tokens
3. Use Effort Wisely (Adaptive Mode)
With adaptive thinking, the effort parameter lets you balance speed and depth:
"low": Faster responses, less reasoning"medium": Balanced (default if not specified)"high": Maximum reasoning depth, slower response
4. Handle Thinking Blocks in Your Application
Always iterate over content blocks to extract both thinking and final text. This is critical if you're building a chat UI or logging reasoning for debugging.
5. Be Aware of Token Usage
Extended thinking consumes tokens from your budget_tokens (or adaptive equivalent). This counts toward your total token usage and costs. Monitor your usage carefully, especially with high effort settings.
Differences Across Model Versions
Claude's thinking behavior evolves with each model version. Key differences:
- Claude Opus 4.7: Only supports adaptive thinking; manual mode removed.
- Claude Opus 4.6: Adaptive recommended; manual still works but deprecated.
- Claude Sonnet 4.6: Same as Opus 4.6; manual mode with interleaved mode deprecated.
- Claude Mythos Preview: Adaptive is default; thinking cannot be disabled; use
display: "summarized"to see reasoning summaries.
Common Pitfalls and Troubleshooting
"400 Error: Manual extended thinking not supported"
You're using thinking: {type: "enabled", budget_tokens: N} on Claude Opus 4.7. Switch to thinking: {type: "adaptive"} with the effort parameter.
"No thinking blocks in response"
- You may have set
thinking: {type: "disabled"}on a model that doesn't support it (e.g., Mythos). - The model may have finished thinking before producing output (check
stop_reason). - You might be using a model version that doesn't support extended thinking (e.g., Claude Haiku).
"Thinking content is empty or omitted"
On Claude Mythos Preview, the default display is "omitted". Pass display: "summarized" to receive thinking summaries.
Key Takeaways
- Extended thinking gives Claude step-by-step reasoning capabilities, output as
thinkingcontent blocks before the final answer. - Adaptive thinking (
type: "adaptive") is the modern, recommended mode, especially for Claude Opus 4.7. Use theeffortparameter to control depth. - Manual mode (
type: "enabled"withbudget_tokens) is deprecated on Opus 4.6 and Sonnet 4.6, and not supported on Opus 4.7. - Always iterate over response
contentblocks to extract both reasoning and final text in your application. - Monitor token usage carefully—extended thinking consumes tokens and affects both cost and response time.