Understanding reasoning and extended thinking
Why some models think out loud before answering, when that helps and when it just burns money. With the exact parameter you set in the API.
In lesson 1 you learned chain of thought. You write "think step by step" into the prompt and the model exposes its intermediate steps. For years that was a trick you had to trigger yourself. Today many models can do it on their own, in a dedicated mode you switch on and off as a developer. It is called extended thinking, or with some providers simply reasoning. I notice that many people do not know the difference between "I ask the model to think" and "I switch on a real reasoning mode". That is exactly what this is about.
The core is simple. A normal model reads your prompt and immediately produces the answer token by token. A model with extended thinking does an intermediate round first. It generates a block of thoughts, sorts the problem, discards dead ends, and then writes the actual answer. Those thoughts are real tokens, they cost money, and depending on the model you see them summarised or not at all. The effect is measurable on anything that needs several steps: maths, code debugging, chains of logic, plans with dependencies.
When is it worth it? Rule of thumb from practice: when the task has one right and many wrong answers and the route there is not obvious. A tax edge case with three conditions. A SQL query joining across four tables. A bug that only shows up under a particular race condition. There reasoning brings real accuracy. When it is not worth it: text summaries, rewrites, simple classification, tone adjustment. There the model thinks about something that has no hard solution at all, and you pay for tokens that improve nothing.
The parameter you actually set
With the Anthropic Messages API you control this through a field called thinking. With older models like Sonnet 4.5 or Opus 4.5 it looks like this:
{
"model": "claude-sonnet-4-5",
"max_tokens": 4096,
"thinking": {
"type": "enabled",
"budget_tokens": 8000
},
"messages": [
{ "role": "user", "content": "Solve this logic puzzle..." }
]
}
The budget_tokens is the ceiling for the thinking block. Interesting point: this value may be larger than max_tokens, because thinking and the answer are separate budgets. Thinking for 8000 tokens and then answering in 4096 tokens is a perfectly legitimate setup.
With the newer models this changed, and that is the point where most old tutorials are wrong. Opus 4.6 and Sonnet 4.6 no longer use budget_tokens. There thinking.type: "enabled" with a fixed budget is deprecated. Instead you set thinking.type: "adaptive" and control the depth through an effort parameter. The model then decides for itself how long it thinks, depending on the difficulty of the task. With Opus 4.7 and Opus 4.8 that is even the only way, manual budget_tokens is no longer accepted there.
{
"model": "claude-opus-4-8",
"max_tokens": 4096,
"thinking": { "type": "adaptive" },
"messages": [
{ "role": "user", "content": "Plan a migration..." }
]
}
Why this switch? A fixed token budget is always a compromise. Set it too low and the model thinks too briefly on hard tasks. Set it too high and you burn money on easy ones. Adaptive thinking solves that by coupling the depth to the task. You only give the rough direction, via effort. More effort means the model may think longer if it deems that necessary.
Since Opus 5 from 24 July 2026 the path has gone one step further: there thinking is the default, you no longer have to set anything at all. So a request without a thinking field does think. Two consequences you should know. First, max_tokens counts the thinking, it is a hard ceiling for thinking plus answer together. If you are coming from an older model where the same request ran without thinking, raise the limit. Second, disabling still exists, but only up to effort level high. The combination thinking: {"type": "disabled"} with effort xhigh or max gets a 400 from the API. The details are in the playbook Opus 5 migration.
Interleaved thinking, when tools are involved
There is a special case that becomes important as soon as your model calls tools. Normally the model thinks once at the start and then answers. With interleaved thinking it may think again between individual tool calls. It calls a tool, sees the result, thinks about it, calls the next tool. That is exactly the behaviour you want for an agent planning several steps.
It is activated through a beta header:
anthropic-beta: interleaved-thinking-2025-05-14
This also makes clear why budget_tokens may be larger than max_tokens. With interleaved thinking the budget is the sum across all thinking blocks in a single assistant turn, not per block. If your agent calls five tools in a row and thinks briefly before each, that adds up.
A detail that often causes confusion: the header anthropic-version: 2023-06-01 is still correct in 2026 too. That is the version of the API, not a date that has anything to do with the model. Do not let it irritate you, you set it exactly like that, with Opus 4.8 as well.
What you do with this day to day
Three concrete patterns I see again and again.
First, reasoning deliberately only for hard paths. In an app processing many different requests, you do not switch extended thinking on globally. You first classify the request with a cheap call without thinking, and only when the task is rated "complex" do you send it to a model with reasoning enabled. That often saves more than half the cost.
Second, couple effort to the user class. When a free user asks a question, low effort. When a paying user asks the same question, higher. Quality scales with what you can afford per request.
Third, log the thoughts but do not ship them. The thinking block is gold for debugging. When the model gives a wrong answer, you often see in the reasoning exactly where it took the wrong turn. You store that in your logs but do not show it to the end user. They want the answer, not the monologue.
One last honest note. Extended thinking is no magic bullet. It makes a model more accurate on tasks with a clear solution, but it does not make a model more creative and not more honest. If the model does not know something, with reasoning it walks past the wrong answer just as confidently, only at greater length. The hallucinations from lesson 2 of level 1 do not disappear because of it. They are sometimes even presented with better justification. Reasoning is a tool for accuracy, not a substitute for checking the answer.
What next
You now understand the difference between a chain-of-thought prompt and a real reasoning mode, and you know the parameter you set for it in the API. The next lesson is about system prompts and how you steer a model's behaviour beyond the individual request. If you want to go deeper into the current models, look at the model landscape 2026 lesson in level 1, it says which model supports which thinking mode.
Source
- Extended thinking docs: https://platform.claude.com/docs/en/build-with-claude/extended-thinking
- Effort parameter: https://platform.claude.com/docs/en/build-with-claude/effort
- Migration guide for the new models: https://platform.claude.com/docs/en/about-claude/models/migration-guide