Extended Thinking
Some problems need Claude to work through the steps before answering. Extended thinking is the mechanism for that — a visible reasoning phase you can turn on, tune, and read — but it costs tokens and time you shouldn't spend on easy requests.
Extended thinking is Claude's scratch paper. On a tricky word problem, you don't just blurt out a number — you jot the steps down, cross a few things out, then copy the final answer neatly onto the answer line. Extended thinking makes that scratch paper visible: Claude gets a separate space to work things out before it writes the answer you actually see. For a question like "what color is the sky," nobody reaches for scratch paper — that's exactly where extended thinking would be wasted effort.
What the thinking phase actually is
☺ Like you're 10: It's the difference between showing your work on a math test and just writing the answer — except here, you get to decide whether to look at the work at all.
When extended thinking is active, Claude's response can include a thinking content block alongside the usual text block — a record of the reasoning it did before committing to an answer. This is different from ordinary chain-of-thought prompting, where you ask Claude to narrate its steps inside the answer itself. With extended thinking, the reasoning is a distinct, structured part of the response you can inspect, log, or hide from end users, separate from the final answer text.
Anthropic's current model family splits into two different implementations of this idea, and which one you get depends entirely on the model:
| Model | Thinking mode | How it's controlled |
|---|---|---|
| Claude Fable 5 | Adaptive thinking, always on | Model decides depth per query; not configurable off |
| Claude Opus 5 | Adaptive thinking, on by default | Model self-decides; supports forced tool use alongside it |
| Claude Sonnet 5 | Adaptive thinking | thinking: {"type": "adaptive"} |
| Claude Haiku 4.5 | Manual extended thinking | thinking: {"type": "enabled"} |
Fable 5, Opus 5, and Sonnet 5 support adaptive thinking: the model itself decides whether and how much to reason, based on the query's apparent complexity. Haiku 4.5 is the exception — it supports the older, manual extended-thinking mode (thinking.type: "enabled") instead of adaptive thinking. A handful of legacy models (Opus 4.8, Opus 4.7, Sonnet 4.5) remain active for migration and also use the manual mode. Before wiring this into a real project, check the live Models Overview page — Anthropic ships new models frequently, and thinking support is one of the specs most likely to shift between releases.
Turning it on
Enabling manual extended thinking on a model that supports it, like Haiku 4.5, just means adding a thinking object to your request:
import anthropic
client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY from env
message = client.messages.create(
model="claude-haiku-4-5",
max_tokens=4000,
thinking={"type": "enabled"},
messages=[
{
"role": "user",
"content": (
"A train leaves Station A at 60 mph. Thirty minutes later, "
"a second train leaves Station A on the same track at 90 mph. "
"How far from Station A do they meet?"
),
}
],
)
for block in message.content:
if block.type == "thinking":
print("--- reasoning ---")
print(block.thinking)
elif block.type == "text":
print("--- answer ---")
print(block.text)
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic(); // reads ANTHROPIC_API_KEY from env
const message = await client.messages.create({
model: "claude-haiku-4-5",
max_tokens: 4000,
thinking: { type: "enabled" },
messages: [
{
role: "user",
content:
"A train leaves Station A at 60 mph. Thirty minutes later, a second " +
"train leaves Station A on the same track at 90 mph. How far from " +
"Station A do they meet?"
}
]
});
for (const block of message.content) {
if (block.type === "thinking") {
console.log("--- reasoning ---", block.thinking);
} else if (block.type === "text") {
console.log("--- answer ---", block.text);
}
}
On a model with adaptive thinking, like Sonnet 5, the shape is nearly identical — swap the model ID and the type:
message = client.messages.create(
model="claude-sonnet-5",
max_tokens=4000,
thinking={"type": "adaptive"},
messages=[{"role": "user", "content": "..."}],
)
With adaptive thinking, Claude decides for itself when a query warrants reasoning and how much — the depth scales with what the query actually needs rather than a fixed setting you dial in per request. The Claude Agent SDK exposes a separate, coarser-grained lever for tuning this across an agentic session: an effort parameter with levels low/medium/high/xhigh/max, which nudges how much a model reasons over the course of a task.
If you're working through this in VS Code, drop each snippet into a Jupyter cell (or the integrated terminal) with ANTHROPIC_API_KEY set in a .env file, then toggle thinking on and off on the same prompt. Watching the token count and latency change side by side is a faster way to build intuition than reading about it.
When it earns its cost, and when it doesn't
☺ Like you're 10: Scratch paper helps on long division. It doesn't help if someone asks what color the sky is — you already know, so pulling out paper just wastes time.
Extended thinking is not free — a visible reasoning phase means more tokens generated before Claude ever produces the text you actually wanted, which means more latency and more cost on every model's per-token pricing. The judgment call is whether that spend buys you anything.
It tends to pay off on tasks where getting the intermediate steps right is exactly what determines whether the final answer is right: multi-step math and logic problems, planning tasks with several interacting constraints, and requests where the requirements are ambiguous enough that Claude benefits from working through what's actually being asked before committing to an approach. It tends to be wasted on tasks without meaningful intermediate steps: simple factual lookups, short creative replies, or classification into a small fixed set of labels — the kind of task where the "reasoning" would just be padding around an answer Claude could have produced directly.
A support-ticket triage pipeline needs to decide, across a dozen interacting factors (account tier, sentiment, prior tickets, SLA remaining), which of three teams should own an escalation and in what order to route it. Reserve extended thinking here — the decision genuinely has multiple steps worth getting right.
Classifying a single incoming email as "spam" or "not spam" with thinking: {"type": "enabled"} turned on. There's no multi-step reasoning to surface — you're paying for a visible thought process on a task that's one lookup deep, on every request, at scale.
Don't reflexively pair thinking with a "verify your answer before finishing" instruction. On Claude Opus 5 specifically, the model already self-verifies well; adding an explicit verification instruction can cause it to over-verify, adding latency without a corresponding accuracy gain. The guidance there is to remove the instruction rather than adapt it.
Foxy: I turned on extended thinking for everything — spam filters, sentiment tags, all of it. Safety first, right?
Professor Owl: Safety isn't free, Foxy. Every thinking block is tokens you're paying for and time your user is waiting through — on tasks that don't have real steps to work out.
Foxy: But what if a hard one sneaks in disguised as an easy one?
Sol the Sloth: Then you go slow on purpose, just for those. Save the scratch paper for problems that actually have steps — spam-or-not doesn't have any.
Thinking alongside tool calls
☺ Like you're 10: It's like being told "pick any toy" versus "you must pick the red truck." Manual thinking mode handles "pick any toy" just fine, but it can't be forced into one specific toy while it's still turning things over in its head.
A response's content array can hold thinking blocks and tool-use blocks together in the same turn — Claude can reason about which tool to call, or how to interpret a tool's result, as part of the same visible thinking phase, rather than that reasoning being invisible.
One constraint worth knowing before you combine the two: with manual (non-adaptive) extended thinking, only tool_choice: {"type": "auto"} and tool_choice: {"type": "none"} are compatible — forcing a specific tool with {"type": "any"} or {"type": "tool", "name": "..."} returns an error. Adaptive thinking doesn't have this restriction: models where it's on by default, like Opus 5, do support forced tool use alongside thinking. If you're building a tool-calling flow on Haiku 4.5 (manual thinking) and need to force a specific tool, you'll need to turn thinking off for that call, or restructure the flow around auto.
There's also a prompting-side connection worth knowing: putting <thinking> tags inside your few-shot examples — showing Claude a worked reasoning pattern before the answer — teaches it to generalize that same style into its own extended-thinking output. When thinking is unavailable or turned off, manual step-by-step prompting (explicit "think step-by-step" instructions, or structured <thinking>/<answer> tags) is positioned as the fallback technique for getting the same benefit without the model-level feature.
Pick one multi-step reasoning prompt (a word problem, or a plan with several dependent steps) and one trivial classification prompt (sentiment: positive/negative/neutral). Run each twice on a model that supports thinking — once with it enabled, once without — and compare the thinking block output, total token usage, and whether the final answer actually changed. You should see the reasoning task benefit meaningfully; the classification task should look like wasted tokens.
You should now be able to explain what a thinking content block is and how it differs from ordinary chain-of-thought prompting, tell adaptive thinking (Fable 5, Opus 5, Sonnet 5) apart from manual thinking (Haiku 4.5 and the legacy models) and how each is switched on, and judge when the extra tokens are actually worth spending. Next, see how thinking output pairs with predictable response shapes in Structured Outputs.
Check your answers
- What is a thinking content block, and how does it differ from asking Claude to "think step by step" in the prompt?: It's a distinct, structured block that Claude's response can include alongside its text block — separate from and inspectable apart from the final answer, rather than reasoning narrated inline inside the answer text itself.
- How do you turn on thinking for Sonnet 5 versus Haiku 4.5, and why the difference?: Sonnet 5 uses adaptive thinking via
thinking: {"type": "adaptive"}, where the model decides depth itself; Haiku 4.5 uses manual thinking viathinking: {"type": "enabled"}, because it doesn't support the adaptive mode that Fable 5, Opus 5, and Sonnet 5 do. - Why skip extended thinking on a spam/not-spam classifier, and what's the one restriction to remember when combining thinking with tool use?: Skip it because there's no multi-step reasoning to surface on a one-lookup task — thinking would just add tokens, latency, and cost. With manual (non-adaptive) thinking,
tool_choiceonly supportsautoandnone; forcing a specific tool returns an error, though adaptive thinking doesn't have that limit.