Concept Intermediate · 3 min read

What is extended thinking in Claude API

Quick answer
Extended Thinking in the Claude API is a feature that enables the model to perform multi-step reasoning by internally generating and refining intermediate thoughts before producing a final answer. It improves complex problem-solving by allowing the AI to 'think through' tasks in a structured way.
Extended Thinking is a feature in the Claude API that enables multi-step internal reasoning to improve complex task completion.

How it works

Extended Thinking works by letting the Claude model internally generate a chain of intermediate reasoning steps, akin to a human thinking aloud before answering. Instead of producing a direct response, the model breaks down the problem, evaluates sub-steps, and refines its reasoning internally. This process enhances accuracy and coherence for complex queries.

Concrete example

The following example shows how to enable Extended Thinking in the Anthropic Python SDK by setting the think parameter to True. This triggers the model to perform multi-step reasoning internally.

python
import anthropic
import os

client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])

response = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=500,
    system="You are a helpful assistant.",
    messages=[{"role": "user", "content": "Explain the steps to solve a quadratic equation."}],
    think=True  # Enables Extended Thinking
)

print(response.content[0].text)
output
1. Identify coefficients a, b, and c in ax^2 + bx + c = 0.
2. Calculate the discriminant: D = b^2 - 4ac.
3. If D > 0, two real roots: (-b ± sqrt(D)) / (2a).
4. If D = 0, one real root: -b / (2a).
5. If D < 0, two complex roots.
6. Return the roots accordingly.

When to use it

Use Extended Thinking when your application requires the AI to handle complex, multi-step reasoning tasks such as math problem solving, logical deduction, or detailed explanations. Avoid it for simple queries where direct answers suffice, as it may increase latency and token usage.

Key Takeaways

  • Extended Thinking enables Claude to internally reason through multiple steps before answering.
  • Activate it by setting the think parameter to True in the Anthropic SDK.
  • Ideal for complex tasks requiring detailed, stepwise problem solving or explanations.
  • Avoid for simple queries to reduce latency and token consumption.
Verified 2026-04 · claude-3-5-sonnet-20241022
Verify ↗