Skip to content
ansezz.

▸ 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.

▸ Heads up

Prices are approximate list rates. Always confirm against the provider's current pricing page.

▸ Estimated spend

Per request
$0
Per day
$0
Per month
$0

30-day month · live as you type

Need this productionized? →

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 runs 5× input on every Claude tier, 6× on GPT-5.4 and GPT-5.5, and 8× on Gemini 2.5 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, and the checkbox above only gestures at it. The shape is the same everywhere: pay a premium once to write a prompt prefix into the cache, then pay a steep discount whenever a later request reuses that exact prefix. Anthropic makes it explicit — mark a breakpoint with cache_control, writes cost 1.25× base input on the 5-minute TTL (2× for an hour), reads roughly 0.1×. OpenAI and Google discount repeated prefixes automatically rather than charging for the write.

The break-even is trivial: the write premium is 0.25× and every hit saves 0.9×, so one reuse inside the TTL pays for it. It fails two ways. Matching is on an exact prefix, so a timestamp or re-ordered retrieval block near the top invalidates everything after it — keep volatile parts last. And the TTL is short, so a low-traffic endpoint pays the premium more often than it collects the discount. The checkbox here assumes half your input hits cache at 0.1×, or 0.55× on input overall, and charges nothing for writes.

Your token counts are estimates

This calculator does not tokenize anything — it multiplies the numbers you hand it. If those came from the token counter here, or any characters ÷ 4 rule of thumb, expect 10–15% error on English prose and worse elsewhere:

  • Code. Indentation, braces, punctuation and camelCase splits push you nearer 2.5–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 ~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, each token needing a full forward pass through the model — that decode loop is memory-bandwidth bound and cannot be parallelised within a request. In the model list above, output runs 5× input on the Claude tiers, 6× on GPT-5.4 and GPT-5.5, and 8× on Gemini 2.5 Pro.

How much does prompt caching actually save?

A cache read typically costs about 10% of the base input rate, and on Anthropic a cache write costs 1.25× base input for the 5-minute TTL or 2× for the 1-hour option. The write premium is 0.25× and every hit saves 0.9×, so a single reuse inside the TTL already pays for it. The caveat is that caching matches on an exact prefix — one timestamp or shuffled retrieval block near the top invalidates everything after it.

Are the LLM prices in this calculator up to date?

They are list rates checked against each provider's public pricing page and they will drift — providers change prices, add tiers, and charge extra for long-context requests above a threshold. Treat the dropdown as a fast starting point, then pick Custom and paste today's real numbers before you commit a budget. Nothing here knows about your enterprise discount, committed-use pricing, 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. Open the network tab and watch it stay empty, or load the page once and then go offline.

Keep reading

Keep reading