Reasoning tokens count against max_output_tokens. A 2,000 cap cut 293 of 600 synthetic requests and wasted 70.5 percent of billed output. Size caps from measurements.
An empty answer that still cost money
Dinky's team moved the refund-reconciliation step of the Belgavi's Book Store help desk to a reasoning model and kept the max_output_tokens setting the old model used: 2,000 tokens, plenty for a 600-token answer. Some requests came back with no text at all. The orchestration code read the empty string as a valid answer and posted an empty note to the case. The bill for those requests was not empty.
The cause is documented. OpenAI's reasoning guide, in the version archived on 18 November 2026, says reasoning tokens are not visible through the API but occupy context and are billed as output tokens, and that max_output_tokens limits everything the model generates, reasoning included. If generation reaches that limit, the response has status incomplete with incomplete_details.reason set to max_output_tokens, and this can happen before any visible output is produced, so input and reasoning tokens are paid for without a visible response. The guide recommends reserving at least 25,000 tokens for reasoning and outputs when starting out, then adjusting from the reasoning token counts reported in usage.output_tokens_details.reasoning_tokens.
That is two separate engineering jobs: choose the cap from measurements, and treat an incomplete response as its own outcome.
A synthetic workload to reason about
The companion example uses no provider. It draws synthetic reasoning-token counts for three request classes, 200 requests each, seeded so the arithmetic is repeatable. One assumption is stated in the code because it matters: a request's reasoning length is treated as independent of the cap. Real models may behave differently under different settings, so the numbers below show how the accounting works, not how any model behaves.
A separate calibration sample of the same size gives these reasoning-token percentiles:
| Class | Median | 95th percentile | Largest |
|---|---|---|---|
| Order lookup | 309 | 648 | 1,050 |
| Return policy question | 1,832 | 4,244 | 8,050 |
| Refund reconciliation | 6,547 | 19,445 | 42,309 |
The tail is long. A cap that fits the median of the hardest class cuts off a large share of it, and even the 95th percentile is far below the largest request.
Five cap policies on the same 600 requests
| Policy | Cut before any answer | Cut mid-answer | Share of billed output spent on cut responses |
|---|---|---|---|
| Fixed 2,000 | 278 | 15 | 70.5% |
| Fixed 2,000, retry once at 4,000 | 278 | 15 | 71.9% |
| Fixed 25,000 | 3 | 0 | 3.2% |
| Per class, 95th percentile plus answer, plus 20% | 9 | 2 | 4.8% |
| Per class, then retry once at double | 9 | 2 | 5.8% |
The 2,000 cap fails every refund reconciliation and nearly half the policy questions. Most failures are cut before any visible text, the case that produced empty notes. Seventy percent of the output tokens billed under this policy bought nothing. Retrying once at twice the cap rescues 97 of the 293 failures and makes the waste share slightly worse, because each retry pays for the reasoning again from scratch.
The most useful line is the comparison between the fixed 25,000 cap and the per-class caps. Their total billed output is almost the same, about 2.34 million against 2.33 million tokens. That is not a coincidence: a cap only costs money on requests that reach it. A request that finishes in 3,000 tokens is billed 3,000 tokens whether the cap is 5,500 or 25,000. Raising a cap that is too low does not raise the bill for requests that already fit; it stops paying for requests that were going to be thrown away.
So why set per-class caps at all? Because the cap is the only bound on a runaway request. In the calibration sample the largest refund reconciliation reasoned for over 42,000 tokens. With a cap of 24,100 for that class it fails fast, at a known maximum cost and latency, and the code can decide what to do, rather than letting a single request run as long as the model allows.
Treat incomplete as an outcome, not an answer
def classify(resp):
if resp['status'] == 'completed':
return 'answer'
if resp.get('incomplete_details', {}).get('reason') == 'max_output_tokens':
return 'cut_before_answer' if resp['visible_tokens'] == 0 else 'cut_mid_answer'
return 'other_incomplete'The rule for the caller is short:
- Never pass the text of an incomplete response to the next step as if it were an answer. A partial refund calculation is worse than none.
- Record the reason, the class, the cap and the reported reasoning tokens. These records are the calibration data for the next cap.
- Retry at most once, with a larger cap, and only when the class's measured tail says a larger cap is likely to finish. Otherwise route the case to a person or a different workflow.
- Count the cost of incomplete responses separately on the dashboard. The waste share is the number that tells you a cap is wrong.
A response can be incomplete for other reasons; one of the guide's code samples also checks for a content-filter reason. Keep those apart from the budget case, because retrying a filtered request with a larger cap will not help. The same guide notes that current reasoning models can interleave visible output with thinking, so an incomplete response may carry some text; the classifier above treats any cut response as unfinished either way.
Measure, then set the cap
- Send a calibration sample of real requests, grouped by class, with a generous cap such as the 25,000 the guide suggests, and record
reasoning_tokensand visible output tokens for each. - For each class, set the cap to a high percentile of reasoning plus the largest expected answer, with a margin. The example uses the 95th percentile, the largest answer and 20%.
- Check the share of incomplete responses on live traffic against what the calibration predicted, by class.
- Recalibrate when the model, reasoning effort setting, prompt or tool set changes. Each of these can move the distribution.
- Keep the cap below the context window minus the input, or the context limit will cut the response before the cap does.
Verification
The example's tests pin the accounting rather than any model behaviour. They assert that the 2,000 cap produces 278 responses cut before any answer and 15 cut mid-answer, that 70.5 percent of its billed output is spent on cut responses, that the calibrated per-class caps come out at 1,000, 5,500 and 24,100 tokens, and that the classifier never returns an incomplete response as an answer. In a real system, add a contract test against a recorded incomplete response from your provider: feed its JSON through the same parsing code and check that the step that consumes answers is never called. Then watch two live numbers per class, the share of incomplete responses and the share of billed output spent on them, and alert when either moves away from the calibration.
When a fixed cap is fine
For short, uniform requests, a single cap with a wide margin is simpler and costs nothing extra. The per-class work pays off when classes differ by an order of magnitude, as reconciliation and lookup do here, or when a single runaway request has a cost or latency the business cares about. If the provider or model you use does not count reasoning against the output limit, the empty-response failure does not apply, though measuring the tail still does. Check the documentation for the exact model and API you call rather than assuming one provider's rule holds for another.