How do I calculate LLM API cost with the LLM pricing calculator?

Updated

To estimate the cost of one LLM API call on llm-prices.com, enter four numbers: input (prompt) tokens, cached input tokens, output (completion) tokens, and the per-million-token prices for each of those three categories. The calculator multiplies each token count by its matching price and shows a single total cost. This works for any model as long as you have its per-million-token rates; you do not need an account to use the page.

What the calculator asks for

The page is built around one section, Model prices (per million tokens), plus an input area with these fields:

  • Number of input tokens (also called prompt tokens)
  • Number of cached input tokens
  • Number of output tokens (also called completion tokens)
  • Cost per million input tokens ($)
  • Cost per million cached input tokens ($)
  • Cost per million output tokens ($)
  • Total cost (the result)

The three token fields describe one call. The three price fields describe the model's rates. The total cost is what you read at the end.

Step-by-step: estimating one call

  1. Get your token counts. For a single request, count the tokens in your prompt (input), the tokens in the model's reply (output), and any prompt tokens served from cache (cached input). If you don't have exact counts, use your provider's tokenizer or a rough estimate, then treat the result as approximate.
  2. Enter the input token count in the Number of input tokens field. This is the full prompt size, including any cached portion if your provider counts it that way — check how your provider splits cached vs. uncached input.
  3. Enter the cached input tokens in the Number of cached input tokens field. Leave it at zero if nothing was cached.
  4. Enter the output token count in the Number of output tokens field.
  5. Fill in the three prices from the model's pricing page: cost per million input tokens, cost per million cached input tokens, and cost per million output tokens. Enter them as dollars per million tokens, matching the label on each field.
  6. Read the Total cost. That figure is the estimated cost of the call at those rates.

The page also lists Model prices (per million tokens) with columns for input cost, cached cost, and output cost, and a Compare Prices view, so you can look up rates instead of typing them from memory. A Show just selected / Clear selection control lets you narrow the model list, and a View source on GitHub link is provided.

A worked example

Suppose one call uses 2,000 input tokens, 1,500 of which are cached, and 500 output tokens. The model's rates are $3 per million input, $0.30 per million cached input, and $15 per million output.

  • Uncached input: 2,000 − 1,500 = 500 tokens → 500 × $3 / 1,000,000 = $0.0015
  • Cached input: 1,500 × $0.30 / 1,000,000 = $0.00045
  • Output: 500 × $15 / 1,000,000 = $0.0075
  • Total ≈ $0.00945

Entering the same numbers into the calculator should return that total. If your provider bills cached tokens differently (for example, charging the full input rate and applying a discount separately), adjust the split so the fields match how the bill is actually computed.

Common snags

  • Tokenizer differences. The page itself notes that different models use different tokenizers, so direct token-based price comparisons may not be entirely accurate. A token count from one model won't map exactly onto another.
  • Cached vs. uncached input. Decide up front whether your input field already includes the cached tokens. Double-counting or omitting them is the most common source of a wrong total.
  • Per-million units. All three price fields are dollars per million tokens. Entering a per-thousand rate will inflate the result by 1,000×.
  • One call vs. many. The total reflects a single call's token counts. For a workload, multiply by the number of calls, or sum token counts across calls and enter the total.
  • Rates change. The model price list shows a last updated timestamp; confirm current rates before relying on a comparison.