How LLM API pricing works
Every major AI API bills by the token. Prices are quoted in US dollars per 1 million tokens, with separate prices for the text you send (input) and the text the model writes (output). For one request:
Three things change that simple formula, and the calculator handles all of them:
- Prompt caching. If the start of your prompt (a long system prompt, a document, a list of tools) is the same on every request, providers can cache it. Cached tokens cost a fraction of the normal input price: 10% on most models, 5% on Claude Opus 5.5 and Sonnet 5.5, and about 2% on DeepSeek. Anthropic and the newest OpenAI models charge a little more than the input price to write the cache, so you enter how often the cache is rewritten each day.
- Batch processing. Jobs that can wait up to 24 hours cost 50% less at Anthropic, OpenAI, Google and Mistral, and 20% less at xAI. DeepSeek has no batch API but charges half price outside its peak hours.
- Long prompts. Some models switch the whole request to higher prices once the prompt passes a threshold: 272,000 tokens on GPT-5.5 and GPT-6 models, 200,000 on Gemini Pro and Grok, and 100,000 on Claude Haiku 5.5.
The monthly figure is the daily cost × 30.
Where the prices come from
Each price was read from the provider’s own pricing or model page on the date shown in the price table, and each provider’s section links to its sources. We don’t copy prices from aggregator sites. Where a provider states a rule but doesn’t print a number per model (Mistral’s 50% batch discount, for example), the table marks it with an asterisk. Gemini has scheduled price increases, Gemini 4 Argon from 1 December 2026 and Gemini 3.8 Flash from 1 January 2027, so the comparison shows the future monthly cost too.
Worked examples
1. A support chatbot. Each request has a 2,500-token system prompt, 500 tokens of conversation and 400 output tokens, with 5,000 requests a day.
| Model | No caching | 83% cached, cache rewritten 24×/day |
|---|---|---|
| Claude Sonnet 5.5 | $50.00/day ($1,500/month) | $26.39/day ($792/month) |
| Gemini 3.8 Flash | $18.75/day ($563/month) | $10.35/day ($311/month) |
| DeepSeek V4.1 Flash | $6.90/day ($207/month) | $3.24/day ($97/month) |
For Sonnet 5.5 the cached version works out like this: 500 fresh tokens × 5,000 × $2 = $5.00, plus 2,500 cached tokens × 4,976 cache reads × $0.10 = $1.24, plus 24 cache writes × 2,500 × $2.50 = $0.15, plus output 400 × 5,000 × $10 = $20.00 (each ÷ 1,000,000). Caching cuts the bill by almost half, and output becomes the largest cost.
2. A nightly batch job. Summarising 10,000 documents a day at 8,000 input and 300 output tokens on Claude Haiku 5.5 costs $8.00 + $1.50 = $9.50 a day. Through the Batch API it is $4.75 a day, or $142.50 a month.
3. Crossing a long-context threshold. One GPT-5.5 request with a 272,000-token prompt and 2,000 output tokens costs 272,000 × $5 + 2,000 × $30 (each ÷ 1,000,000) = $1.36 + $0.06 = $1.42. Add 28,000 tokens to the prompt and the request crosses the threshold: 300,000 × $10 + 2,000 × $45 = $3.00 + $0.09 = $3.09. That is only 10% more input but more than twice the price, because every token in the request is billed at the higher rate.
Tips to cut your API bill
- Measure real token counts instead of guessing from word counts. Use the LLM token counter; its “Estimate the cost” button fills in this calculator.
- Put stable content first so it can be cached: instructions, tool definitions and reference documents before the user’s question.
- Cap the output. Output is usually 4–8 times the price of input, and reasoning models bill their hidden thinking as output too.
- Move non-urgent work to batch. Evaluations, nightly reports and bulk classification rarely need an answer in seconds.
- Send less text. Clean Markdown is much shorter than HTML or raw PDF text. Convert files with document to Markdown and check the result with the context window checker.
- Try a smaller model on a sample of real requests before deciding. A small model can cost a tenth as much as a flagship.
What the calculator leaves out
Token charges are usually most of the bill, but not all of it. Web search and other tool calls, explicit cache storage on Gemini (billed per hour), image and audio inputs, data-residency surcharges (about 10% at Anthropic and OpenAI), fine-tuning and sales tax are not included. Free tiers and enterprise discounts are not included either. Treat the result as a planning estimate, and confirm current prices on the provider’s page before you sign off a budget.