Every calculation runs in your browser — nothing is uploaded Editorial policy About Contact

LLM API Cost Calculator

AI features get shipped on a hunch and the invoice arrives a month later. Describe your workload in requests, prompt length and output length, and this calculator projects daily, monthly and annual spend across every major model, including the effect of prompt caching and batch processing.

Developer Updated August 21, 2026
Side-by-side cost across major model familiesModels prompt caching and batch discountsCost per request, per user and per million requests
Workload
One request
System prompt + context + user message.
Volume
Optimisations
0% — a stable system prompt, tool schema or document reused across requests. Cache reads cost about 10% of normal input.
%
Prices per million tokens

Editable — always confirm against the provider's current pricing page before budgeting.

Monthly cost — cheapest capable model

Describe your workload to project spend.

Requests / month
incl. retries
Tokens / month
input + output
Cost per request
cheapest model
Cost per user / month
price your plan above this

Cost by model

ModelPer requestPer dayPer monthPer year

Relative monthly spend

#Why AI costs surprise people

LLM pricing is per token, and tokens are invisible during development. A feature that feels cheap when you test it forty times becomes a serious line item at forty thousand requests a day. The failure mode is nearly always the same: nobody multiplied.

This calculator makes the multiplication explicit. Describe one request — input tokens and output tokens — set your volume, and see projected daily, monthly and annual spend across every major model family.

#Estimating tokens without measuring them

For English prose, one token averages roughly 0.75 words, so:

  • 1,000 tokens ≈ 750 words ≈ 4,000 characters
  • A typical page of text ≈ 500 tokens
  • A 20-page PDF ≈ 12,000 to 15,000 tokens

Two adjustments matter:

Code and structured data tokenise less efficiently. JSON, XML and source code produce 30% to 50% more tokens than plain English of the same character count, because punctuation and indentation fragment into separate tokens.

Non-Latin scripts are worse. Chinese, Japanese, Korean, Arabic and Hindi commonly use two to three times more tokens per unit of meaning than English. If you serve those languages, budget accordingly.

When precision matters, measure with your provider's tokeniser rather than estimating.

#Prompt caching is the highest-leverage optimisation

If a substantial portion of your input is identical across requests — a long system prompt, a tool schema, a product catalogue, a document being asked about repeatedly — caching it typically reduces the cost of that portion by around 90% on each read.

The effect on total spend is large. Consider a retrieval-augmented workload with 18,000 input tokens, of which 15,000 are a stable context block:

  • Without caching: you pay full input price on all 18,000 tokens, every request
  • With caching: you pay full price on 3,000 and roughly a tenth on 15,000

That is a 70%+ reduction in input cost, and input is usually the dominant term in RAG workloads. Move the cache slider in this calculator to see the effect on your numbers.

For caching to work, the cached content must be a stable prefix. Put the unchanging material first — system prompt, tools, documents — and the variable user content last. Reordering a prompt so the variable part sits at the end is often a one-line change worth thousands of dollars a month.

#When batch processing applies

Batch APIs accept a large set of requests and return results asynchronously, typically within 24 hours, at roughly half the standard price.

Good candidates: classification, tagging, enrichment, embedding generation, bulk summarisation, evaluation runs, dataset labelling, nightly report generation.

Bad candidates: anything a user is waiting on. There is no partial credit for a chat response that arrives tomorrow.

A common pattern is to split the workload: interactive requests go to the synchronous API, while the background pipeline that processes yesterday's data goes to batch. Many teams find 60% to 80% of their token volume is genuinely asynchronous once they look.

#Cheaper is not automatically cheaper

The cost-per-token comparison in the table is only half the decision. A smaller model that requires three attempts, longer few-shot prompts, or human correction can cost more in total than one call to a more capable model — before counting the engineering time spent tuning around its limitations.

The metric that matters is cost per successfully completed task, not cost per token. Use this calculator to size the raw gap, then run a real evaluation on your own data to find the quality difference. If the capable model is 10× the price but succeeds 99% of the time versus 82%, the arithmetic often favours the expensive one.

A useful pattern is routing: send the easy majority of requests to a small model, and escalate only the cases where a cheap confidence check fails. Model this by running the calculator twice at your estimated split.

#Other levers worth modelling

Cap output length. Output tokens usually cost three to five times input tokens. A max_tokens limit and a prompt instruction to be concise is the fastest saving available, and often improves the product.

Trim the context. Sending twelve retrieved chunks when four would do triples your input cost. Better retrieval is cheaper than more context.

Cache at the application layer too. Identical requests should never reach the API. A simple hash-keyed response cache removes the duplicate traffic that every production system generates.

Set hard spend limits. Every provider offers budget alerts and caps. A runaway loop in a background job is the single most common cause of a shocking invoice.

#Keep the prices current

The default prices in this calculator are editable because model pricing changes frequently, and it has trended downward substantially. Before committing a budget, check the provider's pricing page and update the fields — then re-run. The relative ranking between model tiers is more stable than the absolute numbers.

If AI inference is becoming a material part of your cost of goods sold, feed the resulting gross margin into the SaaS metrics calculator to see what it does to your LTV and payback period.

How to estimate your LLM API costs

  1. Describe one request. Enter average input tokens and output tokens for a typical request. Roughly 750 words equals 1,000 tokens.
  2. Set your volume. Add requests per day, or users multiplied by requests per user, to establish monthly volume.
  3. Apply optimisations. Set the share of your prompt that is cacheable and whether the workload can run as an asynchronous batch.
  4. Compare models. Review projected monthly cost per model and check whether a smaller model meets your quality bar at a fraction of the price.

Frequently asked questions

How many tokens is a word?

For English text, one token averages about 0.75 words, so 1,000 tokens is roughly 750 words or 4,000 characters. Code, JSON and non-Latin scripts tokenise less efficiently — budget 30% to 50% more tokens than a plain-English estimate for those workloads.

How much can prompt caching save?

When a long system prompt, document or tool schema is reused across requests, caching typically reduces the cost of the cached portion by around 90% on a read. For a retrieval-augmented workload where 80% of input tokens are a stable context block, total spend commonly falls by 50% to 70%.

Is a cheaper model always the right choice?

No. A smaller model that needs three attempts, longer prompts or human correction can cost more in total than one capable call. Compare cost per successfully completed task, not cost per token. Use the calculator to size the gap, then decide whether the quality difference justifies it.

What is batch processing and when should I use it?

Batch APIs accept a large set of requests and return results asynchronously, usually within 24 hours, at roughly half the standard price. It suits classification, enrichment, summarisation and evaluation jobs. It is unsuitable for anything a user is waiting on.