The quote is intentionally not an exact tokenizer result
Preflight uses a conservative input bound plus the requested output ceiling. Actual metered input and output can be lower. Treat the confirmed usage as the basis for the settled text price, and keep credit rounding separate from a claim that every tiny request consumes a whole credit.
What to do next
- 01
Save the confirmed receipt
Retain the job ID, model alias, credit_version, measured tokens, final credits and original reserved amount. Keep those operational fields without exposing private conversation content in routine logs.
- 02
Calculate the retail amount
Multiply input tokens by 0.20/1,000,000 and output tokens by 0.80/1,000,000, then add them. Compare with the recorded USD list amount and allow for documented credit-step rounding.
- 03
Reconcile returned reservation
Distinguish unused-reservation settlement from a failed-job return. A successful short answer can return part of its ceiling while still consuming a small measured charge.
A concrete example
Illustrative arithmetic: 1,000 input tokens and 500 output tokens allocate $0.0006 at those retail rates before credit-step rounding. This is a calculation example, not a newly executed chat call or an upstream supplier-cost statement.
Retail arithmetic without an API call
Illustrative integration code. No paid generation was executed for this guide. Review live availability, quotes and your own approval before running creation requests.
from decimal import Decimal, ROUND_CEILING
# Illustrative current retail usage, not a provider invoice.
input_tokens, output_tokens = 1000, 500
usd = (Decimal(input_tokens) * Decimal("0.20")
+ Decimal(output_tokens) * Decimal("0.80")) / Decimal(1_000_000)
credits = max(Decimal(1), (usd * Decimal(600)).to_integral_value(
rounding=ROUND_CEILING))
print(usd, credits) # 0.0006 USD list amount; 1 whole v4 credit
Before you call it ready
- Input and output tokens use their respective rates.
- The reservation and final debit remain distinct.
- Retail price is not confused with provider cost.
When to stop or choose another method
If measured usage is absent or the outcome is uncertain, do not invent an actual token charge. Retain the existing task for reconciliation instead of estimating a settled receipt from text length.
