Topic 2 of 4 · 5 min read
Paying for hidden reasoning tokens
Goal: Explain from a usage record why a short answer cost many output tokens and set limits that prevent truncated answers.
Thinking tokens are output tokens you pay for, and they share the same output limit as the answer. A three-line reply can cost thousands of tokens, and a low limit can leave you with no reply at all.
Check yourself · 1 of 3
A reasoning model returns a 40-word answer, but the usage record shows 1,500 output tokens. What explains the gap?
Why it matters
Two bugs come from forgetting this. The first is a bill that is far larger than the visible text suggests. The second is a truncated or empty answer, because the model spent the whole limit on thinking.
Where the tokens show up
The usage record is the source of truth. On OpenAI, usage.output_tokens includes reasoning, and usage.output_tokens_details.reasoning_tokens shows how many of them were hidden thinking. Claude reports thinking inside output_tokens, and Gemini reports a separate thoughts count in its usage metadata. Field names differ, so read your vendor's usage object once and write down where thinking appears.
Raw thinking is often not what you get back. Claude returns a summary of the thinking, yet you are billed for the full thinking tokens the model generated, not for the summary you can read. So the visible thinking text will not add up to the token count. That is expected.
Limits that include thinking
max_tokens on Claude and max_output_tokens on OpenAI cap thinking plus answer together. If thinking reaches the cap, the response ends early. OpenAI marks it status: "incomplete" with incomplete_details.reason set to max_output_tokens, and may return no visible text. OpenAI's guide suggests reserving at least 25,000 tokens for reasoning and output when you start experimenting with a reasoning model.
What to do
- Log input, output and reasoning tokens for every call.
- Set the output limit with room for thinking, then lower it only after you see real usage.
- Check the stop reason or status. Treat
incompleteor a max-tokens stop as an error to handle, not as an answer. - To spend less, lower effort first. Shrinking the cap truncates the answer and does not make thinking cheaper.
Before and after
# Before: a tight cap that thinking can eat entirely
resp = client.responses.create(
model=MODEL, input=prompt, max_output_tokens=300,
)
print(resp.output_text) # may be empty
# After: room for thinking, and the status is checked
resp = client.responses.create(
model=MODEL, input=prompt, max_output_tokens=8000,
reasoning={"effort": "low"},
)
if resp.status == "incomplete":
raise RuntimeError(resp.incomplete_details.reason)
What goes wrong
- Counting only visible text. Cost forecasts built from answer length come out far too low.
- Tiny caps for "short" answers. The answer is short, but the thinking is not.
- Ignoring incomplete status. The app shows a blank or cut-off answer as if it were final.
Examples
Reading a usage record
{
"status": "completed",
"usage": {
"input_tokens": 75,
"output_tokens": 1186,
"output_tokens_details": { "reasoning_tokens": 1024 },
"total_tokens": 1261
}
}
The answer itself is about 162 tokens (1186 minus 1024). The other 1,024 were reasoning, billed at the output rate. A forecast based on answer length would be about seven times too low for this call.
The empty answer
A function sets max_output_tokens=300 and calls a reasoning model for a two-line summary. Thinking uses all 300 tokens. The response arrives with status: "incomplete" and no text. The fix is a larger cap and a status check, not a retry loop on the same limit.
Key points
- Reasoning tokens are billed as output tokens, even when you never see them.
- The output limit covers thinking and the visible answer together, so a low cap can produce an empty reply.
- Read the usage object to find where your vendor reports reasoning tokens, such as reasoning_tokens on OpenAI.
- Claude returns summarised thinking but bills the full thinking tokens, so the visible text understates the cost.
- Check the stop reason or incomplete status on every call and handle it as an error.
Common mistakes
- Estimating cost from the visible answer length alone.
- Setting a small max-tokens value because the expected answer is short.
- Treating an incomplete or max-tokens response as a finished answer.
- Trying to cut cost by shrinking the cap instead of lowering effort.
Check yourself · 2 of 3
What does max_output_tokens limit on an OpenAI reasoning model?
Check yourself · 3 of 3
A reasoning call keeps coming back incomplete with no text. What is the best first fix?
Practice items, not counted towards your mastery.
Start here
- Effort (Claude) (opens in a new tab)DocsFree
The output_config.effort levels, which models support them and how effort shapes thinking depth, latency and cost.
- Building with extended thinking (Claude docs) (opens in a new tab)DocsFree
The manual budget_tokens rules (minimum 1,024, below max_tokens), tool-use behaviour and the move to adaptive thinking.
- Steering thinking and cost (Claude) (opens in a new tab)DocsFree
How adaptive thinking decides when to think, how to steer it, and how thinking tokens are billed.
More for this topic
- Reasoning models (OpenAI API docs) (opens in a new tab)DocsFree
Source for reasoning_tokens in usage, the incomplete status and the advice to reserve output space.