▸ Free tool
LLM Cost Calculator.
Plug in tokens, requests, and a model. See the daily and monthly API bill before you ship it to production.
▸ Prices checked October 3, 2026
List prices from each provider's pricing page, standard tier. Confirm before you commit a budget.
Input and output are two prices
Every provider bills two meters, not one. Tokens you send are input, tokens the model generates are output, and output is always the expensive side. In the dropdown above, output costs 5 times input on every Claude and GPT-6 model and 6 times on Gemini 3.1 Pro.
That gap is hardware, not margin games. Your prompt is processed in one parallel prefill pass, while output emerges one token at a time, each needing a full forward pass: a sequential, memory-bandwidth-bound loop. So classification, extraction and routing are cheap per request, while drafting and code generation are not. At a 5× ratio, 200 extra output tokens cost exactly what 1,000 extra input tokens cost.
Prompt caching redraws the maths
Caching is the biggest lever on this page. The shape is the same everywhere: the first request writes a prompt prefix into the cache, and later requests that reuse that exact prefix read it at a steep discount. What differs is the price of the write.
- Claude. Mark a breakpoint with
cache_control. A write costs 1.25 times base input for the 5 minute cache or 2 times for the 1 hour cache. A hit costs 0.1 times base, 0.05 times on Opus 5.5 and 0.025 times on Fable 5.1. Each hit also resets the timer. - OpenAI. Caching is automatic on repeated prefixes. GPT-6 models list a cache write at 1.25 times input and a cached read at 0.05 to 0.1 times input.
- Gemini. Implicit caching has no write premium. Explicit caches bill a read rate of 0.1 times input plus storage per 1M tokens per hour, so a cache you keep alive all day has a fixed cost.
So the hit rate decides everything. Each miss pays the write price for the whole prefix, each hit pays the read price. On Claude with the 5 minute cache, the premium is 0.25 times and each hit saves 0.9 times, so one reuse pays for the write. On a quiet endpoint where requests are farther apart than the cache lifetime, almost every request is a miss and caching costs more than it saves. The hint under the cache inputs tells you which side of that line your traffic sits on. Matching is on an exact prefix, so keep timestamps and changing retrieval blocks at the end of the prompt.
Your token counts are estimates
This calculator does not tokenize anything. It multiplies the numbers you hand it. The token counter gives exact GPT counts and estimates for Claude and Gemini. If your numbers come from a characters divided by 4 rule of thumb instead, expect 10 to 15% error on English prose and worse elsewhere:
- Code. Indentation, braces, punctuation and camelCase splits push you nearer 2.5 to 3 characters per token, so a prose-tuned estimate undercounts a diff.
- Non-English text. Tokenizer vocabularies are English-dominated, so Cyrillic, Devanagari, Arabic and CJK routinely cost two to four times as many tokens.
- High-entropy strings. UUIDs, hashes, base64 and minified JSON have no learned merges and fragment almost character by character.
- Reasoning tokens. Billed as output whether or not the API hands the text back to you, the line item that surprises people on thinking models.
- Images and audio. Converted to tokens by a per-tile or per-second formula, billed at the input rate.
Providers also use different tokenizers, so the same string counts differently on Claude, GPT, and Gemini. When it matters, count with the provider's own.
Batch mode is 50% off, mostly unclaimed
Anthropic, OpenAI, and Google all sell the same deal: submit work asynchronously and pay roughly half list on both meters, in exchange for a turnaround measured in minutes to 24 hours. Same models, half the invoice.
| Realtime call | Batch / async call | |
|---|---|---|
| Price vs list | 1× | ~0.5× on input and output |
| Turnaround | Milliseconds to seconds | Minutes, up to 24 hours |
| Streaming | ||
| Rate-limit pool | Your standard quota | Separate, far larger queue |
| Fits | Chat, agents, anything a user waits on | Backfills, evals, embeddings, nightly enrichment |
Anything a human is not waiting on belongs in the right-hand column: embedding backfills, evals, nightly enrichment, bulk classification. To model it, pick Custom and halve both prices.
The agent loop is where bills explode
The single biggest surprise on a real invoice: an agent does not make N cheap calls. It re-sends the entire conversation every turn. Each tool result is appended, and the whole transcript, system prompt and tool definitions included, goes back over the wire next turn. Input cost grows quadratically with turn count.
Concretely: a 3,000-token system-and-tools header, 1,200 tokens added per turn, 20 turns. Turn one sends 3,000 input tokens; turn twenty sends 25,800; the run totals 288,000 for an average of 14,400 per call. Estimating it as "20 calls at the opening prompt size" understates the bill by nearly 5×.
So the input tokens / request field above wants the average across turns, and requests per day means tasks per day times turns per task. Caching also stops being optional here: an agent conversation grows purely by appending, the ideal cache shape. And it is why capping an agent by request count, not tokens, protects nothing.
Questions, answered
How do I calculate the cost of an LLM API call?
Multiply input tokens by the input price per million, multiply output tokens by the output price per million, and add the two. Both meters are billed separately and at different rates, so you cannot use a single blended number. This calculator does that arithmetic per request, then scales it by requests per day and a 30-day month.
Why are output tokens more expensive than input tokens?
Because they are produced differently. Your whole prompt is processed in one parallel prefill pass, while output is generated one token at a time, and each token needs a full forward pass through the model. That decode loop is limited by memory bandwidth and cannot run in parallel within a request. In the model list above, output costs 5 times input on every Claude and GPT-6 model, 6 times on Gemini 3.1 Pro, and about 8 times on Gemini 3.5 Flash-Lite.
How much does prompt caching actually save?
It depends on your hit rate. On Claude, writing a prefix into the cache costs 1.25 times the base input price for the 5 minute cache, or 2 times for the 1 hour cache. A hit costs 0.1 times base, and less on Opus 5.5 and Fable 5.1. GPT-6 models list the same 1.25 times write price and a 0.05 to 0.1 times read price. Gemini charges no write premium but bills storage per hour for explicit caches. With a 5 minute cache, one reuse pays for the write. With low traffic, most requests miss and pay the premium, so caching can cost more than it saves. Set the hit rate above and the calculator shows both sides.
Are the LLM prices in this calculator up to date?
They are standard list rates, checked against each provider's public pricing page on the date shown at the top of the tool. They will drift. Providers change prices, add tiers, and charge more for long-context requests: GPT-6 and Gemini 3.1 Pro roughly double the rate above a context threshold. Gemini 3.8 Flash is on a launch price that doubles on January 1, 2027. Treat the dropdown as a starting point, and edit the price fields if your numbers differ. Nothing here knows about enterprise discounts or batch rates.
Why is my AI agent so expensive compared to a single chat call?
Because every turn re-sends the entire conversation, including the system prompt and all tool definitions, so input cost grows quadratically with turn count rather than linearly. A 20-turn run with a 3,000-token header and 1,200 tokens added per turn burns about 288,000 input tokens, not 60,000. Feed the average input across turns into the box above, not the opening prompt, and multiply requests per day by turns per task.
Does this LLM cost calculator send my data anywhere?
No. The whole thing is a few lines of arithmetic running in your browser. No request is made, no numbers are stored, and there is no signup. The share button only puts your inputs in the page address. Open the network tab and watch it stay empty, or load the page once and then go offline.
Keep reading
-
▸ Tool
Token Counter
Get the token numbers you type in here, and see how badly code and non-English text break the estimate.
-
▸ Tool
Context Window Checker
Before you cost a prompt, check it still fits, and what the long-context tier does to the price.
-
▸ Post
LLM vs AI agent
Why one call and one agent run are different products, and why only one of them has a quadratic bill.
-
▸ Post
Rate limiting your AI wallet
The estimate above is the happy path. This is how you cap spend by tokens when traffic is not.
-
▸ Post
RAG vs fine-tuning
The architectural decision behind the numbers: retrieval inflates input tokens on every call, fine-tuning moves the cost up front.
▸ Last verified:
Need this in production?
Shipping AI features? I build RAG pipelines, MCP servers and agents that hold up in production.
AI & MCP Integration
Keep reading
-
▸ Tool
Token Counter
The cost model is only as good as the token count you feed it.
-
▸ Tool
Context Window Checker
Long context is the line item people forget to model.
-
▸ Post
/blog/rate-limiting-ai-wallet/
Denial-of-wallet: how a metered AI endpoint becomes an unbounded bill.
-
▸ Post
/blog/training-vs-inference/
Where the money actually goes once you are serving rather than training.