CertSafari
    Anthropic Claude Certified Developer – Foundations (CCDV-F) - December 7 onwards· Lessons

    Domain 5 · Lesson 12/24

    Tokens, sampling, thinking and effort in Claude generation

    Generation Mechanics and Model Options

    17 min read
    4% of exam
    6 sources
    Published 18 Nov 2026
    Docs as of 18 Nov 2026

    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?

    Sources12

    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?

    Sources132

    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.

    A response with thinking: the thinking block (with its signature) precedes the text blockjson
    {
      "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?

    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?

    Sources32

    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.

    What each thinking value does on selected models ("at high or below" = works at low, medium and high effort; 400 at xhigh or max)
    ModelNo thinking field"enabled" with budget_tokens"between_tools""disabled"
    Claude Opus 5.5Adaptive thinking400 error400 error400 error
    Claude Sonnet 5.5Adaptive thinking400 errorUp-front thinking off at high effort or below400 error
    Claude Haiku 5.5Adaptive thinking400 error400 errorThinking off at high effort or below
    Claude Opus 5Adaptive thinking400 error400 errorThinking off at high effort or below
    Claude Sonnet 4.6Thinking offExtended thinking (deprecated)400 errorThinking off
    Claude Haiku 4.5Thinking offExtended thinking400 errorThinking 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.

    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?

    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?

    Sources34

    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.

    Setting effort on a request: it lives in output_config, beside max_tokensjson
    {
      "model": "claude-opus-5-5",
      "max_tokens": 4096,
      "output_config": { "effort": "medium" },
      "messages": [{ "role": "user", "content": "..." }]
    }
    How each effort level changes thinking behaviour
    LevelThinking behaviour
    maxThinks most readily and at greatest depth, with no constraint on thinking length
    xhighThinks more readily and deeper than high; suited to extended exploration
    highThinks on most requests that benefit; the default on most models
    mediumModerate thinking, may skip it for simple queries; the default on Claude Opus 5.5 and Claude Haiku 5.5
    lowMinimizes 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": "..." }]
    }

    Checkpoint 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?

    Sources456

    Sources

    (6)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 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. 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. 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. 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. 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

    Ready to test yourself?

    Practise Anthropic Claude Certified Developer – Foundations (CCDV-F) - December 7 onwards in quiz mode.

    Spotted a mistake, or was something unclear? Tell us.