BeClaude
GuideBeginnerBest Practices2026-05-15

Mastering Extended Thinking in Claude: Adaptive Thinking, Effort Control, and Best Practices

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

Quick Answer

This guide explains how to use Claude's extended thinking feature for complex reasoning tasks. You'll learn to enable adaptive thinking with the effort parameter on Claude Opus 4.7, configure manual thinking on older models, handle thinking content blocks in API responses, and apply best practices for token budgeting and streaming.

extended thinkingadaptive thinkingClaude APIreasoningeffort parameter

Mastering Extended Thinking in Claude: Adaptive Thinking, Effort Control, and Best Practices

Claude's extended thinking feature unlocks enhanced reasoning capabilities for complex tasks—from multi-step mathematical proofs to intricate code analysis. By giving Claude a dedicated "thinking budget," you can see its step-by-step internal reasoning before it delivers a final answer. This transparency not only builds trust but also helps you debug and refine your prompts.

In this guide, you'll learn how to enable and configure extended thinking across different Claude models, understand the new adaptive thinking mode, and apply best practices for production use.

---

What Is Extended Thinking?

When extended thinking is enabled, Claude produces thinking content blocks in its API response. These blocks contain the model's internal reasoning—chain-of-thought analysis, intermediate calculations, and logical deductions—before the final text block.

A typical 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 safety—you can validate that the thinking content hasn't been tampered with.

---

Adaptive Thinking vs. Manual Extended Thinking

Claude now supports two modes of extended thinking:

ModeDescriptionSupported Models
Adaptive thinking (type: "adaptive")Claude dynamically decides how many tokens to spend on reasoning based on the complexity of the task. You control the maximum effort via the effort parameter.Claude Opus 4.7 (recommended), Opus 4.6, Sonnet 4.6
Manual extended thinking (type: "enabled")You set a fixed budget_tokens limit. Claude uses up to that many tokens for reasoning.Claude Opus 4.6 (deprecated), Sonnet 4.6 (deprecated), Mythos Preview
Important: On Claude Opus 4.7, manual extended thinking (type: "enabled") is no longer supported and returns a 400 error. You must use adaptive thinking.

---

How to Enable Extended Thinking

Adaptive Thinking (Recommended for Opus 4.7, Opus 4.6, Sonnet 4.6)

Use the thinking object with type: "adaptive" and an effort parameter. The effort parameter accepts values like "low", "medium", or "high"—or you can specify a numeric token budget for fine-grained control.

Python example:
import anthropic

client = anthropic.Anthropic()

response = client.messages.create( model="claude-opus-4-7", max_tokens=4096, thinking={ "type": "adaptive", "effort": "high" # or "medium", "low", or a token budget integer }, messages=[ {"role": "user", "content": "Prove that the square root of 2 is irrational."} ] )

for block in response.content: if block.type == "thinking": print("Thinking:", block.thinking) elif block.type == "text": print("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: 'Prove that the square root of 2 is irrational.' } ] });

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

main();

Manual Extended Thinking (Legacy, for Opus 4.6 / Sonnet 4.6)

If you're using an older model, you can still set a fixed token budget:

response = client.messages.create(
    model="claude-opus-4-6",
    max_tokens=4096,
    thinking={
        "type": "enabled",
        "budget_tokens": 2048  # Claude will use up to 2048 tokens for thinking
    },
    messages=[
        {"role": "user", "content": "Explain the P vs NP problem in simple terms."}
    ]
)
Note: Manual mode is deprecated on Opus 4.6 and Sonnet 4.6. Migrate to adaptive thinking to ensure future compatibility.

---

The effort Parameter: Fine-Tuning Reasoning Depth

The effort parameter in adaptive thinking lets you control how much reasoning Claude applies to a task. You can use:

  • String values: "low", "medium", "high"
  • Numeric token budget: An integer representing the maximum tokens Claude can use for thinking
When to use each:
EffortUse Case
"low"Simple Q&A, quick lookups, low-complexity tasks
"medium"Balanced reasoning for most tasks
"high"Complex math, multi-step logic, code generation
Numeric budgetFine-grained control for cost-sensitive applications
Example with a numeric budget:
response = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=8192,
    thinking={
        "type": "adaptive",
        "effort": 4096  # Claude will use up to 4096 tokens for thinking
    },
    messages=[
        {"role": "user", "content": "Write a detailed proof of Fermat's Little Theorem."}
    ]
)

---

Streaming with Extended Thinking

Extended thinking works with streaming. You'll receive thinking delta events followed by text delta events. Here's how to handle them:

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": if event.delta.type == "thinking_delta": print(event.delta.thinking, end="") elif event.delta.type == "text_delta": print(event.delta.text, end="")

---

Best Practices for Extended Thinking

1. Set max_tokens Appropriately

Your max_tokens value must be greater than the thinking budget. Claude needs room for both thinking and the final answer. A good rule of thumb:

max_tokens = thinking_budget + expected_output_length

2. Use Adaptive Thinking for Cost Optimization

Adaptive thinking with effort: "medium" often provides the best balance between reasoning depth and token cost. Reserve "high" for tasks that genuinely require deep reasoning.

3. Validate Signatures in Production

Always verify the signature field in thinking blocks to ensure the reasoning hasn't been tampered with. Anthropic provides verification utilities in the SDK.

4. Handle Thinking Blocks in UI

If you're building a chat interface, consider showing thinking blocks in a collapsible section or as a "thinking..." indicator. This improves user experience by providing transparency without overwhelming the user.

5. Combine with Structured Outputs

Extended thinking pairs well with structured outputs. You can ask Claude to reason in the thinking block and then output a JSON object in the text block:

response = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=4096,
    thinking={"type": "adaptive", "effort": "high"},
    messages=[
        {
            "role": "user",
            "content": "Analyze this dataset and return a JSON object with 'mean', 'median', and 'conclusion'."
        }
    ]
)

---

Model-Specific Behavior

ModelExtended Thinking Support
Claude Opus 4.7Adaptive thinking only (type: "adaptive"). Manual mode returns 400 error.
Claude Opus 4.6Adaptive thinking recommended. Manual mode deprecated but functional.
Claude Sonnet 4.6Adaptive thinking recommended. Manual mode deprecated but functional (interleaved mode).
Claude Mythos PreviewAdaptive thinking is default. Manual mode accepted. type: "disabled" not supported.
---

Key Takeaways

  • Use adaptive thinking (type: "adaptive") with the effort parameter on Claude Opus 4.7—manual extended thinking is not supported on this model.
  • Control reasoning depth with effort: "low" | "medium" | "high" or a numeric token budget for fine-grained cost management.
  • Always set max_tokens higher than your thinking budget to leave room for the final answer.
  • Stream thinking blocks for real-time user feedback, and validate signatures in production to ensure integrity.
  • Migrate from manual to adaptive thinking on Opus 4.6 and Sonnet 4.6—manual mode is deprecated and will be removed in a future release.