Mastering Extended Thinking in Claude: A Complete Guide to Adaptive and Manual Modes
Learn how to enable and optimize Claude's extended thinking for complex reasoning tasks. Covers adaptive thinking, manual mode, effort parameters, and code examples for all supported models.
This guide explains how to use Claude's extended thinking feature to enhance reasoning on complex tasks. You'll learn the difference between adaptive thinking (recommended for Opus 4.7+) and manual mode, how to set effort levels, and see practical API code examples in Python and TypeScript.
Introduction
Claude's extended thinking feature unlocks a new level of reasoning capability, allowing the model to "think out loud" before delivering its final answer. This is especially valuable for complex tasks like multi-step math problems, code debugging, legal analysis, or strategic planning. By giving Claude a dedicated thinking budget, you can see its step-by-step reasoning and gain confidence in its conclusions.
This guide covers everything you need to know: how extended thinking works, which modes to use for each model, how to configure it in the API, and best practices for getting the most out of it.
How Extended Thinking Works
When extended thinking is enabled, Claude produces special thinking content blocks in its response. These blocks contain the model's internal reasoning—its chain of thought—before it outputs the final text content block. The API 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 is required when streaming. The thinking blocks are not shown to end users by default—they are meant for developers to inspect or optionally display.
Adaptive Thinking vs. Manual Extended Thinking
Claude now supports two modes of extended thinking:
Adaptive Thinking (Recommended)
Adaptive thinking (type: "adaptive") is the modern, recommended approach. Instead of setting a fixed token budget, you specify an effort level (low, medium, high) that tells Claude how much reasoning to apply. The model dynamically allocates thinking tokens based on the complexity of the task.
Manual Extended Thinking (Deprecated on New Models)
Manual mode (type: "enabled") requires you to set a budget_tokens value—the maximum number of tokens Claude can use for thinking. This mode is no longer supported on Claude Opus 4.7 and later models (returns a 400 error). It is still functional on Claude Opus 4.6 and Claude Sonnet 4.6 but is deprecated and will be removed in a future release.
Model-Specific Behavior
| Model | Adaptive Thinking | Manual Mode | Notes |
|---|---|---|---|
| Claude Opus 4.7+ | ✅ Required | ❌ Returns 400 error | Use effort parameter |
| Claude Opus 4.6 | ✅ Recommended | ✅ Deprecated, functional | Switch to adaptive |
| Claude Sonnet 4.6 | ✅ Recommended | ✅ Deprecated, functional | Interleaved mode deprecated |
| Claude Mythos Preview | ✅ Default | ✅ Accepted | disabled not supported; use display: "summarized" |
| Claude Sonnet 3.7 | ❌ Not supported | ✅ Supported | Manual mode only |
How to Use Extended Thinking in the API
Adaptive Thinking (Recommended for Opus 4.7+)
Python Example: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: A train leaves Station A at 60 mph. Another train leaves Station B at 90 mph. The stations are 300 miles apart. When and where do they meet?"}
]
)
print(response.content)
TypeScript Example:
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: 'high'
},
messages: [
{ role: 'user', content: 'Explain the implications of quantum entanglement for cryptography.' }
]
});
console.log(response.content);
}
main();
Manual Extended Thinking (For Claude Sonnet 3.7 and older models)
Python Example:import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-sonnet-3-7",
max_tokens=8192,
thinking={
"type": "enabled",
"budget_tokens": 4096 # Max tokens for thinking
},
messages=[
{"role": "user", "content": "Write a detailed analysis of the economic impacts of AI automation."}
]
)
print(response.content)
TypeScript Example:
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic();
async function main() {
const response = await client.messages.create({
model: 'claude-sonnet-3-7',
max_tokens: 8192,
thinking: {
type: 'enabled',
budget_tokens: 4096
},
messages: [
{ role: 'user', content: 'Debug this Python code and explain the fix...' }
]
});
console.log(response.content);
}
main();
Effort Parameter (Adaptive Thinking)
The effort parameter controls how much reasoning Claude applies:
low: Minimal thinking, faster responses. Good for simple tasks.medium: Balanced reasoning. Default if not specified.high: Maximum reasoning depth. Best for complex, multi-step problems.
response = client.messages.create(
model="claude-opus-4-7",
max_tokens=4096,
thinking={
"type": "adaptive",
"effort": "medium"
},
messages=[
{"role": "user", "content": "Compare and contrast the foreign policies of the US and China."}
]
)
Streaming with Extended Thinking
When streaming, thinking blocks are delivered as content_block_delta events with type: "thinking_delta". You must verify the signature at the end of the stream.
import anthropic
client = anthropic.Anthropic()
with client.messages.stream(
model="claude-opus-4-7",
max_tokens=4096,
thinking={"type": "adaptive", "effort": "high"},
messages=[
{"role": "user", "content": "Explain the concept of recursion with a real-world example."}
]
) 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="")
Best Practices
- Use adaptive thinking for new models. It's simpler and future-proof. You don't need to guess a token budget.
- Set effort based on task complexity. Use
"high"for math, logic, or multi-step reasoning;"low"for simple Q&A. - Combine with tool use. Extended thinking works well with tools—Claude can reason about which tools to call and how to interpret results.
- Handle thinking blocks in your UI. Decide whether to show thinking to end users or keep it hidden. The
displayparameter (e.g.,"summarized") can help. - Monitor token usage. Extended thinking consumes tokens from your budget. Adaptive thinking helps control costs by allocating only what's needed.
Common Pitfalls
- Using manual mode on Opus 4.7+: This returns a 400 error. Always use adaptive thinking.
- Forgetting
max_tokens: Extended thinking requiresmax_tokensto be set. The thinking budget is part of the total token limit. - Not verifying signatures in streaming: Always check the
signatureat the end of a stream to ensure the thinking content hasn't been tampered with.
Key Takeaways
- Extended thinking gives Claude enhanced reasoning by producing visible chain-of-thought before the final answer.
- Adaptive thinking (
type: "adaptive") with theeffortparameter is the recommended mode for Claude Opus 4.7+ and newer models. - Manual mode (
type: "enabled"withbudget_tokens) is deprecated on Opus 4.6/Sonnet 4.6 and unsupported on Opus 4.7+. - Use the
effortparameter to control reasoning depth: low, medium, or high. - Streaming is fully supported; remember to verify the thinking signature for security.