Why token math matters

The cost-per-token derivations, where each provider's pricing sheet diverges from a textbook attention cost model, and what changes when you actually do the math.

If you've only read the headline price on a model provider's pricing page, you've been lied to about cost.

This is the math version of How LLM token pricing actually works — the worked example covers what to compare on a price sheet; this one walks through where the numbers come from in the first place, and where each provider's sheet quietly diverges from a textbook attention cost model.

Three things drive the per-token cost of an inference call: the GPU time it takes, what that GPU time costs the provider, and the share of that cost the provider decides to bill you. Most of the variation across providers shows up in that third lever, not the first two — which is why two providers can run the same model on the same hardware and charge meaningfully different rates.

What a token actually costs at the GPU layer

A modern transformer doing a single inference call does two qualitatively different kinds of work.

Prefill. When your prompt enters the context, the model computes the key-value (KV) cache for every input token and produces the first output token. Prefill is compute-bound: every parameter is touched once per token, the FLOP count per token is roughly 2 × parameters, and the bottleneck is the GPU's matrix-multiply throughput.

Decode. Every subsequent output token does one new attention pass against the full KV cache and a forward pass through the model. Decode is memory-bandwidth-bound: each step re-reads the parameters and the growing KV cache, but the matrix it produces is small (vocabulary × 1) compared to the prefill matmul. The bottleneck is the GPU's HBM bandwidth, not its FLOP throughput.

This is the asymmetry that drives the per-token cost difference between input and output. Prefill saturates compute; decode saturates memory I/O. On the same hardware, decode steps typically run a few times more expensive than an equivalent-token prefill — the textbook bottom of any output-to-input pricing multiplier.

The headline rate you see on a price sheet is the input rate; the output rate sits above it for exactly this reason. Where each provider sits on that multiplier is the first place two otherwise-identical sheets will diverge.

Why output dominates for most real workloads

If your application emits more output tokens than it consumes input tokens, your effective per-call cost is dominated by the output rate. That's the case for most chat products, code completion, long-form summarization, and any agent loop where the model keeps generating.

A worked example with illustrative numbers, sitting inside the asymmetry band How LLM token pricing actually works called out:

  • A model advertises $3 per million input tokens and $15 per million output tokens — a 5× output multiplier, in the middle of the typical 3–6× band.
  • A summarization workload reads 4,000 input tokens and emits 1,200 output tokens per call.
  • Input cost per call: (4,000 / 1,000,000) × $3 ≈ $0.012.
  • Output cost per call: (1,200 / 1,000,000) × $15 ≈ $0.018.
  • Total: $0.030 per call. Output share of the bill: 60%, even though output is only 23% of the token count.

If your finance team is forecasting spend by token count alone, that gap is the modeling error. It scales with the output-to-input ratio of your workload, and the only honest way to fix it is to work the math through.

Cache economics, from the GPU's point of view

Prompt cache pricing looks like a marketing discount, but it has a real hardware basis: it eliminates redundant prefill.

When you reuse a long system prompt across calls, the provider can hold the KV cache for that prefix in memory across requests for a TTL window (typically 5–10 minutes). On the next call, the model skips prefill for the cached prefix and only does prefill on the new tokens. From the GPU's point of view, half — sometimes most — of the cost of the call just disappeared.

How the provider bills it is the markup lever, and the patterns diverge by provider:

  • Discounted reads on cached prefix, full charge on cache writes. Net effect: the cache is free if your hit rate is high enough to amortize the writes. A 90%-reuse workload pays close to the discount rate on the prefix; a 10%-reuse workload ends up paying close to full price on the prefix plus a small write surcharge on top, which can come out more expensive than no cache at all.
  • Implicit caching with no explicit write charge. Easier to model because input rate × token count is the bill. The catch is that you don't always see your cache hit rate, which makes a forecast assumption less defensible.

The arithmetic matters less than which side of the trade your workload lands on. If cache hit rate is genuinely high, the cache is the biggest cost lever you have. If it isn't, the cache is just an invoice reorganization.

Where the pricing sheet diverges from the textbook

The textbook per-token cost is roughly:

cost_per_token ≈ (gpu_seconds_per_token × gpu_second_cost) × pricing_multiple

gpu_seconds_per_token is the hardware floor and is approximately the same across providers serving the same model — same silicon, same roofline, same workload shape. gpu_second_cost is what the provider pays for the hardware and power, and it's broadly similar across the major labs because frontier-scale H100/H200/B200-class clusters are a competitive commodity market. The pricing multiple is where the visible variation lives, and it's where the textbook floor meets the commercial reality.

Three divergences worth tracking:

  1. Output-to-input asymmetry. Some providers price output at 3× input; others at 5–6×. The output multiplier is the most aggressive markup lever on the sheet — it lets the vendor quote a low headline price while still charging more for the half of the workload that actually does most of the work.
  2. Cache reads vs cache writes. The discount on cache reads is meaningful; the surcharge (or absence) on cache writes is what determines whether caching is a net win. Always compare write rates and read rates separately when modeling.
  3. Batch vs interactive. Batch endpoints slice the same compute at a discount, partly because they can run at higher utilization — the provider packs jobs onto GPUs without holding latency headroom for live traffic. The discount is real but only available where you can defer.

The pattern across all three: the headline price is set by marketing, the workload price is set by which of these levers your traffic activates. If your forecast only sees the headline, you've modeled the cheapest path the vendor offers — not the path your workload will actually take.

How to use this

The math doesn't change the practical advice in How LLM token pricing actually works — it explains why that advice is right, and where to push back when a vendor's invoice doesn't line up with their price sheet.

Three things to carry into the next spend model:

  1. Quote input and output separately, and don't assume a 1:1 ratio. Workload output-to-input ratios range from 0.1× (classification, embeddings) to 5× (long-form generation, agent loops). The model needs the real workload mix to be defensible, not a guess.
  2. List cache hit rate as a model assumption, not a constant. The 90%-reuse path and the 10%-reuse path differ by an order of magnitude on the same workload. Confirm against your traffic rather than guessing.
  3. Don't forget the GPU-second floor. Cross-provider comparison is sound only at comparable hardware tiers and comparable utilization. A "cheaper" provider running slower hardware with a lower multiplier can still be more expensive per effective token than a premium provider charging more but running closer to peak.

If you'd rather see the math run on your actual workload than work it through by hand, the Bursar cost estimator lets you describe a workload and step through the line items — output weighting, cache hit rate as an input, and the batch discount — across four models side by side. From there, the move is to point your model at real provider admin keys and watch where the forecast holds.

Open a Bursar account when you're ready — the dashboard reconciles against OpenAI and Anthropic admin APIs nightly, so the math becomes a tracked number rather than an estimate.