BeClaude
GuideBeginnerAPI2026-05-13

Mastering Extended Thinking in Claude: A Complete Guide to Adaptive Reasoning

Learn how to enable and optimize Claude's extended thinking capabilities using adaptive thinking and effort parameters for complex reasoning tasks across Opus and Sonnet models.

Quick Answer

This guide explains how to use Claude's extended thinking feature with adaptive thinking and effort parameters to get step-by-step reasoning for complex tasks, including code examples and best practices for Opus 4.7 and earlier models.

extended thinkingadaptive thinkingClaude APIreasoningeffort parameter

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. This is especially valuable for tasks like mathematical proofs, multi-step analysis, code debugging, and strategic planning.

With the release of Claude Opus 4.7, Anthropic introduced adaptive thinking — a smarter, more flexible approach to extended thinking that replaces the older manual token budget system. This guide covers everything you need to know to use extended thinking effectively, whether you're working with the latest models or maintaining compatibility with older ones.

What Is Extended Thinking?

When extended thinking is enabled, Claude generates internal reasoning in the form of thinking content blocks before producing its final text response. These thinking blocks contain the model's chain-of-thought reasoning, and they are returned in the API response alongside the final answer.

Here's what a typical response looks like:

{
  "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 the integrity of the thinking content if needed.

Adaptive Thinking vs. Manual Extended Thinking

Adaptive Thinking (Recommended)

Adaptive thinking uses the thinking: {type: "adaptive"} configuration along with an effort parameter. Instead of you guessing how many tokens Claude needs to think, the model dynamically decides how much reasoning is appropriate for the task.

Effort levels:
  • low: Minimal reasoning — suitable for simple tasks
  • medium: Balanced reasoning — good for most complex tasks
  • high: Maximum reasoning — best for very challenging problems

Manual Extended Thinking (Deprecated)

The older approach used thinking: {type: "enabled", budget_tokens: N} where you specified a fixed token budget. This is now 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 Matrix

ModelAdaptive ThinkingManual Extended ThinkingNotes
Claude Opus 4.7✅ Recommended❌ Returns 400 errorUse effort parameter
Claude Opus 4.6✅ Recommended⚠️ Deprecated but functionalMigrate to adaptive
Claude Sonnet 4.6✅ Recommended⚠️ Deprecated but functionalInterleaved mode deprecated
Claude Mythos Preview✅ Default✅ Also accepteddisabled not supported
Claude Sonnet 3.7❌ Not supported✅ SupportedUses older behavior

How to Use Extended Thinking in the API

Python Example

import anthropic

client = anthropic.Anthropic()

Using adaptive thinking (recommended for Opus 4.7+)

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": "Prove that the square root of 2 is irrational." } ] )

Access 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)

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: 'Design a distributed caching system for a global e-commerce platform.' } ] });

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();

Using Manual Extended Thinking (Legacy Models)

For Claude Sonnet 3.7 or other models that still support manual mode:

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": "Explain the P vs NP problem in simple terms."
        }
    ]
)
Important: When using manual mode, budget_tokens must be less than max_tokens. The thinking tokens count toward your total token usage.

Best Practices for Extended Thinking

1. Choose the Right Effort Level

  • Low effort: Use for straightforward tasks like summarization, simple Q&A, or basic code generation. Saves tokens and reduces latency.
  • Medium effort: Good for most complex tasks like multi-step reasoning, moderate analysis, or debugging.
  • High effort: Reserve for very challenging problems like mathematical proofs, complex system design, or deep strategic analysis.

2. Set Appropriate max_tokens

When using extended thinking, the total output includes both thinking and final text. Set max_tokens high enough to accommodate both. A good rule of thumb:

  • For adaptive thinking with high effort: set max_tokens to at least 2x what you'd normally use.
  • For manual mode: max_tokens should be greater than budget_tokens by at least 1000 tokens for the final response.

3. Handle Thinking Content in Your Application

If you're displaying Claude's response to end users, you may want to:

  • Show the thinking content in a collapsible section for transparency
  • Use the thinking content to provide explanations for the final answer
  • Filter out thinking content if you only need the final answer

4. Streaming with Extended Thinking

Extended thinking supports streaming. When streaming, thinking blocks are delivered as separate events:

stream = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=4096,
    thinking={"type": "adaptive", "effort": "high"},
    messages=[{"role": "user", "content": "Solve this equation step by step: 3x + 7 = 22"}],
    stream=True
)

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="")

5. Migrating from Manual to Adaptive Thinking

If you have existing code using thinking: {type: "enabled", budget_tokens: N}:

  • Replace type: "enabled" with type: "adaptive"
  • Remove the budget_tokens parameter
  • Add an effort parameter based on your previous budget:
- budget_tokens < 2048effort: "low" - budget_tokens 2048-4096effort: "medium" - budget_tokens > 4096effort: "high"

Common Pitfalls to Avoid

  • Using manual mode on Opus 4.7: This will return a 400 error. Always use adaptive thinking.
  • Setting budget_tokens >= max_tokens: In manual mode, this causes an error. Ensure budget_tokens < max_tokens.
  • Ignoring thinking content: The thinking blocks contain valuable reasoning that can help you debug or verify Claude's logic.
  • Overusing high effort: Not every task needs maximum reasoning. Use lower effort levels to save costs and reduce latency.

Conclusion

Extended thinking is one of Claude's most powerful features, enabling deep reasoning that goes far beyond simple text generation. With the shift to adaptive thinking, Anthropic has made it easier than ever to get the right amount of reasoning for any task — without the guesswork of manual token budgets.

Whether you're building a tutoring app that shows step-by-step solutions, a code assistant that explains its logic, or an analysis tool that reasons through complex data, extended thinking gives you both the power and the transparency you need.

Key Takeaways

  • Adaptive thinking with the effort parameter is the recommended approach for all current Claude models, and the only option for Claude Opus 4.7.
  • Manual extended thinking (type: "enabled" with budget_tokens) is deprecated on Opus 4.6 and Sonnet 4.6, and unsupported on Opus 4.7.
  • Choose effort levels wisely: low for simple tasks, medium for most complex work, and high for the hardest problems.
  • Always set max_tokens high enough to accommodate both thinking and final response content.
  • Streaming support allows you to display thinking content incrementally for a better user experience.