BeClaude
GuideBeginnerAPI2026-05-21

Mastering Extended Thinking in Claude: A Practical Guide to Adaptive & Manual Reasoning

Learn how to enable and optimize Claude's extended thinking feature for complex reasoning tasks. Covers adaptive thinking, manual mode, budget tokens, and code examples.

Quick Answer

This guide explains how to use Claude's extended thinking feature to unlock step-by-step reasoning for complex tasks. You'll learn the difference between adaptive and manual modes, how to set budget tokens, and see practical API examples for Python and TypeScript.

extended thinkingadaptive thinkingClaude APIreasoningbudget tokens

Introduction

Claude's extended thinking feature is one of its most powerful capabilities for tackling complex, multi-step problems. When enabled, Claude produces an internal reasoning trace before delivering its final answer—giving you insight into how it arrived at a conclusion. This is invaluable for debugging, auditing, and building trust in AI-driven decisions.

This guide covers everything you need to know: from the basics of enabling extended thinking to advanced configurations like adaptive thinking, budget tokens, and handling the response format. Whether you're building a research assistant, a code analysis tool, or a decision-support system, mastering extended thinking will dramatically improve your results.

How Extended Thinking Works

When extended thinking is activated, Claude generates thinking content blocks in the API response. These blocks contain the model's internal reasoning, followed by the final text content block. The response structure 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 purposes—you can cryptographically verify that the thinking content hasn't been tampered with.

Adaptive Thinking vs. Manual Extended Thinking

Claude offers two modes for extended thinking:

Adaptive Thinking (Recommended for Claude Opus 4.7 and newer)

Adaptive thinking lets Claude decide how much reasoning to perform based on the complexity of the task. You control the effort level rather than a fixed token budget. This is the only supported mode on Claude Opus 4.7.

Key parameters:
  • thinking: {type: "adaptive"} — enables adaptive thinking
  • effort — controls reasoning depth (e.g., "low", "medium", "high")

Manual Extended Thinking (Deprecated on newer models)

Manual mode lets you set a fixed token budget for reasoning. It's still functional on Claude Opus 4.6 and Claude Sonnet 4.6, but is deprecated and will be removed in future releases.

Key parameters:
  • thinking: {type: "enabled", budget_tokens: N} — enables manual mode with a token limit
  • budget_tokens — maximum tokens Claude can use for reasoning

Model-Specific Behavior

ModelRecommended ModeNotes
Claude Opus 4.7Adaptive onlyManual mode returns a 400 error
Claude Mythos PreviewAdaptive (default)Also accepts manual mode; disabled not supported
Claude Opus 4.6Adaptive (recommended)Manual mode deprecated but functional
Claude Sonnet 4.6Adaptive (recommended)Manual mode deprecated; interleaved mode deprecated

How to Use Extended Thinking in the API

Python Example (Adaptive Thinking)

import anthropic

client = anthropic.Anthropic()

response = client.messages.create( model="claude-opus-4-7", max_tokens=4096, thinking={ "type": "adaptive", "effort": "high" }, messages=[ { "role": "user", "content": "Analyze the following code for potential security vulnerabilities and suggest fixes:\n\ndef login(username, password):\n query = f\"SELECT * FROM users WHERE username='{username}' AND password='{password}'\"\n return db.execute(query)" } ] )

Print the thinking trace

for block in response.content: if block.type == "thinking": print("=== Thinking ===") print(block.thinking) elif block.type == "text": print("=== Final Answer ===") print(block.text)

TypeScript Example (Manual Mode - Legacy)

import Anthropic from '@anthropic-ai/sdk';

const client = new Anthropic();

const response = await client.messages.create({ model: 'claude-sonnet-4-6', max_tokens: 4096, thinking: { type: 'enabled', budget_tokens: 2000 }, messages: [ { role: 'user', content: 'Design a scalable architecture for a real-time chat application serving 1 million concurrent users.' } ] });

// Extract thinking and final answer const thinkingBlocks = response.content.filter(b => b.type === 'thinking'); const textBlocks = response.content.filter(b => b.type === 'text');

console.log('Reasoning:', thinkingBlocks.map(b => b.thinking).join('\n')); console.log('Answer:', textBlocks.map(b => b.text).join('\n'));

Best Practices for Extended Thinking

1. Choose the Right Mode

  • Use adaptive thinking for most cases—it's simpler and future-proof.
  • Use manual mode only if you need strict control over reasoning token usage (legacy models only).

2. Set Appropriate Budget Tokens

  • For manual mode, start with budget_tokens equal to 20-30% of your max_tokens.
  • Complex tasks (e.g., code review, mathematical proofs) may need 50% or more.
  • Simple tasks (e.g., summarization) can use a smaller budget.

3. Handle the Response Correctly

  • Always iterate over content blocks—don't assume the first block is the answer.
  • Verify thinking content signatures if you need tamper-proof guarantees.

4. Combine with Structured Outputs

  • Extended thinking works well with structured outputs (e.g., JSON mode). The thinking trace will still appear before the final structured response.

5. Monitor Token Usage

  • Extended thinking consumes tokens from your max_tokens budget. If you set budget_tokens: 2000 and max_tokens: 4096, Claude has 2096 tokens left for the final answer.

Common Pitfalls

  • Forgetting to set thinking parameter: Without it, Claude won't produce a thinking trace.
  • Using manual mode on Claude Opus 4.7: This returns a 400 error. Always use adaptive thinking.
  • Setting budget_tokens too low: Claude may truncate its reasoning, leading to incomplete analysis.
  • Ignoring the signature field: If you need to prove the thinking content is authentic, verify the signature.

Conclusion

Extended thinking is a game-changer for complex AI tasks. By enabling Claude to show its work, you gain transparency, trust, and often better results. Start with adaptive thinking for new projects, and only use manual mode if you have specific legacy requirements.

Key Takeaways

  • Extended thinking reveals Claude's step-by-step reasoning before the final answer, improving transparency and trust.
  • Adaptive thinking (type: "adaptive") is the recommended mode for Claude Opus 4.7 and newer models; manual mode is deprecated.
  • Budget tokens control how much Claude can reason—set them wisely based on task complexity.
  • Always iterate over content blocks in the response to extract both thinking and final answer.
  • Combine extended thinking with structured outputs for powerful, auditable AI applications.