A price per million tokens is not a budget. The invoice is shaped by traffic, context length, generated output, prompt-cache eligibility, and every call your system repeats after a failure.

Build the estimate with your current prices

The free calculator separates input and output spend, applies cache savings only to eligible input tokens, and shows retry cost as its own line item. Nothing is uploaded or stored.

The monthly LLM cost formula

Monthly cost = input spend + output spend + attached per-request charges, all adjusted for retry overhead.

Input spend uses the effective input price after caching. Output spend uses the separate generated-token price. Attached charges can include retrieval, web search, gateways, tools, or observability that run with each request.

The important distinction is between an original product request and a billable model call. If validation failures, timeouts, or regeneration add 8% more calls, those tokens belong in the budget even though users never asked for them.

A worked example

Assume a product handles 100,000 requests per month. Each request averages 1,200 input tokens and 300 output tokens. Input costs $1 per million tokens, output costs $5 per million, 30% of input tokens receive a 75% cache discount, and retries add 8% overhead.

  • Input spend: $100.44

  • Output spend: $162.00

  • Retry spend already included above: $19.44

  • Cache savings versus fully uncached input: $29.16

  • Total estimated monthly API cost: $262.44

The output is not a quote. It is an inspectable baseline. Replace every example number with the current provider rate and your own traces.

Four assumptions that usually break the estimate

1. Input and output tokens are treated as one price

Providers commonly charge different rates for tokens sent to a model and tokens generated by it. Output often costs more, so one blended token price can hide the real driver.

2. Every prompt is assumed to hit the cache

Cache savings depend on eligibility, prefix stability, lifetime, minimum token rules, and actual hit rate. Model the observed cached share—not the share you hope to reach.

3. One user request is assumed to equal one model call

Tool errors, schema validation, timeouts, fallback models, and regeneration can multiply calls. Measure retry overhead from traces and keep it visible as a separate budget line.

4. The model is treated as the whole system

Retrieval, search, vector databases, sandboxes, gateways, and observability may add a per-request cost. Put those charges into the same estimate instead of leaving them in a different spreadsheet.

What to pull from production logs

  • Original product requests per day and per month

  • Median and high-percentile input tokens per request

  • Median and high-percentile output tokens per request

  • Cache-eligible tokens and observed cache-hit share

  • Extra model calls caused by retries, fallbacks, and validation failures

  • Retrieval, search, tool, gateway, and observability cost per request

Run at least a conservative, base, and high-traffic scenario. A budget is useful when it exposes what changes the decision, not when it produces one precise-looking number.

Model your workload

Enter your own traffic, token lengths, provider prices, cache rate, retry overhead, and attached usage costs.

ResearchAudio turns AI launches into evidence, costs, limitations, and practical adoption decisions. Join 52,000+ engineers and builders for the daily briefing.

Keep Reading