Viktar Patotski · · AI · 8 min read
LLM Feature Cost: How the Token Cost Calculator Works
The method behind the token cost calculator: the formula, the dated price table, how cache, batch, retries and EU residency apply, and a worked example.
TL;DR - The per-token price is not the cost of your feature. The cost is the per-token price run through your actual usage. This page is the method behind the token cost calculator:
- The formula: monthly active users, times sessions each, times calls per session (1 for a simple call, more for an agent that loops), plus retries, times tokens per call, with input and output priced separately.
- The levers it models: cached input, batch, EU data residency, and the cost per tenant. Each uses the provider’s published rate and is skipped when that rate is not verified.
- What drives the bill: the input side is usually bigger than founders expect, because retrieval stuffs the prompt. Output costs more per token, so long answers hurt.
The number is knowable before you build. Estimate it, do not discover it on the invoice.
The sticker price is a trap
You are about to add an AI feature. You open the pricing page, see a few dollars per million tokens, multiply by “some tokens,” and conclude it is basically free. Then the first real invoice arrives and it is a line item you have to explain.
The gap is that the per-token price tells you almost nothing on its own. A token is roughly four characters, about three-quarters of a word. The cost of your feature is that price run through how many people use it, how often, how much text goes in and comes back, how often it retries, and whether the thing loops.
The prices the calculator uses
One table feeds both this page and the calculator. Every row carries the date it was last checked against the provider’s own price page (the date is the link):
| Model | Input | Cached input | Output | Batch | EU residency | Verified |
|---|---|---|---|---|---|---|
| Claude Fable 5 | $10 | $1 | $50 | n/a | n/a | 7 Nov 2026 |
| GPT-6.1-sol | $2 | $0.1 | $10 | n/a | n/a | 7 Nov 2026 |
| GPT-5.5 Superseded by the GPT-6 family. Prompts over 272K input tokens: 2x input, 1.5x output. | $5 | $0.5 | $30 | n/a | n/a | 7 Nov 2026 |
| Claude Opus 5.5 | $4 | $0.2 | $20 | n/a | n/a | 7 Nov 2026 |
| Claude Opus 4.8 Superseded by Claude Opus 5.5. | $5 | $0.5 | $25 | n/a | n/a | 7 Nov 2026 |
| Claude Sonnet 5.5 | $2 | $0.1 | $10 | n/a | n/a | 7 Nov 2026 |
| Claude Sonnet 5 Superseded by Claude Sonnet 5.5 (same price, cheaper cached input: $0.10). | $2 | $0.2 | $10 | n/a | n/a | 7 Nov 2026 |
| Mistral Large Price page does not name the model version. | $0.5 | n/a | $1.5 | n/a | n/a | 7 Nov 2026 |
| Claude Haiku 5.5 Prompts up to 100K tokens. Above: $0.50 input, $2.50 output, $0.05 cached. | $0.1 | $0.01 | $0.5 | n/a | n/a | 7 Nov 2026 |
| Claude Haiku 4.5 Superseded by Claude Haiku 5.5. | $1 | $0.1 | $5 | n/a | n/a | 7 Nov 2026 |
| GPT-6-luna | $0.1 | $0.01 | $0.5 | n/a | n/a | 7 Nov 2026 |
| GPT-5.4-nano Deprecated by OpenAI. | $0.2 | $0.02 | $1.25 | n/a | n/a | 7 Nov 2026 |
| DeepSeek Flash Peak-hour price. Off-peak: $0.15 input, $0.60 output, $0.003 cached. | $0.3 | $0.006 | $1.2 | n/a | n/a | 7 Nov 2026 |
USD per 1M tokens. Batch = discount on calls sent through the provider's batch API. EU residency = extra charge for EU-only processing. n/a = not verified, not applied by the calculator. The date links to the provider's price page.
The first thing to notice: output is the expensive side on every row. A feature that reads a little and writes a lot is priced very differently from one that reads a lot and answers briefly.
The formula
This is exactly what the calculator computes for each model, in code so it is unambiguous:
double calls = mau * sessionsPerUser * callsPerSession * (1 + retryRate);
double inputTokens = calls * inputTokensPerCall;
double outputTokens = calls * outputTokensPerCall;
// Cached input is billed at the provider's cached-input price.
double effectiveInputPrice = (1 - cacheHitRate) * inputPrice + cacheHitRate * cachedInputPrice;
double monthlyCost = (inputTokens / 1_000_000.0) * effectiveInputPrice
+ (outputTokens / 1_000_000.0) * outputPrice;
monthlyCost *= 1 - batchShare * batchDiscount; // only the calls you send through batch
monthlyCost *= 1 + euUplift; // only if you need EU data residency
double perTenant = monthlyCost / tenants;Each line maps to one input on the calculator:
- Calls per session. One clean call per action is the happy path. An agent that reasons, calls a tool, reads the result and calls again is several calls for one user action, and each one pays for its full prompt again.
- Retry rate. You pay for calls that time out, fail validation or get retried.
- Cache-hit rate. The share of input tokens served from the provider’s prompt cache. It only applies to the input side and only if your prompt has a stable prefix (system prompt, fixed knowledge) that you designed to be cached.
- Batch share. The share of calls that can wait for the provider’s batch API instead of answering in real time.
- EU data residency. Some providers charge extra for EU-only processing and some do not offer it at all. The calculator adds the uplift where one is published and greys out models with no EU region.
- Tenants. Divides the bill by your customer count, which is the number you need for pricing a feature per seat or per plan.
When a provider’s rate for a lever is not verified in the table, the calculator shows n/a for that model and applies no discount, so the estimate errs high, never low.
A worked example
Take an internal copilot, the kind of feature a vertical SaaS bolts onto its product. Say 3,000 monthly active users, each active about 18 days a month, four sessions a day. That is 216,000 sessions a month. Each call sends 2,500 input tokens (the user’s question plus retrieved context) and gets back 400. Add 1.5 calls per session and an 8% retry rate:
- Calls: 216,000 x 1.5 x 1.08 = 349,920 a month
- Input: 349,920 x 2,500 = 875M tokens
- Output: 349,920 x 400 = 140M tokens
With Claude Sonnet 5 at $2 per 1M input tokens and $10 per 1M output (verified 7 Nov 2026, see the table above):
- Input: 875M x $2 = $1,750
- Output: 140M x $10 = $1,400
- Total: about $3,150 a month
At a 35% cache-hit rate, 35% of the input is billed at the cached rate of $0.20, so input costs 875M x (0.65 x $2 + 0.35 x $0.20) = $1,199 and the total drops to about $2,600 a month.
(Illustrative, built on stated assumptions, not a real client bill.) The point is not the exact figure. It is that “a few dollars per million tokens” becomes a few thousand dollars a month, and every input to that was knowable in advance. These are the calculator’s default inputs, so you can open the same scenario and change one number at a time.
What actually drives the bill
- Retrieved context is the silent cost. The moment you add retrieval over your domain data, every request carries the retrieved chunks as input tokens. That is usually where the input number balloons, not the user’s actual question. Retrieve less, and retrieve more precisely.
- Output length. It is the expensive side. Capping response length and asking for structured, terse output is a direct cost lever, not just a UX choice.
- Retries and failures. You pay for calls that error out or get retried. Timeouts and aggressive retry policies quietly multiply spend.
- Agent loops. A single completion is one unit. An agent that reasons, calls a tool, reads the result, and calls again can be five or ten units for one user action. This is the multiplier that turns a cheap feature expensive.
The levers that actually cut it
- Prompt caching. If a large, stable chunk of your prompt repeats (a system prompt, a fixed knowledge base), providers bill cached input at a fraction of the normal rate (the cached-input column above). This is the highest-leverage optimization for most RAG features.
- Batch processing. For anything that does not need to be real time, some providers offer a batch API at a different price. No batch rate is verified in the table above yet, so the calculator applies none; check the provider’s page.
- Model tiering. The biggest lever is often the dumbest: do not send easy calls to your most expensive model. Route the simple classification or extraction to a Haiku or a nano tier, reserve the flagship for the calls that need it. Halving the model price beats most clever engineering.
- Trim context and cap output. The two levers you fully control on every request. Both directly reduce the token counts in the formula.
Cost and latency trade off
Cost is one axis; the other is speed, and they pull against each other. A bigger model reasons better and costs more and is usually slower. What users feel is time to first token: under a second reads as instant, past two seconds they notice. Streaming does not make the full answer finish sooner, but it puts the first words on screen fast, so the feature feels responsive even on a slow model. The cheap, fast tiers (Haiku, the nano models) sit under about 600ms to first token, which is why routing easy calls to them helps the bill and the experience at once.
When to self-host
Founders reliably overestimate the savings. Running an open model on your own GPUs looks cheaper per token in a spreadsheet, but the real cost is three to five times the raw GPU rental once you count idle time, DevOps, and the engineer-hours to keep it healthy (call it 10 to 20 hours a month of senior time). The break-even against a frontier API sits somewhere north of 100 million tokens a day. Below that, and that is almost everyone, the API is cheaper, and it is not close once the engineers are on the ledger. Self-host when data residency or volume forces it, not to save money at small scale.
The honest takeaway
An LLM feature’s cost is not a mystery you discover on the invoice. It is a calculation you can run before you write a line: your users, your sessions, your token sizes, your model. Plug your own numbers into the token cost calculator and you will have a defensible monthly figure in a minute, which is exactly what you want before you commit to building. And cost is only one input to the build decision, alongside latency, reliability, and whether the feature needs AI at all.
Summary
The per-token price is the sticker, not the cost. The cost is that price run through real usage: users, sessions, input and output tokens, retries, cache hits, and how many times an agent loops. Model it before you build, watch the output side and the retrieved context because that is where the money goes, pull the levers (caching, batch, cheaper models for easy calls), and skip self-hosting until your volume genuinely forces it. The number is knowable. Know it first.
Weighing an AI feature and want a straight answer on what it will cost and whether it is worth building? That is the first conversation in AI Enablement. Book a free 30-minute call and we will size it against your real numbers.