A few weeks ago I got an API invoice nearly double what I had budgeted. The cause wasn’t a bug: I had compared models looking only at the input price per million tokens, while my actual workload generates far more output than input — and output costs 3 to 8 times more. The provider’s pricing table doesn’t lie, but it doesn’t tell your story either.
CostPerPrompt is a free site that tackles exactly that: it lists per-token prices for 232 models (OpenAI, Anthropic, Google, DeepSeek, Mistral, Meta, xAI, Qwen, GLM, Kimi and more), refreshed automatically every day, and on top of that it ships calculators that turn those prices into an estimated monthly bill based on YOUR usage pattern: input and output tokens per request, cache hit rate and batch discount. It’s not another pretty table — it’s the table plus the math you should actually do before picking a provider.

Why the sticker price misleads you
Every major provider bills the same way: different rates for input tokens (what you send) and output tokens (what the model generates), with output usually costing 3 to 8 times more. Checking the official pages today:
- OpenAI: GPT-5.1 sits at $1.25 / $10 per million (input / output). GPT-5-nano drops to $0.05 / $0.40.
- Anthropic: Claude Sonnet 5 is at $2 / $10 (introductory pricing until August 31, 2026; then it goes up to $3 / $15). Haiku 4.5 at $1 / $5 and Opus 5 at $5 / $25.
- DeepSeek: deepseek-v4-flash at $0.14 / $0.28, and with a cache hit input falls to $0.0028 per million. Heads up: they’ve announced peak/off-peak pricing, doubling prices during peak hours.
- Mistral: Mistral Large at $2 / $6, with a 50% batch processing discount.
Second factor: prompt caching. If your app resends repeated context (a long system prompt, a chatbot’s history, your tool schemas), the cached portion is billed way cheaper: on Anthropic, cache reads cost 10% of the regular input price, OpenAI’s GPT-5 models also bill cached input at 10%, and on DeepSeek a cache hit runs at roughly 2% of the uncached price. Third factor: the batch APIs from OpenAI, Anthropic and Mistral take 50% off in exchange for deferred processing.
With those three variables, two models that look “similarly priced” in the table can differ 3x on your real bill. And the reverse: a model that looks expensive can end up cheap if your workload benefits heavily from caching.
What CostPerPrompt measures and how to use it
The homepage is the listing: 232 models with input, output and cached-context prices per million tokens, sortable, with each model’s max context. The data refreshes automatically from providers’ public listings (when I checked, the last update was from the same day).
The genuinely useful part is the calculators:
- API Cost Calculator: enter requests per day, input and output tokens per request, cache rate and whether you use batch, and it compares the monthly cost across every model at once.
- Chatbot Cost: simulates real conversations, with history growing and being resent each turn and each provider’s cache TTLs.
- Agent Cost: multi-step loops, tool schemas and retries. By their own numbers, an agent costs 10 to 30 times more than the naive “one prompt, one answer” math suggests. If you’ve run an agent in production, this won’t shock you: every iteration resends the whole context plus tool results.
- Plus: calculators for RAG (indexing, retrieval and generation priced separately), voice (STT + LLM + TTS), GPU rental prices, image API pricing, and a token counter that runs entirely in your browser.
The workflow I’d recommend: pull a real sample from your logs (requests/day, average input and output tokens), estimate what share of your input is repeated cacheable context, and feed those numbers into the calculator. Ten minutes and you have a comparison that actually resembles your invoice.
An example with verified numbers
Take a typical AI-backed workload: 50,000 requests per month, 1,500 input tokens and 400 output tokens per request. That’s 75 million input tokens and 20 million output tokens a month. With the official prices above, the arithmetic looks like this:
| Model | Input (75M) | Output (20M) | Total/month |
|---|---|---|---|
| Claude Sonnet 5 ($2/$10) | $150 | $200 | $350 |
| GPT-5.1 ($1.25/$10) | $93.75 | $200 | $293.75 |
| Mistral Large ($2/$6) | $150 | $120 | $270 |
| DeepSeek v4-flash ($0.14/$0.28) | $10.50 | $5.60 | $16.10 |
Two takeaways. First: output rules. On Sonnet and GPT-5.1, 20 million output tokens cost more than 75 million input tokens — which is why comparing only input prices is the classic mistake. Second: the spread between providers is brutal, from $350 down to $16 for the same workload. Whether DeepSeek v4-flash handles your use case at the same quality is another story (that’s what benchmarks and your own tests are for), but as a candidate to evaluate, the calculator puts it in front of you instead of letting you ignore it.
Now the caching effect. If 60% of your input is a system prompt and repeated context, on Sonnet 5 those 45M cached tokens are billed at $0.20 per million instead of $2: input drops from $150 to $69 and the total falls to $269. And if your workload also tolerates batch (nightly summaries, deferred classification), the 50% discount halves the bill again. None of this is visible from the raw pricing table.
Tricks to pay less for AI APIs
- Measure before touching anything. Without your real input/output ratios you’re optimizing blind. Your provider’s usage logs already give you this. If you prefer a physical monitor, PocketMeter is an ESP32 gadget that tracks your Claude, Codex and similar spending on a screen.
- Model cascade. Send everything to the cheap model (Haiku 4.5 at $1/$5, GPT-5-nano at $0.05/$0.40) and escalate to the big one only what fails a simple validation. In many workloads 80% of requests don’t need the flagship.
- Design for the cache. Stable system prompt at the start of the context, no timestamps or IDs that change on every call. A varying prefix breaks the whole cache.
- Batch for anything non-interactive. 50% off on OpenAI, Anthropic and Mistral in exchange for waiting.
- Evaluate alternatives with data, not vibes. DeepSeek, Qwen, GLM or open-weight models via third-party providers show up on CostPerPrompt at prices that are sometimes 5-10% of the American flagship. Test your real workload against them before swearing loyalty to one provider.
What you need to verify yourself
CostPerPrompt is a starting point, not the definitive source — and they say so themselves in the footer: confirm final pricing on the provider’s official page before budgeting. If you use Claude, it’s also worth checking Claude Opus 5 for coding: price, tokens and setup before budgeting. Concrete things to check:
- Introductory pricing: Sonnet 5 goes from $2/$10 to $3/$15 on August 31, 2026. If your comparison assumes today’s price, your September budget is off by 50%.
- Time-of-day rates: DeepSeek has announced double pricing during peak hours (9:00-12:00 and 14:00-18:00 Beijing time). If your traffic concentrates there, the average changes.
- Caching has TTLs and minimums: Anthropic’s cached-read prices assume a 5-minute TTL, and there’s a minimum context size for a call to be cacheable. A chatbot with spaced-out conversations may hit the cache far less than you imagine.
- Price isn’t quality: the calculator measures neither response quality, nor latency, nor rate limits. For that you need your own evals.
- The site is funded through affiliate links to some providers. The pricing data comes from public listings and matches what I verified today, but it’s an incentive worth keeping in mind.
The whole exercise takes about fifteen minutes: pull your usage metrics, feed them into CostPerPrompt, cross-check the two or three winners against the official pricing pages, and run a quality test with your real workload. If that reveals you’re paying flagship prices for a small model’s job, the tool has already saved you more than most code optimizations ever will. I also wrote about Kimi K3 costs versus other options, another candidate worth running through the calculator.
FAQ
What’s the difference between input and output pricing for AI APIs?
Providers bill input (what you send) and output (what the model generates) separately. Output usually costs 3 to 8 times more, so a workload with heavy output can inflate your bill even if input is cheap.
How do you calculate the real cost of an AI API?
Multiply input and output tokens by their per-million price, add both, apply the cache discount on repeated context, and, if applicable, the 50% batch discount. Tools like CostPerPrompt automate this math with your real workload.
Is batching worth it for AI APIs?
Yes, for jobs that don’t need an immediate response, such as nightly summaries or deferred classification. OpenAI, Anthropic and Mistral usually offer a 50% discount in exchange for deferred processing.



What do you think?
Leave your opinion, question or suggestion. Comments are synced with GitHub Discussions .