Mastering Extended Thinking in Claude: A Practical Guide to Adaptive and Manual Reasoning
Learn how to enable and optimize Claude's extended thinking capabilities for complex reasoning tasks. Covers adaptive thinking, manual mode, effort parameters, and code examples.
This guide explains how to use Claude's extended thinking feature to enhance reasoning on complex tasks. You'll learn about adaptive thinking (recommended for Claude Opus 4.7+), manual mode, effort parameters, and how to implement them in your API calls with practical code examples.
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 its final answer. Whether you're building a research assistant, a code analysis tool, or a multi-step reasoning application, extended thinking gives Claude the space to produce more accurate and nuanced responses.
This guide covers everything you need to know: from the basics of enabling extended thinking to advanced configuration with adaptive thinking and effort parameters. By the end, you'll be able to integrate extended thinking into your own applications with confidence.
How Extended Thinking Works
When extended thinking is enabled, Claude generates internal reasoning in the form of thinking content blocks. These blocks contain the model's step-by-step analysis, followed by the final text response. The API response structure looks like this:
{
"content": [
{
"type": "thinking",
"thinking": "Let me break this problem down...",
"signature": "WaUjzkypQ2mUEVM36O2TxuC06KN8xyfbJwyem2dw3URve/op91XWHOEBLLqIOMfFG/UvLEczmEsUjavL...."
},
{
"type": "text",
"text": "Based on my analysis, the answer is..."
}
]
}
The thinking block includes a cryptographic signature that verifies the integrity of the reasoning content. You can display this thinking to users or keep it hidden—the choice is yours.
Supported Models and Modes
Extended thinking behavior varies across Claude models. Here's a quick reference:
| Model | Recommended Mode | Notes |
|---|---|---|
| Claude Opus 4.7+ | Adaptive thinking (type: "adaptive") | Manual mode returns a 400 error |
| Claude Opus 4.6 | Adaptive thinking (recommended) | Manual mode deprecated but functional |
| Claude Sonnet 4.6 | Adaptive thinking (recommended) | Manual mode deprecated but functional |
| Claude Mythos Preview | Adaptive thinking (default) | Manual mode also accepted; disabled not supported |
type: "enabled") is being phased out and should be avoided in new projects.
Adaptive Thinking: The Modern Approach
Adaptive thinking lets Claude dynamically decide how much reasoning to apply based on the complexity of the task. You control the effort level, and Claude handles the rest.
Effort Parameter
The effort parameter accepts values from 0.0 to 1.0 (inclusive). Higher values tell Claude to think more deeply, which can improve accuracy on hard problems but uses more tokens.
- Low effort (0.0–0.3): Quick responses for simple tasks
- Medium effort (0.4–0.7): Balanced reasoning for most use cases
- High effort (0.8–1.0): Maximum reasoning for complex problems
Example: Adaptive Thinking in Python
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-opus-4-7",
max_tokens=4096,
thinking={
"type": "adaptive",
"effort": 0.8 # High effort for complex reasoning
},
messages=[
{
"role": "user",
"content": "Analyze the following code for potential race conditions:\n\n
python\ncounter = 0\n\ndef increment():\n global counter\n for _ in range(1000):\n counter += 1\n``"
}
]
)
Print the thinking content
for block in response.content:
if block.type == "thinking":
print("Thinking:", block.thinking)
elif block.type == "text":
print("Final answer:", block.text)
### Example: Adaptive Thinking in TypeScript
typescript
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic();
async function analyzeCode() {
const response = await client.messages.create({
model: 'claude-opus-4-7',
max_tokens: 4096,
thinking: {
type: 'adaptive',
effort: 0.8
},
messages: [
{
role: 'user',
content: 'Analyze the following code for potential race conditions:\n\n
`python\ncounter = 0\n\ndef increment():\n global counter\n for _ in range(1000):\n counter += 1\n`'
}
]
});
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);
}
}
}
analyzeCode();
## Manual Extended Thinking (Legacy)
For older models (Claude Opus 4.6 and earlier), you can still use manual mode with a fixed token budget:
python
response = client.messages.create(
model="claude-opus-4-6",
max_tokens=8192,
thinking={
"type": "enabled",
"budget_tokens": 4096 # Fixed budget for thinking
},
messages=[
{"role": "user", "content": "Solve this complex math problem..."}
]
)
Important: budget_tokens must be less than max_tokens. The thinking budget cannot exceed the total output limit.
Best Practices for Extended Thinking
1. Choose the Right Effort Level
Start with a medium effort (0.5) and adjust based on your results. For tasks like math, logic puzzles, or code review, higher effort (0.7–1.0) often yields better answers. For simple Q&A, lower effort saves tokens and latency.
2. Handle Thinking Blocks in Your Application
You can choose to display the thinking content to users (great for transparency) or omit it. If you omit it, you still pay for the tokens used during thinking.
3. Combine with Structured Outputs
Extended thinking works well with structured outputs. Claude can reason through a problem and then output a JSON object:
python
response = client.messages.create(
model="claude-opus-4-7",
max_tokens=4096,
thinking={"type": "adaptive", "effort": 0.7},
messages=[
{
"role": "user",
"content": "Extract the key entities from this text and return them as JSON with 'people', 'places', and 'organizations' arrays."
}
]
)
`
4. Monitor Token Usage
Extended thinking can significantly increase token consumption. Use the
usage field in the API response to track input_tokens and output_tokens, and adjust your effort or budget accordingly.
Common Pitfalls and Troubleshooting
"400 Error: Manual thinking not supported"
If you're using Claude Opus 4.7 or later, switch to adaptive thinking (
type: "adaptive"). Manual mode is no longer accepted.
Thinking Block Missing
If you don't see a
thinking block in the response, check that:
- You've set
thinking correctly in the request
The model supports extended thinking
You haven't accidentally set thinking: {type: "disabled"} (not supported on some models)
High Latency
Extended thinking takes time. For real-time applications, use lower effort values or consider streaming the response to show progress to users.
Conclusion
Extended thinking is one of Claude's most powerful features for complex reasoning tasks. By adopting adaptive thinking with the effort parameter, you can dynamically balance reasoning depth and performance. Start with medium effort, monitor your results, and adjust as needed.
Key Takeaways
- Adaptive thinking is the recommended approach for Claude Opus 4.7+ and should be used for all new projects. Manual mode is deprecated on newer models.
- Use the
effort parameter (0.0–1.0) to control reasoning depth. Higher effort = more thorough analysis but higher token usage.
Handle thinking` content blocks in your application to either display or hide Claude's reasoning process.