AI Coding Agents
Reasoning effort and token cost in coding agents
Reasoning effort affects token cost by steering how much work a model does before or between visible responses. Anthropic, OpenAI, and Gemini charge for generated thinking at output pricing. Claude models that keep prior thinking also bill it as input on later turns, so estimate the full task using token usage, cache behavior, and the rate of accepted edits.
What gets billed when the model thinks
As of November 30, 2026, all three providers include internal reasoning in the cost of generating a response. Each describes that charge a little differently.
- Anthropic lists “Tokens Claude uses while thinking (billed as output tokens)” in its cost breakdown. The breakdown also distinguishes the full internal thinking from the summary Claude can return. Changing the display setting leaves the reasoning bill the same, and Anthropic lists summary generation as having no charge. Anthropic’s thinking cost guide
- OpenAI says reasoning tokens “still occupy space in the model’s context window and are billed as output tokens.” The Responses API reports this as a breakdown of output usage, so adding the reasoning count to the reported output total would double-count it. OpenAI’s reasoning guide
- Gemini says “response pricing is the sum of output tokens and thinking tokens” when thinking is on. The same page exposes the generated thinking count as
interaction.usage.total_thought_tokens. Use that count when the response contains a short thought summary or only the final answer. Gemini’s thinking guide
For coding agents, the visible response can be a poor proxy for output cost. An agent might return a narrow patch with a short explanation after spending a large share of its output budget comparing possible fixes. A run that ends before it delivers an edit can still use billable reasoning. Keep the provider’s output total for billing and record the reasoning count alongside it to explain why that total moved. If you need a refresher on the categories, start with input tokens vs. output tokens.
The other billable event is history replay. Anthropic says Claude models that keep all prior thinking carry old blocks into the next request’s context and bill them as input. This includes Sonnet 5.5. Earlier models in its last-turn-only group strip older thinking automatically. With prompt caching, a preserved block served from cache is counted as cached input. The same reasoning can therefore incur an output charge when generated and several input charges as later requests reuse it. Use the appropriate input class on each request. Claude thinking and preservation
How to configure effort on each provider
| Provider surface | Effort control | What to check before changing it |
|---|---|---|
| Anthropic Messages API | output_config.effort has low, medium, high, xhigh, and max across supported models. | The usual default is high. Opus 5.5 and Haiku 5.5 default to medium. Check model support for the upper levels. |
| OpenAI Responses API | reasoning.effort values are model-dependent. The guide lists possible values from none and minimal through low, medium, high, xhigh, and max. | Defaults also vary. GPT-6.2 Astra and Sol reject none. |
| Gemini | thinking_level steers thinking. The Gemini guide lists low, medium, high, and xhigh for Gemini 4 Neon and Hydrogen. | Both default to high. Vertex AI documents that the deprecated thinking_budget returns 400: INVALID_ARGUMENT on Gemini 4. |
On Claude, effort is a behavioral control for the whole response. It can change the thinking volume, text, tool calls, and arguments. With adaptive thinking, Claude decides whether and how much to think for a request. If you’re migrating a Claude 4.7 or later integration, remove the old budget_tokens configuration for manual extended thinking. The deprecated mode returns a 400 on those models. On models that accept an explicit adaptive setting, request thinking.type of adaptive and set effort independently. Opus 5.5 keeps thinking on and rejects thinking.type of disabled at every effort. Lower effort and disabling thinking are separate controls. Claude effort, Claude extended thinking, Claude thinking
OpenAI recommends initially reserving at least 25,000 tokens for reasoning and outputs when experimenting with reasoning models. Treat that as capacity advice. A small edit can use far fewer tokens, but a tight max_output_tokens ceiling can cut a run off after billable reasoning and before an answer appears. For a comparison, give both effort levels enough room to finish and track incomplete responses separately. Once you’ve measured the workload, adjust the buffer to fit it. OpenAI’s reasoning guide
For Gemini, move off thinking_budget when migrating the Vertex AI configuration. Vertex AI marks it deprecated on Gemini 3 and later and documents an error if you send both controls together. Choose a supported thinking_level for the model and product surface you’re actually calling. An effort label borrowed from another provider has no common token allocation. Vertex AI thinking, Gemini thinking
When comparing two settings, record the resolved model and effort together. For example, leaving effort unset would start Opus 5.5 and Sonnet 5.5 from different documented defaults. If you later change a default in your agent, those records let you tell which runs used the old policy. Keep request ceilings visible in the same record. If a run reaches its ceiling, check whether it finished the requested edit before deciding it was a cheap success. Claude effort, OpenAI’s reasoning guide
What a published coding benchmark shows
Anthropic reported that Claude Opus 4.5 at medium effort matched Claude Sonnet 4.5’s best SWE-bench Verified score with 76% fewer output tokens. That’s a vendor result for those models and that benchmark. It compares output token use at the reported scores and gives no input or cache cost for your workflow. It does show why testing model and effort together can be more revealing than climbing the effort scale on one model. Anthropic’s Opus 4.5 announcement
An agent that spends more reasoning on the first step might finish in fewer tool calls or avoid a retry. To see whether that pays off, use a task outcome you can inspect, such as a patch passing its focused tests and staying within the requested files. Include rejected attempts in the numerator when calculating cost per accepted task. Otherwise the policy that retries more often can look cheaper on paper.
Estimate a simple edit across three requests
Suppose an agent updates a validation message, checks the relevant test, and reports the result. Assume 8,000 ordinary uncached input tokens and 1,000 non-reasoning output tokens across the run. Assume the initial response generates 300 thinking tokens at low effort or 1,800 at high effort on either model. Assume both follow-ups generate zero new thinking. These are scenario inputs for the arithmetic. Hold the ordinary input, output, and number of calls fixed so that the effect of thinking is visible.
The rates used here, as of November 30, 2026, are $2 per million uncached input tokens and $10 per million output tokens for both Sonnet 5.5 and GPT-6.2 Sol. Multiply each token category by its rate, add the products, and divide by one million. For Sonnet, assume the retained thinking from the initial response is billed as uncached input on both follow-ups. Anthropic documents that thinking blocks can be cached automatically on tool-result follow-ups, even without explicit cache markers. Treat the uncached replays as the higher-cost case for reading those blocks. Claude API rates, Claude thinking and caching, ByteCosts pricing index
OpenAI’s reasoning guide documents reasoning.context with all_turns for the GPT-5.6 family and GPT-6.1 Sol. It leaves GPT-6.2 Sol’s handling of prior reasoning unspecified in that section. The Sol estimate prices newly generated reasoning. Use observed input and cache totals on the follow-ups to price the full run. OpenAI’s reasoning guide
| Model and effort | Initial thinking tokens assumed | Total output tokens | Later retained thinking priced in this estimate | Estimated USD cost |
|---|---|---|---|---|
| Claude Sonnet 5.5 low | 300 | 1,300 | 600 | $0.0302 |
| Claude Sonnet 5.5 high | 1,800 | 2,800 | 3,600 | $0.0512 |
| GPT-6.2 Sol low | 300 | 1,300 | Outside estimate | $0.0290 |
| GPT-6.2 Sol high | 1,800 | 2,800 | Outside estimate | $0.0440 |
Compare low and high effort within each model. The Sonnet totals include two reads of prior thinking, and the Sol totals omit any prior-reasoning input. Comparing the models on total price requires pricing the same categories for both.
For Sonnet at high effort, the arithmetic is (8,000 × $2 + 2,800 × $10 + 2 × 1,800 × $2) / 1,000,000 = $0.0512. Of that, an estimated $0.0072 comes from replaying the thinking. If the same two replays are already cached, Sonnet 5.5 charges $0.10 per million cached read tokens. At that rate, the marginal read estimate for the high-effort thinking is 2 × 1,800 × $0.10 / 1,000,000 = $0.00036. Any cache writes are separate charges, and this substitution leaves the ordinary input assumption alone. For current dollar rates, see the AI provider pricing index.
The low versus high difference has two components on Sonnet in this example. The high run generates 1,500 more reasoning tokens and then replays those extra tokens twice. If both runs succeed with the same number of requests, the extra spending buys no verified improvement for this task. If low effort needs another attempt, add that attempt’s entire input and output bill before deciding. In a task where the agent opens more files or runs broader tests at higher effort, those tool results may also increase later input. Compare the request sequence, so you can distinguish an increase in generated thinking from an increase in the work that thinking prompted.
When testing effort changes inside a conversation, keep the product distinction explicit. In the Claude API, a top-level effort change can invalidate message-level breakpoints on any model. It can also affect tool and system breakpoints on Opus 5, Sonnet 5, Fable 5, Mythos 5, and earlier effort-capable models. Where per-message effort is supported, an effort change carried in a role: "system" message inside messages leaves the cached prefix intact. Claude Code separately documents cache preservation across effort changes on Fable 5.1 and later, Opus 5.5, Sonnet 5.5, and Haiku 5.5 with an API key or Claude subscription. Changing effort still recomputes the request on Amazon Bedrock, Google Cloud’s Agent Platform, or a Claude apps gateway. It also recomputes the request when CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS is set or the organization has a HIPAA configuration. Check cache usage before attributing a cost change to new thinking alone. Claude API thinking and caching, Claude Code caching
Set a default for each task class
Start low on mechanical edits with a clear file, a narrow change, and a focused test. Trial medium or high on ambiguous debugging or changes that span several components. Reserve the upper supported levels for work where the lower setting misses a genuine dependency or produces a patch that fails the acceptance checks. Keep the initial model, task prompt, and verification the same within each comparison. Where a task escalates, charge the retry and any cache rebuild to the original task.
Record Anthropic’s usage.output_tokens_details.thinking_tokens, OpenAI’s usage.output_tokens_details.reasoning_tokens, and Gemini’s returned thinking usage. Also record total output, input and its cache breakdown, latency, tool calls, and acceptance. For Anthropic streaming, collect the thinking breakdown from the final message_delta. Look for a pattern across similar tasks before changing the default. A larger thinking count only earns its place when the accepted results justify the extra billed tokens and time.
A practical rollout starts with a default and an explicit escalation condition. For a file-local edit, let a passing focused test and a clean diff end the task. If a test reveals an unclear dependency outside the requested scope, try a higher supported effort on that diagnosis and record the reason. For a cross-component change, keep quality gates on the integrated result, since a patch can satisfy a narrow test and still fail the wider requirement. Count the work through that final check when you decide whether to promote a setting.
Start with a small batch of your ordinary edits and a separate batch of debugging tasks that need investigation. Use the effort router to turn the measured defaults into task rules, and thinking blocks and prompt caching to diagnose changes in billed input during follow-up turns.
Sources
- Steering thinking and cost (Anthropic, accessed 2026-11-30)
- Thinking (Anthropic, accessed 2026-11-30)
- Extended thinking (Anthropic, accessed 2026-11-30)
- Effort (Anthropic, accessed 2026-11-30)
- Claude API pricing (Anthropic, accessed 2026-11-30)
- Claude Code prompt caching (Anthropic, accessed 2026-11-30)
- Introducing Claude Opus 4.5 (Anthropic, accessed 2026-11-30)
- Reasoning models (OpenAI, accessed 2026-11-30)
- Gemini thinking (Google, accessed 2026-11-30)
- Thinking in Vertex AI (Google Cloud, accessed 2026-11-30)
Interactive report
- The Hidden Thinking Bill: Two agents can return the same brief answer and leave very different bills. Follow the tokens they generate, the history they carry forward, and what happens when you change effort mid-task.
How this note was produced
Drafted with AI assistance from committed ByteCosts pricing snapshots and deterministic cost formulas. Figures are grounded in the linked sources (last updated 2026-11-30). Read our editorial & automation policy, inspect the methodology, or report a discrepancy.
Reasoning effort and token cost in coding agents. ByteCosts. Updated 2026-11-30. https://bytecosts.com/blog/thinking-token-cost-effort-levels/