LLM API cost calculator: cost per request, per 1,000 runs and per month
Short answer: cost per request = input tokens × input price ÷ 1,000,000 + output tokens × output price ÷ 1,000,000. Multiply by your monthly requests. Example: 1,200 input and 300 output tokens on a model priced $2 / $10 per million is $0.0054 per request, $5.40 per 1,000, and $216 a month at 40,000 requests.
Calculator
Prices for 25 current models are in the LLM API pricing comparison.
Get real token counts, not guesses
Every major API returns token usage with each response (input tokens, output tokens, and on some models reasoning tokens and cached tokens). Run 20–50 of your real prompts and average those numbers. Estimates like "about 4 characters per token" are fine for a first guess, but models tokenize differently and output length varies a lot by model, so measure on each model you're considering.
Why the bill differs from the estimate
- Reasoning tokens are billed as output even though you don't see them. Check the usage field for them.
- Conversation history: in a chat, every turn re-sends the previous messages as input, so input tokens grow with each turn.
- Retries after errors or failed format checks are paid twice.
- Tools and retrieval: tool definitions and retrieved documents count as input on every call.
- Discounts: cached input and batch processing are billed lower at the major labs, so a long fixed system prompt can cost less than the formula says.
Cost per 1,000 runs is the number to compare
Comparing models on price per token is misleading: one model can be cheaper per token and more expensive per answer. Run the same prompts on each candidate, compute cost per 1,000 runs from the real usage, and put it next to the pass rate. The full comparison method.