LLM API Cost Calculator
Price a real workload across Claude, GPT and Gemini, including prompt caching.
https://calculators.nirajiitr.com/finance/llm-api-cost-calculator
How it works
Every provider bills per million tokens, with separate prices for input and output. Output costs four to eight times as much as input, because generating text is far more compute-intensive than reading it. Prompt caching is the other big lever: if the start of your prompt is the same on every request, such as a long system prompt or reference document, the cached portion is billed at a small fraction of the input price.
cost = (uncached input × input price + cached input × cache price + output × output price) ÷ 1,000,000- input tokens
- Everything sent: system prompt, history, documents, tool definitions
- output tokens
- Everything generated, including any reasoning tokens
- cache price
- The rate for input served from a prompt cache
- 1 token
- About 4 characters, or ¾ of a word, in English
Worked example
A support bot on Claude Sonnet 5 with 3,000 input tokens and 500 output tokens per request, 1,000 requests a day, no caching.
- 1Input: 3,000 × $2 ÷ 1,000,000 = $0.006
- 2Output: 500 × $10 ÷ 1,000,000 = $0.005
- 3Per request: $0.011
- 4Per month: 0.011 × 1,000 × 30 = $330
$330 a month. Caching a 2,400-token shared system prompt (80% of input) would cut input cost from $180 to about $50 a month.
Frequently asked questions
How do I estimate tokens per request?
Use about 4 characters per token for English prose, so a 1,500-word document is roughly 2,000 tokens. Code and non-English text usually take more. Count the whole request, not just the user's message: the system prompt, conversation history and tool definitions are resent on every call. For exact figures, every provider returns token counts in the API response, and some offer a token-counting endpoint.
Are token counts the same across providers?
No. Each model family has its own tokenizer, so identical text can produce noticeably different counts. Anthropic notes that Claude models from 4.7 onward use a tokenizer that produces about 30% more tokens for the same text than earlier ones. For an accurate comparison, run a sample of real prompts through each provider and read the usage figures they return.
How much does prompt caching save?
A cache hit is billed at 10% of the normal input price on most models listed here, and 2.5% on Claude Fable 5.1. Writing to the cache costs slightly more than normal input, 1.25× for Anthropic's five-minute cache, so caching pays off from the second request that reuses the prefix. It only works on an identical prefix, so put stable content first and anything that changes per request last.
What else affects the bill?
Batch APIs, which return results within 24 hours, typically halve the price. Reasoning or thinking tokens are billed as output. Some providers charge more for very long prompts or for regional data residency. Server-side tools such as web search carry per-use fees. This calculator covers the standard synchronous rate, which is the right baseline for comparing models.