BeClaude
GuideBeginnerAPI2026-05-20

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

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

Quick Answer

This guide explains how to use Claude's extended thinking feature to enhance reasoning for complex tasks. You'll learn the difference between adaptive thinking (recommended for Opus 4.7) and manual extended thinking, how to set effort parameters and budget tokens, and see practical API code examples in Python and TypeScript.

extended thinkingadaptive thinkingClaude APIreasoningbudget tokens

Introduction

Claude's extended thinking feature unlocks deeper reasoning capabilities for complex tasks. When enabled, Claude produces internal reasoning steps before delivering its final answer, and you can choose how much of that reasoning to expose. This guide covers everything you need to know: supported models, configuration options, code examples, and best practices.

Whether you're building a research assistant, a code analysis tool, or a multi-step reasoning agent, extended thinking gives Claude the runway it needs to produce more accurate and thoughtful responses.

How Extended Thinking Works

When extended thinking is turned on, the API response includes special thinking content blocks before the final text content blocks. Each thinking block contains Claude's internal reasoning and a cryptographic signature for verification.

Here's the default response structure:

{
  "content": [
    {
      "type": "thinking",
      "thinking": "Let me analyze this step by step...",
      "signature": "WaUjzkypQ2mUEVM36O2TxuC06KN8xyfbJwyem2dw3URve/op91XWHOEBLLqIOMfFG/UvLEczmEsUjavL...."
    },
    {
      "type": "text",
      "text": "Based on my analysis..."
    }
  ]
}

The thinking content blocks appear before the text blocks, and Claude uses the reasoning from those blocks to inform its final answer.

Adaptive Thinking vs. Manual Extended Thinking

Claude offers two modes for extended thinking:

Adaptive Thinking (Recommended)

Adaptive thinking lets Claude dynamically decide how much reasoning to use based on the complexity of the task. This is the recommended approach for Claude Opus 4.7 and newer models. You control the reasoning depth using the effort parameter.

Effort levels:
  • low: Minimal reasoning, faster responses
  • medium: Balanced reasoning and speed
  • high: Maximum reasoning depth

Manual Extended Thinking (Deprecated)

Manual mode requires you to set a fixed budget_tokens value. This is no longer supported on Claude Opus 4.7 and will return a 400 error. It is deprecated on Claude Opus 4.6 and Claude Sonnet 4.6.

Supported Models

ModelAdaptive ThinkingManual Extended ThinkingNotes
Claude Opus 4.7✅ Recommended❌ Returns 400 errorUse thinking: {type: "adaptive"} with effort
Claude Opus 4.6✅ Recommended⚠️ Deprecated but functionalMigrate to adaptive
Claude Sonnet 4.6✅ Recommended⚠️ Deprecated but functionalInterleaved mode deprecated
Claude Mythos Preview✅ Default✅ Acceptedthinking: {type: "disabled"} not supported; use display: "summarized" for summaries

How to Use Extended Thinking in the API

Python Example

import anthropic

client = anthropic.Anthropic()

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": "Analyze the following code for potential security vulnerabilities: [code here]" } ] )

Access thinking blocks

for block in response.content: if block.type == "thinking": print("Reasoning:", 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 analyzeCode() { const response = await 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: [code here]' } ] });

for (const block of response.content) { if (block.type === 'thinking') { console.log('Reasoning:', block.thinking); } else if (block.type === 'text') { console.log('Final answer:', block.text); } } }

Manual Extended Thinking Example (Legacy Models Only)

For Claude Opus 4.6 or Claude Sonnet 4.6 (deprecated but functional):

response = client.messages.create(
    model="claude-opus-4-6",
    max_tokens=4096,
    thinking={
        "type": "enabled",
        "budget_tokens": 16000  # Maximum tokens for reasoning
    },
    messages=[
        {"role": "user", "content": "Solve this complex math problem..."}
    ]
)

Controlling the Display of Thinking Content

By default, Claude returns full thinking content in the response. You can control what's shown using the display parameter:

  • display: "full" (default): Returns the complete reasoning
  • display: "summarized": Returns a summary of the reasoning (useful for Claude Mythos Preview)
  • display: "omitted": Does not return thinking content in the response (Claude still reasons internally)
Example with summarized display:
response = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=4096,
    thinking={
        "type": "adaptive",
        "effort": "high",
        "display": "summarized"
    },
    messages=[
        {"role": "user", "content": "Explain quantum entanglement in simple terms."}
    ]
)

Best Practices

1. Use Adaptive Thinking for New Models

Always prefer thinking: {type: "adaptive"} for Claude Opus 4.7 and newer models. Manual budget_tokens is deprecated and will break on Opus 4.7.

2. Match Effort to Task Complexity

  • Low effort: Simple Q&A, quick lookups
  • Medium effort: Standard analysis, code review
  • High effort: Complex reasoning, multi-step problems, research

3. Set Appropriate max_tokens

Your max_tokens value should be at least as large as your thinking budget. For adaptive thinking, set max_tokens high enough to accommodate both reasoning and final output.

4. Handle Thinking Blocks in Your Application

If you're streaming responses or building a UI, remember that thinking blocks appear before text blocks. You may want to display them differently (e.g., as an expanding "Show reasoning" section).

5. Use Signatures for Verification

The signature field in thinking blocks allows you to cryptographically verify that the thinking content came from Claude. This is useful for audit trails and compliance.

Common Pitfalls

  • Using manual mode on Opus 4.7: This will return a 400 error. Always use adaptive thinking.
  • Setting budget_tokens too low: Claude may stop reasoning prematurely, leading to incomplete analysis.
  • Forgetting to handle thinking blocks: If your code only processes text blocks, you'll miss the reasoning content.
  • Not updating max_tokens: If your thinking budget exceeds max_tokens, Claude will truncate the response.

Key Takeaways

  • Adaptive thinking (thinking: {type: "adaptive"}) is the recommended approach for Claude Opus 4.7 and newer models, with effort controlling reasoning depth.
  • Manual extended thinking (thinking: {type: "enabled", budget_tokens: N}) is deprecated on Opus 4.6 and Sonnet 4.6, and returns a 400 error on Opus 4.7.
  • Use the display parameter to control whether full reasoning, summaries, or no thinking content is returned.
  • Always set max_tokens high enough to accommodate both reasoning and final output.
  • Handle thinking content blocks in your application code to access or display Claude's reasoning process.