Safeguard
Developer Tools•

Metering reasoning tokens: the hidden line in your LLM bill

Reasoning tokens are billed as output even when you only see a summary. Learn to meter them, cap them with effort or budgets, and avoid cut off answers.

Safeguard Security Team
3 min read

Reasoning tokens are billed as output tokens, so a short visible answer can hide a large cost. Meter them by reading the thinking token field in each response, track their share of output per feature, and control them with an effort setting or a fixed budget where your model supports one.

Why they are easy to miss

When a model reasons before answering, you may see only a summary of that reasoning or none at all. The cost still counts. The Claude extended thinking documentation describes a usage.output_tokens_details.thinking_tokens field that reports how many of the billed output tokens were internal reasoning. When streaming, that breakdown appears only on the final message_delta event, so a stream parser that stops early can miss it.

What to log

For every call, record:

  1. Input tokens, split into cached and uncached.
  2. Output tokens in total.
  3. Thinking tokens within the output.
  4. The model, the effort setting, and the feature name.

Then chart thinking tokens as a share of output per feature. A feature where reasoning is 90 percent of output is a candidate for a lower effort setting or a smaller model.

Ways to limit reasoning

  • Effort: on models with adaptive thinking, the effort setting is the recommended control for how deeply the model reasons.
  • Fixed budget: older models accept a budget_tokens value, with a minimum of 1,024. The docs call it a target, not a strict cap, and say max_tokens remains the hard ceiling on total output.
  • Model support changes: the docs say some newer models reject the fixed budget form with a 400 error and use adaptive thinking instead. Check the page for your model before you migrate.

Truncation risk

Thinking counts toward max_tokens, even when the thinking content is not returned. If max_tokens is too low, the model can use its allowance reasoning and cut the visible answer short. Treat truncation as a signal to raise max_tokens or lower effort, not as a quality bug.

Previous turns also cost

For conversations, the docs say newer models keep earlier turns' thinking blocks in context and bill them as input, while some older models strip them. A long agent loop on a newer model can therefore carry reasoning forward as input cost. Context editing can clear old thinking blocks, with a cache tradeoff described in the docs.

Keep the cache stable

Changing a fixed thinking budget between requests invalidates message level cache breakpoints. Pick a value and hold it for the life of a cached conversation.

Quick check

Are reasoning tokens cheaper than normal output tokens?

The documentation I fetched describes them as part of billed output tokens, so assume they cost the same as other output. Check your pricing page to be sure.

Where do I see the reasoning count when streaming?

On the final message_delta event. Read it before closing the stream.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.