What you will be able to do
- Account for every token a request consumes against the context window, max_tokens and the bill, including thinking tokens
- Explain why identical requests can produce different outputs, and why sampling parameters are not the lever for this on current models
- Configure thinking correctly per model, including migrating a budget_tokens request to adaptive thinking with effort
- Predict what changing the effort level will and will not change, and choose the right control for reply length versus reasoning depth
Key concept
Thinking tokens are output tokens — Whatever Claude reasons before answering is generated output: it consumes the max_tokens cap, occupies the context window and is billed at output rates, whether or not you see the text. Effort is the main dial that decides how many of those tokens a request spends.
1.Tokens and what fills the context window
Every behaviour in this lesson is measured in tokens, the units Claude reads and writes. A token can be a word, part of a word, a character or a byte. How many characters one token covers depends on both the model and the language. Claude 4.7 and later models use a newer tokenizer that produces roughly 30 percent more tokens for the same text. A prompt that fit comfortably on an older model therefore counts higher after a migration, even though not a word changed. Count the same request under both model IDs before you assume a budget still holds. The mechanics of the counting endpoint and cost estimates belong to cost diagnosis.
The context window is the model's working memory for one request, and the response itself sits inside it. The window includes the system prompt, every message (tool results, images and documents too) and your tool definitions. It also includes the output Claude generates on that turn, extended thinking included. On a long conversation each turn's input is the whole history plus the new message, so usage grows turn by turn. Current models such as Claude Opus 5.5, Sonnet 5.5 and Haiku 5.5 have a 1M-token window and can generate up to 128k output tokens per request. Other models, such as Claude Sonnet 4.5, have 200k. Picking between tiers is covered in model tier selection.
A bigger window is not a better prompt. As token count grows, accuracy and recall degrade, which is called context rot. What you choose to put in context matters as much as how much fits.
Checkpoint 1 of 9· Check yourself
A team estimates each request's context usage on Claude Sonnet 5.5 by adding up the system prompt and every message in the conversation. Requests still hit the context limit sooner than the estimate predicts. What did the estimate leave out?
The context window holds everything in the request, tool definitions included, plus the response generated on that turn, extended thinking included. An estimate built only from the system prompt and messages leaves out both. Training data is not part of the window, and thinking does not get a separate budget.
“The output Claude generates for the turn, including its extended thinking, counts too.”Source: platform.claude.com
2.Sampling and why identical requests diverge
Temperature controls how random the model's next-token choices are. Higher values give more varied phrasing, and in fiction more varied answers. Lower values keep to the most probable phrasing. Even at the low end, though, generation is not a lookup. With temperature at 0, identical inputs can still produce different outputs across API calls, on Anthropic's own service and through cloud providers alike. A test that asserts byte-identical output from a repeated call is testing something the API never promised.
On current models the request never reaches sampling. On Claude Opus 5.5, Opus 5, Sonnet 5.5, Sonnet 5, Haiku 5.5 and the Fable and Mythos models, any non-default temperature, top_p or top_k returns a 400 error, with or without thinking. The top_p default on these models is 0.99, so even top_p: 1 is rejected. From API version 2026-10-21, a request that includes any of the three parameters fails on every model. On older models and earlier API versions, the restriction applied only while thinking was on. So when an answer is too shallow, too long or too variable, the controls to reach for are the prompt, the thinking configuration and effort. Sampling parameters are not among them.
Adaptive thinking adds a second, observable source of variation. Claude decides on each request whether to think and how much, so thinking token usage, and with it output_tokens and latency, varies from request to request. Two runs of the same prompt can show different token counts, and that is expected behaviour, not a billing fault.
Checkpoint 2 of 9· Check yourself
Two runs of the same prompt on claude-opus-5-5, with identical parameters, report output_tokens of about 1,200 and about 4,800. Nothing in the request changed. What is the most likely explanation?
With adaptive thinking, Claude decides for each request how much to reason. Thinking tokens are billed as output, so output_tokens and latency vary between identical runs, and that is expected behaviour. Hidden thinking is still billed, effort does not change between runs on its own, and tokenization of the same text does not change from call to call.
“With adaptive thinking, Claude determines its thinking allocation dynamically, so thinking token usage varies from request to request.”Source: platform.claude.com
3.How thinking is generated, shown and billed
Thinking lets Claude work a problem through before it answers. It restates the question, tries approaches, checks intermediate results and drops dead ends. All of that arrives in thinking content blocks ahead of the text. This is why it helps on math, coding, analysis and long agentic tasks. Each thinking block carries a signature, an encrypted copy of the full reasoning, which you pass back unchanged in multi-turn and tool-use conversations.
{
"content": [
{
"type": "thinking",
"thinking": "Let me break this down. The question has two parts, so I'll start with the simpler one and use its result to constrain the second...",
"signature": "WaUjzkypQ2mUEVM36O2Txu...."
},
{
"type": "text",
"text": "Based on my analysis..."
}
]
}The thinking you can read is never the raw chain of thought. It is a summary. The display setting decides whether that summary comes back at all. On Claude 5 and later models it defaults to omitted, which returns thinking blocks with an empty thinking field until you opt in with display: "summarized". Billing is the same either way. A small visible summary next to a large output_tokens figure is normal and needs no surcharge to explain it. The full reasoning was generated, so it is billed as output, and it also counted against max_tokens.
Input billing for thinking appears only on later requests. On models that keep earlier thinking blocks (Opus 4.5 and later, Sonnet 4.6 and later, Haiku 5.5, Fable, Mythos), those blocks become conversation history. They count toward the window and are billed as input on each subsequent request. Older Opus and Sonnet models, and Haiku through 4.5, strip previous thinking blocks automatically when you pass them back. Either way, the thinking is billed as output once, on the turn that generated it.
Checkpoint 3 of 9· Check yourself
In a multi-turn conversation on claude-sonnet-5-5, Claude produces a large thinking block on turn 1, and your code passes that block back unchanged on every later request. How is that block's reasoning billed across the conversation?
Sonnet 4.6 and later Sonnet models keep earlier thinking blocks. The reasoning is billed as output once, on the turn that generated it, and the kept block is then billed as input on each later request. Stripping happens only on older Opus and Sonnet models and on Haiku through 4.5. The display setting does not change billing.
“On models that keep previous thinking blocks, the kept blocks are then part of later requests’ input and are billed as input tokens”Source: platform.claude.com
Checkpoint 4 of 9· Exam question
A finance team reads a response from a thinking-enabled request on claude-opus-5-5. The returned thinking summary is roughly 200 tokens, but usage.output_tokens is 1,900 and the invoice reflects it. They suspect a billing error. How should the team interpret this?
Correct answer: B — Summary generation is billed as a separate surcharge on top of the visible text, which accounts for the larger total
- A. You are billed for the full internal reasoning, not the summarized text returned.
usage.output_tokens_details.thinking_tokensreports how much ofoutput_tokenswas reasoning. - B. Summary generation carries no charge, so a surcharge cannot explain the gap between visible and billed tokens.
- C. Input tokens stay in
input_tokens. The thinking system prompt is an input matter and is never reported inside the output count. - D. Reasoning tokens are billed as output tokens at the output rate, so no discounted input-rate treatment applies to the hidden portion.
4.Configuring thinking on each model
On current models thinking is adaptive. The request does not set a token budget. Claude evaluates each request and decides whether to think and how deeply. A simple factual question may get no thinking block at all, while a hard debugging task gets a long one. The older style was "enabled" with budget_tokens. Claude 5-era models reject it, and they also differ on whether thinking can be turned off.
| Model | No thinking field | "enabled" with budget_tokens | "between_tools" | "disabled" |
|---|---|---|---|---|
| Claude Opus 5.5 | Adaptive thinking | 400 error | 400 error | 400 error |
| Claude Sonnet 5.5 | Adaptive thinking | 400 error | Up-front thinking off at high effort or below | 400 error |
| Claude Haiku 5.5 | Adaptive thinking | 400 error | 400 error | Thinking off at high effort or below |
| Claude Opus 5 | Adaptive thinking | 400 error | 400 error | Thinking off at high effort or below |
| Claude Sonnet 4.6 | Thinking off | Extended thinking (deprecated) | 400 error | Thinking off |
| Claude Haiku 4.5 | Thinking off | Extended thinking | 400 error | Thinking off |
The table explains a common migration failure. A request with thinking: {"type": "enabled", "budget_tokens": 8000} works on claude-sonnet-4-6 and returns 400 on claude-opus-5-5. The size of the budget does not matter: the API rejects the "enabled" type itself. Sending "disabled" does not fix it either, because Opus 5.5 cannot turn thinking off. The fix is {"type": "adaptive"}, or no thinking field at all, with reasoning depth set through output_config.effort. A beta header for interleaving is not needed: Claude already thinks between tool calls automatically under adaptive thinking.
Turning thinking down works differently on each model. Sonnet 5.5 rejects "disabled" but accepts "between_tools" at high effort or below. That drops up-front thinking while keeping progress updates between tool calls. Haiku 5.5 and Opus 5 accept "disabled" at high effort or below. Opus 5.5, Fable and Mythos cannot turn thinking off at all. On any of them, lowering effort is the first move toward less thinking.
Checkpoint 5 of 9· Match them up
Your team wants Claude to do less up-front thinking on routine requests. Match each model to how its thinking can be turned down.
Tap a term, then the definition that fits it.
Each model's lowest thinking setting is different. Opus 5.5 cannot turn thinking off, so effort is the lever. Sonnet 5.5 uses "between_tools" instead of "disabled". Haiku 5.5 accepts "disabled" at high effort or below. Sonnet 4.6 does not think unless you configure it to.
“Claude Sonnet 5.5 also has thinking on by default, and it rejects thinking: {type: "disabled"} with a 400 error.”Source: platform.claude.com
Checkpoint 6 of 9· Check yourself
After the model ID is switched from claude-sonnet-4-6 to claude-opus-5-5, a request containing thinking: {"type": "enabled", "budget_tokens": 8000} starts returning a 400 error. Which change makes the request work?
Opus 5.5 rejects the "enabled" type whatever the budget, and it also rejects "disabled". Adaptive thinking is the only accepted mode, and effort controls how deeply it reasons. No beta header is needed because adaptive thinking already interleaves with tool calls.
“Claude Opus 5.5 | Adaptive thinking | Adaptive thinking | 400 error | 400 error | 400 error”Source: platform.claude.com
Checkpoint 7 of 9· Exam question
An application sends thinking: {"type": "enabled", "budget_tokens": 8000} and worked on claude-sonnet-4-6. After the team switches the model ID to claude-opus-5-5, every request fails with a 400 error. What is the correct migration?
Correct answer: A — Replace the thinking object with {"type": "adaptive"} and steer reasoning depth with output_config.effort
- A. Models numbered 4.7 and later reject
type: "enabled"with a 400 error. Adaptive thinking plus an effort level replaces the token budget and is the documented migration path. - B. The minimum budget is 1,024 tokens, and an 8,000 value was already valid. The error comes from the thinking mode itself being unsupported, not from the budget size.
- C. Opus 5.5 has adaptive thinking always on, and a request that sets thinking to disabled is also rejected with a 400 error, so this swaps one error for another.
- D. The interleaved-thinking beta header has no effect on manual mode for these models and is ignored. It cannot make a rejected
type: "enabled"request valid.
5.Effort: what it controls and what it does not
Effort sets how many tokens Claude is willing to spend on a response. You set it at output_config.effort, not inside the thinking object. It covers every output token: thinking, text and tool calls. That is why it works with thinking on or off, and why lower effort also means fewer and terser tool calls. The five levels run from low to max, though not every model supports xhigh.
{
"model": "claude-opus-5-5",
"max_tokens": 4096,
"output_config": { "effort": "medium" },
"messages": [{ "role": "user", "content": "..." }]
}| Level | Thinking behaviour |
|---|---|
| max | Thinks most readily and at greatest depth, with no constraint on thinking length |
| xhigh | Thinks more readily and deeper than high; suited to extended exploration |
| high | Thinks on most requests that benefit; the default on most models |
| medium | Moderate thinking, may skip it for simple queries; the default on Claude Opus 5.5 and Claude Haiku 5.5 |
| low | Minimizes thinking; skips it for simple tasks where speed matters most |
Defaults change between models, and that alone can change behaviour. Earlier Opus models defaulted to high. Claude Opus 5.5 defaults to medium. A team that swaps only the model ID therefore runs one level lower without having asked for it: replies get faster and cheaper, and hard multi-step tasks get shallower reasoning. The fix is to set effort explicitly, chosen from an effort sweep on your own evals. Settings carried over from another model, even the same family's previous version, don't transfer, because levels are calibrated per model.
Effort is not a length knob. On Fable 5.2 and Opus 5, changing it does not reliably shorten visible replies. Ask for the length you want in the prompt instead.
Effort shapes tendencies, not guarantees. At every level Claude still decides per request whether to think. In a tool loop, the request right after new user input usually carries most of the reasoning, and follow-ups that only process tool results can skip thinking, even at max. Application code that assumes every assistant turn opens with a thinking block will break.
max_tokens is the hard ceiling on thinking plus reply. At high effort and above, set it large: for agentic coding on Sonnet 5.5 the guidance is the 128,000 maximum, with streaming. A cap that is too tight shows up as stop_reason: max_tokens, a reply cut off because thinking used the room it needed. Stop-reason handling in general belongs to Messages API mechanics.
Checkpoint 8 of 9· Fill the gap
This request should run claude-opus-5-5 at medium effort. Which key belongs in the blank?
{
"model": "claude-opus-5-5",
"max_tokens": 4096,
" ? ": { "effort": "medium" },
"messages": [{ "role": "user", "content": "..." }]
}Effort goes at output_config.effort, not inside the thinking object. It covers every output token: thinking, text and tool calls. That is why it works whether thinking is on or off.
Source: platform.claude.comCheckpoint 9 of 9· Exam question
On claude-fable-5-2, a team lowers effort from high to low hoping to get much shorter summaries. Thinking time drops, but the visible summaries are about the same length. What should they do to get shorter summaries?
Correct answer: A — Specify the target length and style in the prompt, and leave effort at low to keep the faster responses
- A. On this model, effort mainly controls how much it thinks, not how long the visible reply is. Asking for a specific length and style in the prompt is what shortens summaries, and effort can stay at
lowfor the speed gain. - B.
max_tokensis a hard ceiling, not a length instruction. The model does not plan a shorter summary around it, so output that reaches the cap is cut off mid-sentence. The result is truncated summaries, not concise ones. - C. Raising effort increases thinking and latency but does not make visible replies shorter. Lowering it already left summary length unchanged, so moving it to
maxgives slower responses with the same long summaries. - D. A period stop sequence halts generation at the first period, including one inside an abbreviation or a decimal number. Summaries end up as arbitrary fragments, not complete summaries written to a shorter length.
Sources
(6)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“For Claude, the number of characters a token represents depends on the model and the language.”
↩︎ Tokens and what fills the context window“use a newer tokenizer that produces approximately 30 percent more tokens for the same text than earlier models”
↩︎ Tokens and what fills the context window“Even with temperature set to 0, the results will not be fully deterministic, and identical inputs might produce different outputs across API calls.”
↩︎ Sampling and why identical requests diverge“Lower temperatures result in more conservative and deterministic outputs that stick to the most probable phrasing and answers.”
↩︎ Sampling and why identical requests diverge - 2.
“Everything in the request counts toward the context window: the system prompt, every message in messages”
↩︎ Tokens and what fills the context window“The output Claude generates for the turn, including its extended thinking, counts too.”
↩︎ Tokens and what fills the context window“A single request to any of them can generate up to 128k output tokens (max_tokens).”
↩︎ Tokens and what fills the context window“As token count grows, accuracy and recall degrade, a phenomenon known as context rot.”
↩︎ Tokens and what fills the context window“With adaptive thinking, Claude determines its thinking allocation dynamically, so thinking token usage varies from request to request.”
↩︎ Sampling and why identical requests diverge“On models that keep previous thinking blocks, the kept blocks are then part of later requests’ input and are billed as input tokens”
↩︎ How thinking is generated, shown and billed“Thinking tokens are a subset of your max_tokens parameter, are billed as output tokens, and count toward rate limits.”
↩︎ Key concept - 3.
“non-default temperature, top_p, or top_k values return a 400 error on every request, regardless of whether thinking is used”
↩︎ Sampling and why identical requests diverge“Starting with API version 2026-10-21, a request that includes temperature, top_p, or top_k at any value returns a 400 error on every model.”
↩︎ Sampling and why identical requests diverge“the tokens Claude spends reasoning are billed as output tokens, even when the thinking text isn’t returned to you”
↩︎ How thinking is generated, shown and billed“the text in a thinking block is a summary of Claude’s reasoning”
↩︎ How thinking is generated, shown and billed“Claude Opus 5.5 | Adaptive thinking | Adaptive thinking | 400 error | 400 error | 400 error”
↩︎ Configuring thinking on each model“Thinking can’t be turned off on these models.”
↩︎ Configuring thinking on each model“Claude Opus 5.5 | Adaptive thinking | Adaptive thinking | 400 error | 400 error | 400 error”
↩︎ Exam trap 1“non-default temperature, top_p, or top_k values return a 400 error on every request, regardless of whether thinking is used”
↩︎ Exam trap 3“Either way the block is billed the same and passed back the same in multi-turn conversations.”
↩︎ Exam trap 4“Claude Sonnet 5.5 also has thinking on by default, and it rejects thinking: {type: "disabled"} with a 400 error.”
↩︎ Checkpoint - 4.
“Thinking also interleaves with tool use automatically”
↩︎ Configuring thinking on each model“Effort is set at output_config.effort, not inside the thinking object”
↩︎ Effort: what it controls and what it does not“No level guarantees a thinking block on every request.”
↩︎ Effort: what it controls and what it does not - 5.
“Because effort applies to every output token, it works with or without thinking.”
↩︎ Effort: what it controls and what it does not“Claude Opus 5.5 supports all five effort levels, and medium is the default.”
↩︎ Effort: what it controls and what it does not“Run an effort sweep on your own evals rather than carrying settings over from an earlier model.”
↩︎ Effort: what it controls and what it does not“It’s a hard limit on total output (thinking plus response text).”
↩︎ Effort: what it controls and what it does not“Claude Opus 5 and earlier Opus models default to high, so a request that omits effort runs one level lower on Claude Opus 5.5.”
↩︎ Exam trap 2“Effort barely changes how long the model’s replies are, so use your prompt to change reply length and tone.”
↩︎ Prediction - 6.
“The response reached your max_tokens limit.”
↩︎ Effort: what it controls and what it does not