How to estimate your monthly LLM API cost
Forecasting an inference bill is arithmetic, not prophecy. Here is the method: four numbers to log, one formula, and the mistakes that make estimates come in low.
Published · 7 min read
Almost every surprised invoice comes from the same place: an estimate built on average request size, when the traffic that actually drives spend is not average. This is the method that avoids it. It takes about an hour of instrumentation and it stays accurate as you scale.
It is the measurement half of the broader cost guide. Once you have these numbers, the optimization decisions get much easier.
The formula
Monthly cost for a single route is: input tokens per call, times calls per month, times the input rate, plus output tokens per call, times calls per month, times the output rate. If you use prompt caching, split the input term into cached and uncached parts and price them separately.
That is the whole model. The difficulty is never the formula; it is getting honest values for the inputs.
The four numbers to log
- Input tokens per call, per route. Not per application. Routes differ by an order of magnitude and averaging across them destroys the estimate.
- Output tokens per call, per route. Log the actual usage figure returned by the API, never your own estimate of what the model wrote.
- Cached input tokens, if you use caching. This is a separate line at a separate rate.
- Calls per month, per route, measured over a full week and multiplied out. A weekday-only sample overstates a consumer product and understates an internal tool.
A worked example
Suppose a support assistant handles 100,000 calls a month. Each call sends about 500 tokens of prompt and retrieved context, and returns about 50 tokens. That is 50M input tokens and 5M output tokens per month. Priced across four models in our catalog:
| Model | At list price | At corouter price | Difference |
|---|---|---|---|
| GPT-5.5 | $400.00 | $80.00 | $320.00 |
| GPT-5.4 | $200.00 | $40.00 | $160.00 |
| Claude Sonnet 4.6 | $225.00 | $45.00 | $180.00 |
| Claude Haiku 4.5 | $75.00 | $15.00 | $60.00 |
The spread across model tiers is the reason right-sizing matters more than negotiating, and the spread between the two price columns is what outlet pricing does to the same workload without any code changes at all.
Four things that make estimates come in low
- Retries and failures. A retried call is billed. Timeouts that already generated tokens are billed. Build your failure rate into the call count.
- Agent loops. One user action can be five model calls. Count model calls, not user actions.
- Background jobs. Nightly re-processing often dwarfs interactive traffic and rarely appears in anyone's mental model of usage.
- Growth during the month. If you are growing 15% month over month, estimate against the end of the month, not the start.
Skip the spreadsheet
Once you have per-route token volumes, the API cost calculator does this arithmetic across the catalog, including the cached-input split, and shows list price next to outlet price. It is the fastest way to turn four logged numbers into a decision.
Then check the model you picked against the alternatives: how the two vendors price and a direct two-model comparison.
Keep reading
- How to reduce your LLM API costsMost advice about cutting inference spend is vague. This is the concrete version: where the money goes, which five levers move it, and how much each one is worth on a real monthly volume.
- OpenAI vs Anthropic API pricingBoth vendors publish per-million-token rates, but they price context, output, and caching differently enough that the cheaper choice depends entirely on your workload shape.
- GPT-5.5 vs Claude Sonnet 4.6, priced honestlyTwo frontier models from two vendors, compared on the only dimension we can verify: what they cost to run at published rates on identical workloads.
Price the same models at outlet rates
Same model IDs and familiar JSON shapes, metered per token, with a $5 minimum top-up and no subscription.
Get an API key
