LLM API Cost Calculator

Estimate and compare API token costs across Claude, GPT and Gemini. Free, instant, no signup.

Not sure how many tokens? Rough rule: 1 token ≈ 4 characters ≈ ¾ of a word.

Monthly cost by model

Model$/1M in$/1M outMonthly cost

Cheapest option is highlighted. Costs scale linearly with request volume.

Rates auto-synced 2026-07-25 from the LiteLLM community pricing database, a public community-maintained dataset that tracks vendor pricing pages — not an official vendor feed. The same values drive every calculator here via pricing.json. Confirm on the official pages before budgeting: Anthropic · OpenAI · Google. Every rate movement since tracking began is logged on the pricing change log.

Current rates used

Model$/1M input$/1M outputContext
Claude Fable 510.0050.001M
Claude Opus 55.0025.001M
Claude Sonnet 52.0010.001M
Claude Haiku 4.51.005.00200K
GPT-5.65.0030.001M
GPT-5.6 Terra2.5015.001M
GPT-5.6 Luna1.006.001M
GPT-5.4 mini0.754.501M
GPT-5.4 nano0.201.251M
Gemini 3.1 Pro (preview)2.0012.001M
Gemini 3.6 Flash1.507.501M
Gemini 3.5 Flash-Lite0.302.501M
Gemini 3.1 Flash-Lite0.251.501M

How LLM API pricing works

Almost all LLM APIs bill per token, split into two rates: input (the tokens you send — your prompt and context) and output (the tokens the model generates). Output is usually several times more expensive than input, so long responses cost disproportionately more. Monthly cost is simply:

(input_tokens × in_rate + output_tokens × out_rate) ÷ 1,000,000 × requests_per_month

Cost per token is not cost per task

Comparing models on their rate card assumes every model uses the same number of tokens to do the same job. They do not. A cheaper model that needs a longer prompt to stay reliable, produces more verbose answers, or has to be retried when it gets something wrong can cost more per completed task than a model with a higher headline rate.

Reasoning models make this sharper still: thinking is billed as output, so a short visible answer can carry a large invisible cost. The comparison that decides anything is cost per successful task on your own workload, measured with real requests. The table above tells you the rates; only your evaluation tells you the token counts.

What drives the bill in practice

DriverWhy it dominates
System prompts and tool schemasResent on every single request, invisible in the user-facing text
Conversation historyGrows each turn, so a long session costs progressively more per message
Retrieved contextUsually the largest block, and the easiest to over-fetch
RetriesBilled like any other request, and they cluster exactly when things go wrong

Notice what these have in common: they are all input. Trimming responses is the intuitive saving, but for most production workloads input outweighs output several times over, and context discipline saves more than brevity.

Reducing spend without changing models

Cache the stable prefix. Where the same system prompt or document is sent repeatedly, cached input is charged at a fraction of the standard rate. Put the fixed part first so it can be reused.

Batch anything that can wait. Evaluations, backfills and bulk classification do not need an answer in seconds, and asynchronous submission is billed at a lower rate.

Route by difficulty. Small tiers handle classification, extraction and routing well. Reserve the expensive model for the work that actually fails without it.

Cap output deliberately. Setting a sane maximum length bounds the most expensive tokens, and it also stops a runaway generation from turning one request into a large bill.

FAQ

How do I estimate token counts?

A quick heuristic: 1 token ≈ 4 English characters ≈ 0.75 words. For exact counts use a dedicated tokenizer/token counter tool.

Why is output so much more expensive than input?

Generation is more compute-intensive than reading context, so vendors price output tokens higher — often 3–5× the input rate.

Does prompt caching lower the cost?

Yes — several providers offer cached-input pricing that's a fraction of the standard input rate for repeated context. This tool models standard rates; cached workloads cost less.

Why is output priced higher than input?

Generating tokens is sequential — each one depends on the last — while reading a prompt can be processed in parallel. The compute profiles are different enough that vendors price them separately, typically with output several times the input rate.

Which model should I use to keep costs down?

Whichever is cheapest that still passes your evaluation. That is a real answer, not a deflection: model quality varies by task more than by reputation, and the rate gap between tiers is wide enough that testing the cheaper option is usually worth an afternoon. Build a small set of real examples, run the candidates, then use the table above to price the winner.