API bills surprise people because the input side is invisible. This is the four-number estimate that gets within 30% before you write the code.
What you need
- The provider's per-million token prices (our /models/ table is the short version)
- One real prompt, not a test prompt
- A guess at monthly request volume — you will refine it after week one
Steps
Count the tokens in your fixed prefix.
System prompt, policies, tool definitions, reference documents. This is the number that gets cached and the number that dominates cost at scale.
Count the tokens in a typical variable request and response.
Input and output are priced differently — output is usually 5x input on the same model. Estimate both separately or the estimate will be wrong by half.
Multiply by volume, then apply the cache.
Fixed prefix × requests = cached tokens (at the cached price). Variable input + output at the normal price. This split is the entire calculation.
Pick two models: the cheap one and the good one.
Run the numbers on both. The difference between gpt-6-luna and gpt-6.2-astra on the same workload is 320x — that is the range you are choosing inside.
Set a hard cap before launch.
Every provider offers a spend limit. Set it at twice your estimate. The first month's job is to find the loop that burns tokens, not to be surprised by it.
Where it goes wrong
- Counting only the user's message and forgetting the system prompt
- Forgetting that retries multiply volume
- A timestamp in the prefix silently disables caching and doubles the bill
What it costs
A modest assistant (1M input + 200k output a month) costs $0.10 on the cheapest model and $32.00 on the most expensive — the same feature, two different businesses.
Our take
Most API budget surprises come from output tokens and retries, not from the headline input price. Model the retry rate before you model the model.
We would budget per feature, not per month. A monthly number hides which feature is burning the money, and the feature that burns it is usually the one nobody measured.
Related
API price per 1M tokens · Why prompt caching matters · Three limits that decide a plan