Direct answer
Reasoning tokens spend the same output allowance that must also hold the final answer. Official: extended-thinking tokens count toward max_tokens, so a cap can be consumed before a usable response appears. The documented minimum budget_tokens is 1,024, and newer models may use adaptive thinking instead of the older budget control.
Set the cap from observed traces, leave room for the answer and handle the returned stop reason before calling a response complete. Do not assume the thinking text shown in a client is a full token ledger. A longer cap is not a universal fix, because task scope, model behavior and tool calls still determine whether the result is useful.
What counts toward the output allowance
A response can contain more than visible prose. Depending on the model and request, output can include reasoning, a tool call and the final text. Those categories do not have separate unlimited allowances. Under the documented extended-thinking behavior, thinking tokens count toward max_tokens.
That creates a simple failure mode. A caller reserves most of the cap for reasoning, the model uses it, and little or no space remains for the answer. The request may be valid and the reasoning may be relevant while the returned content still looks cut off.
Official: the documented minimum budget_tokens is 1,024. This is a lower bound for the older budget control, not a recommended cap for every task. Newer models may use adaptive thinking, where the older budget setting is not the right control. The Claude model defaults and current model families source is the place to verify which behavior applies.
| Output category | What it represents | Why it matters for a cap |
|---|---|---|
| Input tokens | Prompt, instructions and supplied context | They are not part of the output allowance |
| Thinking tokens | Model reasoning under extended or adaptive thinking | They count toward max_tokens |
| Tool-call output | A structured request to invoke a tool | It also consumes output capacity |
| Final answer | User-facing text or result | It needs space left after other output |
| Usage totals | Counts returned by the API | They are stronger evidence than visible text alone |
The distinction between visible reasoning and token usage is important. A client may display a concise explanation, a summary or no reasoning at all. Unknown: the frozen evidence does not establish that every Claude Code surface exposes complete reasoning text or an itemized internal trace. Use returned usage and stop information rather than treating the display as a complete bill.
The Claude Code prompt-cache minimums article covers input reuse. Cache eligibility does not increase the output allowance. A cached prefix can reduce repeated input work under the service’s rules, but it does not give reasoning more room inside max_tokens.
Task scope affects the problem too. The Claude Code overengineering and diff scope guide recommends a bounded change surface. A broad request can invite more exploration, tool use and reasoning before an answer appears. Raising the cap for an undefined task may only delay the point at which the result becomes hard to review.
Why answers stop before they look finished
A response that ends because of a token cap is not the same as a response that ends normally. The stop reason tells the caller which situation occurred. Treating both as success can turn a truncated plan into an incomplete implementation.
Official: the supplied stop-reason documentation is the authority for continuation and completion handling. A max-token stop means the output allowance was reached. Normal completion means the model finished its turn under the request conditions. A tool-related stop means the agent needs to handle a tool action rather than treat the text as the final result.
| Returned situation | Safe interpretation | Next action |
|---|---|---|
| Normal turn completion | The model ended the response | Validate content and acceptance criteria |
max_tokens reached |
Output may be truncated | Do not mark complete; inspect usage and replan |
| Tool invocation requested | A structured action needs handling | Apply permissions, run the tool and return its result |
| Unclear or missing stop data | Completion is unverified | Save the trace and improve instrumentation |
Claude Code sits inside an agent loop, so a single model response is not always the whole task. The agent may read a file, call a tool, receive output and continue. A cap problem in one response can therefore appear as a stalled task, a partial edit or a summary that never arrives.
Do not repair that symptom by blindly increasing every cap. First identify whether the request reached its output limit, whether a tool result is pending or whether the task itself is too large. The Claude Code verification-done proof guide provides a useful standard: completion needs evidence, not a confident final sentence.
A response can also be syntactically complete but semantically incomplete. Code may parse while a required branch is missing. A migration plan may read cleanly while omitting the production apply step. Stop reasons protect against one class of failure; they do not replace review.
Separate transport success from task success in your own logs. A completed HTTP response only says that the service returned a result. It does not say that the result fits the requested artifact, that a pending tool call was handled or that tests passed. Store those as later states with their own evidence.
The same distinction helps during incident review. When several tasks end at the same cap after a model or configuration change, preserve the model ID and request shape before comparing them. A single broad task that truncates may point to scope instead. The frozen evidence does not provide a population-wide truncation rate, so a single report should not become a universal defect claim.
The Claude Code code-review bottleneck article explains why accepted changes matter more than generated volume. More output capacity can produce more material to inspect without producing more accepted work.
Cap planning starts with observed traces
A cap is a resource decision. Size it for the expected reasoning, tool call and answer, then verify what happened. Low caps can truncate the response. High caps can let a confused loop consume output before anyone notices.
For models using the older budget control, Official: budget_tokens has a documented minimum of 1,024. The budget must still leave room for the final response within max_tokens. These are different controls serving different purposes, and confusing them is a common source of empty answers.
For newer models with adaptive thinking, do not force the older budget model onto the request. Official: newer models may use adaptive thinking instead. Check the selected model’s documentation and the fields it accepts before changing configuration.
| Planning question | Evidence to collect | Decision |
|---|---|---|
| Which thinking control applies? | Exact model ID and current docs | Use budget control or adaptive behavior |
| How much output was used? | Returned usage by available category | Size the cap from traces |
| Why did the response stop? | Returned stop reason | Continue, handle a tool or replan |
| Was an answer present? | Final content and validation result | Accept only if complete |
| Did the task need narrowing? | Scope, files and tool sequence | Split work before raising the cap |
The Claude Code reasoning effort defaults guide covers a related control. Official: effort levels include low, medium, high, xhigh and max, with model-specific defaults. Effort and output allowance are not interchangeable. A high effort setting can still meet a low cap, and a large cap does not guarantee deeper or better reasoning.
Fast mode is another separate choice. The Claude Code fast-mode speed and cost article explains its latency and token-cost tradeoff. It should not be presented as a truncation fix. Speed changes how quickly output arrives, not whether the response fits the allowance.
Apply the Claude Code cost per verified change method when comparing cap settings. A larger cap that produces longer reasoning but more rework may lose to a smaller, well-scoped request.
Worked example: reserve room for the answer
The following example is Derived from stated assumptions. It is not a measured Claude Code trace or a recommended production cap.
Take a request that uses the older budget control and sets max_tokens to 3,072. Use the documented minimum budget_tokens of 1,024. Before tool-call output or final text, the arithmetic leaves 3,072 - 1,024 = 2,048 tokens of output capacity.
Now assume an observed response uses 2,600 thinking tokens. Derived: only 3,072 - 2,600 = 472 tokens remain for a tool call and the final answer. If a tool call consumes part of that remainder, the answer has even less room.
| Example line | Calculation | Result |
|---|---|---|
Assumed max_tokens |
Stated input | 3,072 tokens |
| Documented minimum budget | Official minimum | 1,024 tokens |
| Initial remainder | 3,072 - 1,024 |
2,048 tokens |
| Assumed observed thinking | Stated trace input | 2,600 tokens |
| Remaining after thinking | 3,072 - 2,600 |
472 tokens |
| Final-answer room | Remainder minus tool output | Unknown until measured |
The example shows why the minimum budget is not a cap plan. It also shows why a visible answer cannot be judged by length alone. A short answer may be appropriate, while an absent answer may indicate that other output consumed the allowance.
A safer response to the same trace has two stages. First, narrow the task or reduce unnecessary context. Second, set a cap from the observed distribution and require explicit stop-reason handling. Do not simply double the number and call the problem solved.
For a tool-using task, record the tool-call output separately when the route exposes it. The OpenAI versus Anthropic API format guide explains that response blocks and usage fields differ between formats. A parser that reads only the first text block can miss both a tool call and the real completion signal.
Use synthetic fixtures for cap tests. The Claude Code secrets in logs and transcripts guide explains why prompts and tool output can persist. A cap experiment does not need production secrets or private repository content.
A measurement checklist for truncation
A useful truncation test is small and repeatable. Choose a task with a known acceptance rule, record the exact model and request shape, then capture the stop reason and usage. Repeat after changing one variable at a time.
- Write the expected final artifact before running the task.
- Record the exact model ID and whether thinking is budgeted or adaptive.
- Save the request’s output cap and relevant thinking control.
- Capture returned usage, stop reason and final content.
- Check for pending tool calls before interpreting a partial answer.
- Classify the outcome as complete, truncated, tool-pending or unknown.
- Narrow the task before raising the cap when scope is the cause.
- Repeat with the same acceptance rule and compare rework.
| Measurement field | Why record it | Failure it exposes |
|---|---|---|
| Model ID | Determines thinking behavior and defaults | Applying the wrong control |
| Request shape | Makes the run reproducible | Hidden prompt or context changes |
| Output cap | Defines the resource boundary | Accidental truncation |
| Thinking control | Separates budgeted from adaptive models | Invalid or ignored settings |
| Stop reason | Explains why generation ended | Treating a cap hit as success |
| Usage totals | Shows actual output consumption | Guessing from visible text |
| Acceptance result | Measures useful output | Confusing volume with completion |
The Claude Code session handoff and team context guide helps when a truncated task must move to another session. Record the last verified state, the stop reason and the next action. A raw partial transcript is less useful than a brief that says what remains unproven.
Checkpoint coverage is not a substitute for this record. The Claude Code rewind and checkpoint limits article notes that Bash-only changes, subagent edits and external state are not fully tracked. A restored file does not prove that a database, queue or remote service returned to its earlier state.
Permissions also remain separate from output planning. The Claude Code MCP trust boundaries guide explains why a tool result is untrusted input. More output room does not authorize a tool action, and a requested tool call should still pass the relevant approval boundary.
When a larger cap is the wrong response
A larger cap makes sense when the task is well scoped, the trace shows legitimate output use and the final artifact needs more room. It is a poor response when the agent is exploring without a contract, repeating failed steps or reading unrelated files.
The Claude Code overengineering and diff scope guide recommends allowed files and stop conditions. Apply that contract before increasing output. A narrow task often needs less reasoning because the agent does not have to invent the scope.
A repeated tool loop is another warning. If the agent requests the same action, receives an unhelpful result and continues, extra capacity may fund more repetition. Inspect the tool contract and the acceptance rule first. The Claude Code dependency-install side effects guide is relevant when package commands create unexpected network or script behavior.
Reasoning depth can be tuned separately. Official: the effort documentation lists model-specific defaults and a ladder from low to max. Use the Claude Code reasoning effort defaults guide to build a task matrix, then measure quality, latency and cost together.
A security-sensitive task may need more explicit scope rather than more silent reasoning. The Claude Code security-research refusal workflow article explains authorization and lab boundaries. Output capacity does not grant permission to test a target.
Destructive work needs the same caution. The Claude Code database migration safety guide separates planning, generation, review and production apply. A cap should never be used to push an agent past a human-controlled migration boundary.
Control the loop before increasing the cap
An agent loop repeats a sequence: send context, receive output, handle any tool action, then continue. Low caps can interrupt that sequence. High caps can give a confused sequence more room to repeat itself. The useful control is a stop condition tied to the task, not just a larger number.
Write the condition before the run. Bug fixes might require a failing reproduction, a focused patch and a passing regression test. Documentation changes might require an updated section and a check that every referenced path exists. The Claude Code proof-of-work packet explains how to attach evidence to that condition.
Count consecutive unproductive turns separately from total output. Three turns that repeat the same failed hypothesis are a different problem from one long reasoning pass. The frozen evidence does not supply a universal turn limit, so choose a local limit and record why it fits the task. Treat the number as an operating rule, not an Anthropic recommendation.
Tool output can also inflate the next request. A command that prints a large log may leave the agent with more context but less direction. Narrow the command, filter the result or move the investigation to a smaller fixture. The Claude Code PowerShell path quoting guide is a reminder that shell behavior can create noisy failures before the model even responds.
When a run stops, preserve a compact recovery note. Include the model, cap, stop reason, last verified file state and the next unproven step. Do not paste the entire reasoning display into the handoff. The Claude Code session handoff and team context guide explains why decisions and constraints travel better than raw transcripts.
Honest loss and data gaps
The concrete win is a defensible completion check. Callers can distinguish normal completion, a max-token stop and a pending tool action. That prevents a truncated response from being counted as finished work.
The concrete loss is that a correct cap cannot guarantee a correct answer. Even within the allowance, the model can still produce a weak plan, an incomplete edit or a test that repeats its own assumption. Review and acceptance remain necessary.
Unknown: the frozen evidence does not provide a universal thinking-token ratio, a recommended max_tokens value for Claude Code or a complete view of reasoning exposed by every client. It also does not establish that every newer model uses identical adaptive behavior. Those details require the selected model’s documentation and a controlled trace.
Update the cap policy when model defaults or thinking controls change. Keep old traces with their model IDs so a later comparison does not mix different behavior into one average.
The practical implication is to make truncation a visible state in your own tooling. On a max-token stop, a caller should preserve partial output for diagnosis but refuse to mark the task complete. Pending tool calls should return to the permission and execution path. Missing stop information should produce an uncertainty report rather than a guess.
That classification can be simple. Store an outcome label beside the run, link the supporting trace and require a reviewer to confirm the final artifact. Over time, the labels show whether caps are too low, tasks are too broad or tool results are too noisy. They also prevent a dramatic partial response from being mistaken for a model-quality trend.
Practical alternative: test output behavior on an explicit route
One AI API Key offers an active OpenAI-format lane for a controlled agent comparison. On 2026-11-27, the 46 live free model IDs spanned 22 families. The free IDs shared 100 requests and 5,000,000 tokens per day per account, resetting at 05:30 IST or 00:00 UTC. Accounts could have up to three keys, with one request in flight per key on free models.
Use an OpenAI-format agent such as OpenCode, Cline or Cursor with https://api.oneaiapikey.com/v1, one key and a selected free ID. The endpoint quickstart shows the base URL and first request. Review the prepaid pricing before a paid test; the frozen evidence says new accounts received $10 credit without a card.
Do not use the free IDs in Claude Code. They are OpenAI-format only. Claude Code’s documented route uses the Anthropic Messages format, but all four Claude IDs were unavailable on 2026-11-27. The coding-agent API key compatibility guide explains the boundary.
A cross-provider output test needs provider-specific controls. Do not copy a Claude thinking budget into an OpenAI-format request and assume equivalent behavior. Record each route’s actual parameters, stop signal and usage fields, then compare accepted work with the cost per verified change framework.
Limit the experiment with per-key caps, expiry and model allowlists, and read the gateway privacy and retention policy before sending code. The honest loss is that another agent may expose different traces and may not reproduce Claude Code’s tool loop. A clean token comparison is useful, but it is not proof of workflow equivalence.
Choose the next diagnosis by failure mode
When the problem is missing context rather than missing output room, start with the Claude Code session handoff and team context and Claude Code compaction context-retention test. The Claude Code mobile Remote Control limits and Claude Code offline-mode boundaries cover access constraints.
Scope and side effects need separate checks. Read the Claude Code gitignored-file deletion risks, Claude Code database migration safety and Claude Code dependency-install side effects guides before granting broad execution. The Claude Code rewind and checkpoint limits article explains recovery boundaries.
Security failures are not cap failures. Untrusted instructions and executable configuration appear in the Claude Code repository prompt injection, Claude Code MCP trust boundaries and Claude Code plugin security audit guides. Retained sensitive material belongs to the Claude Code secrets in logs and transcripts article.
Platform and network symptoms can look like stalled generation. Local setup belongs to the Claude Code Linux ARM and headless login, Claude Code macOS Keychain permissions and Claude Code PowerShell path quoting guides. Connectivity belongs to the Claude Code network storm and NAT retry diagnosis, Claude Code corporate proxy TLS and mTLS and Claude Code outage status and failover articles.
Plan economics belong in a different decision. Billing products are separated in the Claude Code annual plan lock-in analysis, Claude Code Max and Ultra tier value, Claude Code fast-mode speed and cost and Claude Code Batch API versus subscription guides. Input eligibility belongs to the Claude Code prompt-cache minimums article.
For delivery and governance, read the Claude Code code-review bottleneck, Claude Code AI attribution and provenance and Claude Code generated-code license compliance guides. The Claude Code game-development IP restrictions article covers reported task boundaries rather than token limits.
FAQ
Do thinking tokens count toward max_tokens?
Yes. Official Claude documentation states that extended-thinking tokens count toward max_tokens, so the cap must leave room for the final response.
What is the minimum thinking budget?
The documented minimum budget_tokens is 1,024 for the older budget control. It is not a universal recommendation, and newer models may use adaptive thinking instead.
Why did Claude stop without a final answer?
A max-token stop can consume the allowance before the answer appears. Check the stop reason and usage, then narrow the task or adjust the cap from observed traces.
Is all reasoning visible in Claude Code?
Do not assume so. The frozen evidence does not establish complete reasoning visibility on every surface. Returned usage and stop information are safer evidence than the displayed text.
Can the 46 free gateway IDs handle Claude Code thinking requests?
Not through Claude Code. Those IDs are OpenAI-format only and require an OpenAI-format agent. All four Claude IDs on the documented Claude Code route were unavailable on 2026-11-27.