LLM Cost Calculator: What Per-Token Pricing Misses
Every LLM cost calculator asks you for two numbers you do not have: input tokens and output tokens. You guess, it multiplies by list price, and the answer is wrong — usually low. We can show exactly how wrong. In our executed coding benchmark, Gemini 3.6 Flash lists at $1.50 / $7.50 per 1M tokens and Claude Sonnet 5 at $2 / $10 — prices checked 2026-07-29, and Sonnet 5 is the pricier sticker on both sides. Yet Sonnet 5 measured $1.67 per 1,000 tasks against Gemini 3.6 Flash's $8.02. The gap is reasoning tokens: 933 per task for Gemini, 0 for Sonnet 5. This page gives you the formula that actually works, a measured table for every model we ran, and the 20-request check that beats any calculator, ours included.
Why token guesses break the estimate
A calculator that only models the per-token rate misses one of the two ways an LLM bill runs away. The first way is obvious: a high rate. The second is a modest rate multiplied by a token count nobody predicted, because the model thought at length before answering and you were billed for every one of those hidden tokens.
We can put numbers on this because we ran the models. Our executed coding benchmark gives every model the same nine Python tasks, scores each answer by running the returned code against assertions the model never sees, and records the exact token counts the API reports back. Cost is then those token counts multiplied by that model's list price. It is a measured cost, not a vendor invoice.
| Model | List price / 1M (2026-07-29) | Reasoning tokens per task | Measured cost / 1,000 tasks |
|---|---|---|---|
| Claude Sonnet 5 | $2 / $10 | 0 | $1.67 |
| Gemini 3.6 Flash | $1.50 / $7.50 | 933 | $8.02 |
| Qwen3 Coder Next | $0.12 / $0.80 | 0 | $0.10 |
| GPT-5.5 | $5 / $30 | 176 | $8.83 |
Read the first two rows together. Sonnet 5 has the higher sticker on both input and output, and still came in 4.8x cheaper per task. A calculator fed list prices would have ranked them the other way round. Now read the last two. Qwen3 Coder Next and GPT-5.5 both emit little or no reasoning, so for them the sticker price really is the driver — and it produces an 88x spread between the cheapest and priciest model that scored a clean sweep on our set. Two different failure modes, and only one of them is on a rate card.
max_tokens 4000, one scored attempt each, run through OpenRouter's OpenAI-compatible endpoint — deliberately not through our own gateway, so the figures do not depend on our infrastructure. List prices above are our 2026-07-29 capture; the measured costs price each run's reported tokens at the rates in force on its run date. Full method: our testing methodology.The formula, with the term calculators drop
The arithmetic itself is not the hard part:
cost_per_task = (input_tokens × input_price_per_token)
+ (output_tokens × output_price_per_token)
# prices are quoted per 1M tokens, so:
# input_price_per_token = list_input_price / 1_000_000
The term that breaks estimates is output_tokens. People fill it in by imagining the answer they expect — 400 tokens of code, say — because that is the part they will see. But on an OpenAI-compatible API, completion_tokens already includes reasoning tokens, and reasoning tokens are billed at the output rate. The visible answer can be 400 tokens while the billed completion is 3,000.
So the rule is short: output_tokens must be the number the API reports, not the number you can read on screen. If your estimate came from eyeballing a sample response, it is an estimate of the wrong quantity.
Two smaller things also move the total and are worth knowing before you trust any figure. Input and output are priced separately, and output is typically several times more expensive — for GPT-5.5 it is 6x ($5 in, $30 out). And a long system prompt is charged on every request, so it multiplies with volume in a way a one-off calculation hides. Our guide to estimating LLM API costs works through the monthly-volume side of that in detail.
A worked example with measured numbers
Take Gemini 3.6 Flash, which we ran on the same harness after our 13-model sweep. Its list output price is $7.50 per 1M tokens, and it spent an average of 933 reasoning tokens per task across our nine tasks:
reasoning_cost_per_task = 933 × ($7.50 / 1_000_000)
= $0.0070
per 1,000 tasks = $7.00
measured total = $8.02 per 1,000 tasks
→ everything else (prompt + visible answer) = $1.02 per 1,000 tasks
About 87% of that bill is tokens the user never sees. A calculator that asked you to guess the length of the answer would have returned something near $1.02 and been off by 7.9x. Meanwhile Claude Sonnet 5, on the identical nine tasks, reported zero reasoning tokens and measured $1.67 per 1,000 — its whole bill is the part you can see.
The reasoning budget is not even stable within one model. Here is what Gemini 3.6 Flash spent on each of our nine tasks, from the same run:
That spread is the practical warning. If you sample one easy request to calibrate a calculator, you will set your budget from the 341-token case and get billed for the 2,615-token case. Wall-clock time moved with it, from 3.4 s to 14.2 s on the same nine tasks.
Measured cost vs a no-reasoning estimate
Below is every model we ran, with what a naive estimate would have predicted. The no-reasoning estimate column is the measured cost minus the reasoning tokens priced at that model's list output rate — in other words, what a calculator would have told you if you had filled in output_tokens from the visible answer alone. The last column is how far off that would have been.
| Model | List price / 1M (2026-07-29) | Reasoning tok/task | Measured / 1,000 tasks | No-reasoning estimate | Off by |
|---|---|---|---|---|---|
| Gemini 3.6 Flash | $1.50 / $7.50 | 933 | $8.02 | $1.02 | 7.9x |
| DeepSeek V4-Pro | $0.43 / $0.87 | 732 | $0.74 | $0.10 | 7.4x |
| GLM 5.2 | $0.72 / $2.27 (at run: $0.93 / $3) | 559 | $1.99 | $0.31 | 6.4x |
| MiniMax M3 | $0.30 / $1.20 | 623 | $0.90 | $0.15 | 6.0x |
| DeepSeek V4-Flash | $0.14 / $0.28 (at run: $0.09 / $0.18) | 568 | $0.13 | $0.03 | 4.3x |
| Nemotron 3 Ultra | $0.50 / $2.20 | 373 | $1.07 | $0.25 | 4.3x |
| Kimi K2.7 Code | $0.73 / $3.50 (at run: $0.74 / $3.50) | 272 | $1.34 | $0.39 | 3.4x |
| Grok 4.3 | $1.25 / $2.50 | 482 | $1.75 | $0.55 | 3.2x |
| GPT-5.5 | $5 / $30 | 176 | $8.83 | $3.55 | 2.5x |
| Step 3.7 Flash | $0.20 / $1.15 | 450 | $2.66 | $2.14 | 1.2x |
| Claude Opus 4.8 | $5 / $25 | 0 | $4.05 | $4.05 | 1.0x |
| Claude Sonnet 5 | $2 / $10 | 0 | $1.67 | $1.67 | 1.0x |
| Mistral Medium 3.5 | $1.50 / $7.50 | 0 | $0.87 | $0.87 | 1.0x |
| Qwen3 Coder Next | $0.12 / $0.80 (at run: $0.11 / $0.80) | 0 | $0.10 | $0.10 | 1.0x |
The pattern is not subtle. For the four models that reported zero reasoning tokens, a rate-card calculator is exactly right. For the rest it is low by 1.2x to 7.9x, and there is no way to tell which group a model is in by looking at its pricing page. The models with the worst error are not the expensive ones — Gemini 3.6 Flash, DeepSeek V4-Pro and GLM 5.2 all look cheap on paper.
Four of these prices moved in the twelve days after the run, and one of them reorders the table. GLM 5.2's output rate fell from $3 to $2.27 and DeepSeek V4-Flash's rose from $0.18 to $0.28; Qwen3 Coder Next and Kimi K2.7 Code shifted a cent on input. Re-priced at the 2026-07-29 rates, the identical token counts come to roughly $1.51 per 1,000 tasks for GLM 5.2 instead of $1.99, and exactly $0.20 for DeepSeek V4-Flash instead of $0.13. The GLM move is the one that inverts something: at the rates we ran it, GLM 5.2 cost more per task than Claude Sonnet 5's $1.67 — at today's rates it costs less, and the chart below, which is drawn from the run, still shows it the old way round. The off by column barely moves in either case, because the measured total and the reasoning term scale with the same output rate. That is the argument for dating a price rather than printing it as a fact.
LLM cost per token comparison
Ranking models by cost per token gives a different order than ranking them by cost per task. This chart shows both for six models: the light bar is the no-reasoning estimate a per-token calculator would produce, the blue bar is what we measured.
Three practical readings come out of this. First, cheap-per-token can be expensive per task: Gemini 3.6 Flash is priced below Claude Sonnet 5 on both input and output and cost 4.8x more to do the same work. Second, a high rate card is expensive even when the model barely thinks: GPT-5.5 at $5 / $30 emitted only 176 reasoning tokens per task — the fewest of any model here that reasoned at all — and still measured $8.83 per 1,000 tasks, the highest figure in the field. At a $30 output rate even that short think adds $5.28 per 1,000 tasks, which is why its estimate is still 2.5x low. Third, a terse model at a low rate is the only combination that is cheap on both counts — Qwen3 Coder Next at $0.12 / $0.80 with zero reasoning tokens measured $0.10 per 1,000 tasks and still scored 9/9.
If your workload looks like short, well-specified coding tasks, the full field and the accuracy scores behind these costs are in our cheap coding model comparison.
Run 20 requests and read the usage field
The reliable move is not to use a better calculator. It is to stop calculating. Take twenty prompts that look like your actual production traffic, send them, and add up what the API tells you it charged for. That takes a few minutes and a few cents, and it replaces every assumption at once — prompt length, answer length, reasoning depth, and whatever the model does that you did not anticipate.
from openai import OpenAI
client = OpenAI(base_url="https://www.datallmlab.com/v1", api_key="$DATALLMLAB_API_KEY")
IN_PRICE, OUT_PRICE = 0.72, 2.27 # per 1M tokens, GLM 5.2 list as of 2026-07-29
totals = {"in": 0, "out": 0, "reasoning": 0}
for prompt in my_real_prompts: # 20 of them, not 1
r = client.chat.completions.create(
model="z-ai/glm-5.2",
messages=[{"role": "user", "content": prompt}],
)
u = r.usage
totals["in"] += u.prompt_tokens
totals["out"] += u.completion_tokens # already includes reasoning
d = getattr(u, "completion_tokens_details", None)
totals["reasoning"] += getattr(d, "reasoning_tokens", 0) or 0
n = len(my_real_prompts)
cost = totals["in"] / 1e6 * IN_PRICE + totals["out"] / 1e6 * OUT_PRICE
print(f"in {totals['in']//n} out {totals['out']//n} "
f"(reasoning {totals['reasoning']//n}) "
f"= ${cost / n * 1000:.2f} per 1,000 tasks")
Two details matter in that snippet. completion_tokens already includes reasoning_tokens, so you price the completion once and do not add reasoning again. And completion_tokens_details is absent on providers and models that do not report it, which is why it is read defensively — a model that returns nothing there is telling you it spent no separate reasoning budget, or that it does not disclose one.
Twenty is a floor, not a target. Our own per-task spread of 7.7x on a single model says a handful of samples can land anywhere. Sample across the easy and hard ends of your traffic, and re-run after any prompt change. If the number comes back higher than you can live with, the levers are in our guides to cutting LLM API costs and cutting token costs in coding agents.
What this does not tell you
We would rather name the gaps than let you over-read the table.
- These are our tasks, not yours. Nine short Python problems. The reasoning ratios we measured are a property of this workload as much as of the models. Your prompts will produce different ratios — which is the whole argument for measuring your own.
- The harness does not cover long-context reasoning, multi-file refactoring, agentic tool use, or non-Python work. A 4,000-token output ceiling can also cut off a very verbose model and score it as a miss.
- Cost is computed, not invoiced. It is the exact token counts the API reported multiplied by list price. It excludes prompt caching, batch discounts, committed-use pricing and free tiers, all of which can move a real bill substantially.
- List prices move — four of the ones on this page moved within twelve days. The prices here are our 2026-07-29 capture; the measured costs are priced at the rates in force when each model was run (2026-07-17 for the core sweep, 2026-07-28 for Gemini 3.6 Flash), which is why the two are labelled separately. Check the live pricing table before you commit a budget to any number on this page.
- Zero reasoning tokens is a run-time observation. Several models here reported none in this configuration. Turning on an extended-thinking mode where one exists would change both the score and the cost.
That last caveat cuts both ways, and it is the honest summary of this whole page: the number that governs your bill is one only your own traffic can produce. Use a calculator to sanity-check an order of magnitude. Use twenty real requests to set a budget.
Measure it on the models you are actually choosing between
One OpenAI-compatible endpoint, 300+ models, live per-token prices — swap the model id and re-run the same twenty prompts to compare measured cost per task instead of rate cards.
FAQ
What is the formula for LLM cost per task?
cost_per_task = (input_tokens × input_price) + (output_tokens × output_price), with prices divided by 1,000,000 since they are quoted per 1M tokens. The critical detail is that output_tokens must be the API-reported completion count, which includes reasoning tokens, not the length of the answer you can read.
Why do LLM cost calculators underestimate?
Because they ask you to guess an output token count, and people guess from the visible answer. In our executed run, models that emitted reasoning tokens cost 1.2x to 7.9x more than that guess would predict. Gemini 3.6 Flash was the worst case: 933 reasoning tokens per task at $7.50 per 1M output meant about 87% of its bill was tokens the user never sees.
Does a lower price per token mean a lower bill?
Not reliably. Claude Sonnet 5 lists at $2 / $10 and Gemini 3.6 Flash at $1.50 / $7.50 (list prices, 2026-07-29) — the cheaper sticker on both sides — yet Sonnet 5 measured $1.67 per 1,000 tasks against Gemini 3.6 Flash's $8.02 on the identical nine tasks. Per-token price predicts the bill only for models that do not reason.
Which model was cheapest per 1,000 tasks in your test?
Qwen3 Coder Next, at $0.10 per 1,000 tasks with a 9/9 score and zero reasoning tokens. The priciest model that also scored 9/9 was GPT-5.5 at $8.83 — an 88x spread across models that all got every task right.
How many requests should I run before trusting a cost estimate?
At least twenty, drawn from real traffic and spanning both easy and hard cases. Gemini 3.6 Flash's reasoning budget ranged from 341 tokens on our simplest task to 2,615 on our hardest — a 7.7x spread inside one model — so a small or easy sample will set your budget far too low.
Are these numbers your actual invoices?
No, and we do not present them as such. Each figure is the exact token count the API reported multiplied by that model's list price. It is a measured cost, not a vendor billing statement, and it excludes caching, batch and committed-use discounts.
DataLLM Lab