Skip to content

LLM Token Cost Calculator

Pure frontend: every rate and volume is computed in your browser — no network call, no upload, nothing recorded. The rate fields start empty; fill them from the provider's current pricing page.

How to use

Open the pricing page of the provider you actually use and copy the current input, output and (where offered) cached-read rates, all normalised to "per million tokens". Then enter input tokens, output tokens and daily request volume. If your prompt carries a stable prefix, add a cache hit rate.

Assumptions and where the formula comes from

The tool follows the common "rate per million tokens" convention used across providers, with three non-overlapping parts:

cached input tokens = input tokens × hit rate
fresh input tokens  = input tokens − cached input tokens
cache rate          = cached-read rate (if left empty, the input rate is used, i.e. no discount)
per request         = (fresh input × input rate + cached input × cache rate + output × output rate) ÷ 1,000,000
daily cost          = per request × requests per day
monthly cost        = daily cost × 30
cache savings       = (cached input × (input rate − cache rate) × requests per day × 30) ÷ 1,000,000

Rates are per million tokens and the currency is whatever you enter — the tool performs no FX conversion and ships no price list. A month is thirty days, a round assumption for comparison rather than a calendar month. The hit rate is token-weighted, not request-weighted; cached input is already inside the total input and is not billed twice.

The boundaries matter: the result excludes hidden reasoning tokens, failed retries, tool definitions, image and audio inputs, cache-write fees, taxes, regional surcharges and volume discounts. Providers may apply long-context tiers, where the same model costs differently at different context lengths; enter the rate for the tier you actually use instead of the default one. Real spend is what the usage dashboard and invoice report. This is for option comparison and a first-pass budget only.

Reading the output

A quoted per-million rate is a headline, not a bill — input, output and cached reads are three different prices. Output usually costs several times more than input, so a prompt change that asks for shorter answers often moves the number more than swapping to a cheaper model. A long system prompt is re-sent every turn, but the cached portion is billed at a much lower rate; the higher the hit rate, the larger the saving.

The rate fields start empty because providers reprice; a number baked into this page would age into a wrong answer. That is why this page offers arithmetic only. When a provider changes prices, you edit four fields and leave the formula and the conclusion intact.

Reading three different workload shapes

The same rates produce very different conclusions once the usage mix changes. A light internal tool has few requests and short inputs and outputs: the per-request figure is nearly negligible and fixed costs matter more than tokens. Support and knowledge-base traffic is input-heavy, so the long prompt is the main cost source and pulling a stable prefix out for cache hits usually cuts a meaningful slice. Content generation is the reverse: output length drives the bill, so capping generation length and asking for structured output beats shaving the prompt.

The output table lists the three charges separately. Change one variable and only that line moves, which is far more useful than a single total: when a total changes you cannot tell what changed, while separate lines point at the knob to turn. If savings stay small after you raise the hit rate from zero, the stable prefix was a small share of input to begin with — look at output length before restructuring prompts again.

Mismatched units are the most common way to get this wrong

Normalise before multiplying. Some platforms quote per million tokens, others per thousand; some bill in dollars, others in local currency; some split off-peak from peak. Before multiplying two numbers, confirm they share a unit, a currency and a time window. The tool deliberately does not guess units or convert currency: an automatic conversion that guesses wrong is harder to spot than a field you filled yourself.

Another trap is whether "total input" already includes the cached portion. Providers differ: some count hit tokens inside total input, others list them as a separate category. If you charge full input price on the total and then add the cache charge on top, you have billed the same tokens twice. This tool assumes cached input is included in the input token count: the hit portion uses the cache rate, the rest uses the input rate, and the two lines never overlap. Check your provider's field definitions before filling the form.

Tiered routing deserves its own calculation, too. Sending simple questions to a cheaper model and hard ones to a flagship changes the average rate for the same traffic. Run both request classes through the tool separately, then add the monthly figures, rather than multiplying one blended average by total volume — an average hides differences in input/output ratios and tends to look optimistic. Once you have production logs, recompute against the real distribution.

Official references