Direct answer
Calculate the token mix, not just a headline rate
LLM API cost is the sum of each billed token bucket multiplied by its own rate. Enter average usage per request, then project that exact workload over daily traffic and active days. No vendor price is baked into the result: the visible $1 starter rates are neutral placeholders you should replace.
Estimate a mixed LLM workload
Enter average tokens per request, paste your current provider rates per million, and choose request volume. The starter $1 rates are neutral worksheet values—not vendor pricing.
Monthly API-equivalent cost
$495
3,000 requests across 30 active days
Cost per request
$0.165000
165,000 entered tokens across four billing buckets
Daily cost
$16.50
100 requests per active day
Ordinary input / request
$0.100000
100,000 tokens × $1/M
Cache write / request
$0.010000
10,000 tokens × $1/M
Cache read / request
$0.050000
50,000 tokens × $1/M
Reasoning / output per request
$0.005000
5,000 tokens × $1/M
Load a usage shape
Illustrative scenarios dated August 28, 2026. They replace token volume only and preserve your custom rates and active days.
Keep the estimate auditable
- 1. Copy rates today. Record provider, model, region, API mode, currency, and pricing-page date.
- 2. Measure a representative sample. Average the four buckets over successful and failed billable calls.
- 3. Reconcile later. Compare this API-equivalent forecast with the provider's usage and invoice exports.
Transparent math
How LLM API cost is calculated
First calculate a per-request cost for ordinary input, cache writes, cache reads, and generated output. Then multiply only after the per-request mix is correct. This makes an incorrect cache assumption or unit conversion easier to find.
Classification
Put each token in one billing bucket
New and uncached input
System instructions, user messages, retrieved context, tool results, and conversation history that the provider bills at its ordinary input rate. Repeated text is not automatically a cache read.
Cache write and cache read
A write stores eligible input under the provider's caching rules. A read reuses that stored input on a later request. Count only confirmed billed cache activity, because expiry, prefix changes, and provider rules can turn an expected hit into ordinary input.
Reasoning and generated output
Visible responses, code, tool-call arguments, and any billed reasoning tokens that use the generated-token rate. Provider dashboards may expose hidden reasoning differently, so use the billable count rather than estimating from visible text.
Example dated August 28, 2026
Worked scenario: a cached internal coding assistant
These worksheet rates are deliberately illustrative and represent no provider. They show how the same request becomes a monthly forecast; replace them with your current contracted rates.
| Bucket | Tokens/request | Worksheet $/M | Cost/request |
|---|---|---|---|
| Ordinary input | 12,000 | $2.00 | $0.024000 |
| Cache write | 4,000 | $2.50 | $0.010000 |
| Cache read | 48,000 | $0.20 | $0.009600 |
| Reasoning / output | 6,000 | $8.00 | $0.048000 |
| Per request | 70,000 | — | $0.091600 |
Requests/day
150
Active days
22
Monthly estimate
$302.28
Sensitivity
Find the variable that moves the budget
Change one input at a time: output length, context size, cache-hit volume, request count, or active days. The largest dollar movement identifies the assumption worth measuring more carefully. For spiky workloads, run low, expected, and high scenarios instead of presenting one point estimate as certainty.
Reconciliation
Explain the forecast-to-invoice gap
Save the exact rates, date, and token sample used here. When billing data arrives, compare bucket totals before comparing dollars. A changed traffic mix, cache miss, model route, or output length often explains more than price drift. Then update the calculator inputs rather than adding an unexplained blanket buffer.
Frequently asked questions
Is this LLM cost calculator tied to one provider?
No. Every rate is editable, so the same worksheet can model a direct model API, a cloud-hosted endpoint, or a gateway. Copy all four applicable rates from the provider and model you will actually use. Do not mix one provider's input rate with another provider's cache or output rate.
Should cached tokens also be counted as ordinary input?
Not when the provider reports a cache hit and bills those tokens in a separate cached-input bucket. Put each billed token in exactly one bucket. Context that missed the cache belongs in ordinary input; context written into a separately billed cache belongs in cache write.
Where do reasoning tokens go?
Put billed reasoning tokens in the reasoning/output field when the provider prices them as generated tokens. If a provider exposes a genuinely separate reasoning rate, calculate that line independently with the same tokens-divided-by-one-million formula, then add it to this result.
Why can this estimate differ from my invoice?
An invoice can include batch discounts, data-residency or platform premiums, free tiers, rounding, failed requests, tools, storage, taxes, and negotiated rates. Subscriptions and coding-agent allowances are also not equivalent to API token pricing. Treat this as a transparent forecast and reconcile it with billing exports.
How should I forecast a production workload?
Use request logs from a representative period instead of one hand-picked prompt. Segment materially different routes, calculate each route separately, and add a range for traffic growth and token variance. P50 helps with a typical request; a higher percentile helps expose long-context cost risk.
Sources
- LiteLLM model pricing dataset
Public model pricing reference used for API-equivalent estimates; provider billing remains authoritative.