How to estimate LLM API cost (and where the estimate goes wrong)
The arithmetic is the easy part. Choosing the inputs is where estimates fail.
Computed from the SelfBench catalog of 30 models, Oct 15, 2026. Prices are published list rates; every model page links to its source.
Estimating LLM spend comes down to one multiplication per model:
cost = (input tokens × input price + output tokens × output price) × requests
Everything hard about the estimate is deciding those three inputs. The prices come from the vendor. The rest is you.
1. Input tokens are bigger than you think
The message the user typed is usually the smallest part of the input. The full input on each turn is the system prompt, tool definitions, the retrieved context, and the whole conversation history so far, re-sent every time. A "short" question in a long thread can be 30,000 tokens of input.
This is why the calculator defaults to 1,500 input tokens rather than 100: it models a realistic turn, not a first turn. If you have logs, use the mean input tokens across all requests, not the median of the messages you looked at.
2. Output tokens are the expensive half
Across the 30 models in our catalog, output costs a median of 5.0× what input costs per token, and 15 of 30 charge at least 5×. One model prices output at 8.0× its input rate.
That single ratio decides whether your bill is dominated by what you send or what the model writes back. Long-context workloads (RAG, document analysis) tilt toward input; chatbots with verbose answers tilt toward output.
| Model | Input / 1M | Output / 1M | Output ÷ input |
|---|---|---|---|
| GPT-5.3-Codex | $1.75 | $14 | 8.0× |
| Gemini 3.1 Pro Preview | $2 | $12 | 6.0× |
| Claude Fable 5.1 | $10 | $50 | 5.0× |
| Claude Haiku 5.5 | $0.100 | $0.500 | 5.0× |
| Claude Opus 5.5 | $4 | $20 | 5.0× |
| Claude Sonnet 5.5 | $2 | $10 | 5.0× |
| Gemini 3.8 Flash | $0.750 | $3.75 | 5.0× |
| Gemini 3.8 Flash Cyber | $1.50 | $7.50 | 5.0× |
| Gemini 4 Argon | $2 | $10 | 5.0× |
| Muse Wonder | $4 | $20 | 5.0× |
| Kimi K3 | $3 | $15 | 5.0× |
| GPT-5.6 Sol | $4 | $20 | 5.0× |
| GPT-6 Astra | $10 | $50 | 5.0× |
| GPT-6 Luna | $0.100 | $0.500 | 5.0× |
| GPT-6.1 Sol | $2 | $10 | 5.0× |
| Kimi K2.6 | $0.950 | $4 | 4.2× |
| Kimi K2.7 Code | $0.950 | $4 | 4.2× |
| DeepSeek-V4.1-Flash | $0.300 | $1.20 | 4.0× |
| Qwen3.7-Plus | $0.300 | $1.19 | 4.0× |
| GLM-5.3 | $1.19 | $4.18 | 3.5× |
| GLM-5.3-Flash | $0.120 | $0.420 | 3.5× |
| GLM-5.3-FlashX | $0.300 | $1.04 | 3.5× |
| Qwen3.8-Flash | $0.120 | $0.400 | 3.3× |
| Qwen3.8-Max | $1.79 | $5.37 | 3.0× |
| DeepSeek-V4-Pro-0813 | $1.32 | $3.96 | 3.0× |
| Grok 4.5 | $2 | $6 | 3.0× |
| Grok 4.6 | $2 | $6 | 3.0× |
| Grok 4.7 | $2 | $6 | 3.0× |
| Grok 4.3 | $1.25 | $2.50 | 2.0× |
| Grok Build 0.1 | $1 | $2 | 2.0× |
Output ÷ input on published list prices, Oct 15, 2026. It says nothing about quality — a cheap-to-generate answer is not a good answer.
3. Requests include the ones users never see
Retries, evaluation runs, classification steps, tool-calling loops and background jobs all bill. A workflow that calls the model four times per user action costs four times what a naive estimate says.
Practical approach: count model calls, not user actions, and add your retry rate on top.
Where the estimate goes wrong
- Caching. If you resend the same system prompt and context, most vendors bill a fraction — a median of 10% of the standard input rate across the 27 models that publish a cached rate. Ignore it and you overestimate on input-heavy workloads. Details and per-model rates →
- Price tiers. 7 models in the catalog charge a higher rate once a single request crosses a context threshold. A 250K-token document is not billed at the same per-token rate as a 2K-token prompt.
- Time-limited pricing. 3 models carry promotional or introductory rates with an end date. Modelling next quarter's budget on a promo rate is a common surprise.
- Time-of-day pricing. 2 vendors here discount off-peak hours. If your workload is batch and movable, that is free money.
A worked example
Support assistant: 1,500 input tokens, 400 output tokens, 200 requests per day (6,000/month). Using Qwen3.8-Flash at $0.120/$0.400 per 1M, that is $0.0003 per request and about $2.04 per month. On GPT-6 Astra — the most expensive output price in the catalog at $50 per 1M — the same workload is about $210 per month.
That spread — roughly 103× — is the reason to do the arithmetic before choosing a default. Whether the cheaper model can do the job is a question only your own evaluation can answer.
Frequently asked questions
Is this estimate a quote?
No. It is arithmetic on published list prices and the token counts you supply. Your contract, your caching behaviour and your retry rate can all move the real number substantially.
How accurate is a guess at input tokens?
Within a factor of two, usually — and that is fine for comparing models, because every model is compared with the same wrong number. It is not fine for a budget line you have to defend; measure one week of real traffic first.
Should I include retries?
Yes. At 5% retry, your request count is 1.05× what your logs show. It compounds with tool-calling loops, which can issue several model calls per user turn.