AI API cost calculator
Put in your real token volume. See what the official list price would be, what the gateway route costs, and what the gap is worth over a year.
How to estimate your tokens
If you do not have exact numbers, these are realistic starting points:
| Workload | Input / month | Output / month |
|---|---|---|
| Solo dev using a coding agent daily | 150M – 400M | 10M – 30M |
| Small team (3–5 devs) | 600M – 1.5B | 40M – 100M |
| Chatbot, ~50k conversations | 80M – 200M | 15M – 40M |
| RAG pipeline, 100k documents | 300M – 800M | 30M – 80M |
Measure your own split instead of guessing it
Every model in this index prices output at a multiple of input, and that multiple runs from 3× to 8.3× depending on which model you pick. Guessing the ratio is the largest single source of error in a cost estimate And it is measurable in about ten lines. Log the usage object on every call:
import json
# 把每次调用的 usage 落盘,一周后你就有了自己的 in:out 比例。
# 拿这个比例去 /calculator/ 比价,比对着价目表猜准得多 ——
# output 单价是 input 的好几倍,猜错方向就是往贵了算。
with open("usage.jsonl", "a") as fh:
fh.write(json.dumps({
"model": model,
"in": resp.usage.prompt_tokens,
"out": resp.usage.completion_tokens,
}) + "\n")
A week of that gives you a real in:out ratio, which is the only input the calculator actually needs from you. Rates follow vendor promotions and can move without notice, so a per-call record is also the only thing that tells you later whether a price change actually hit you, and in which direction.
What the calculator does not include
- Prompt caching. Stable system prompts can cut input cost by 60–90%. That saving applies on both sides, so the percentage gap stays similar.
- Batch API. Both official and gateway routes discount async workloads, roughly halving them.
- Long-context tiering. Some models charge more above a context threshold.
Calculators for specific tools
A generic token estimate hides what each tool actually does with context. These two have their own pages, with starting values that match how they behave:
- Claude Code cost calculator (every turn resends the accumulated conversation, so input dominates the bill).
- Cursor cost calculator, agent mode resends context on each request, so cost grows with thread length rather than message count.
Figures are estimates based on list prices verified 2026-10-31. Actual spend depends on your cache hit rate, batch usage and long-context tiering.