Claude API cost — the token math behind a real bill
Claude API cost breaks down into input, output and cached tokens, priced per model with output at five times input. A 30 percent tokenizer shift across model generations and the five-minute cache window decide most of a real bill. Pexon measures actual traffic and hands back a cost model with every assumption written down.
A token is not a unit of cost — it is three
The published Claude API rates are the starting point, and the bill is decided by three token types that move independently: input, output and cached. Output is typically priced at five times input. Cached input reads drop to a tenth of the base — and cache writes cost more than plain input. A workload that looks identical on the pricing page can differ by an order of magnitude in practice, depending on which of the three dominates.
There is a fourth variable that nobody prices on the rate card: the tokenizer. Anthropic documents that models from Claude Opus 4.7 onward use a newer tokenizer producing roughly 30 percent more tokens for the same input text. Identical traffic, identical published rates, a bill roughly a third larger — unless the counting is done per model.
Output tokens at five times input, a 30 percent tokenizer shift across model generations, and the five-minute cache window decide most of a real Claude API bill. None of the three appears on the rate card.
The four drivers of a Claude API bill
| Driver | What it costs | The fix |
|---|---|---|
| Output tokens | ~5× input rate | Measure output share; shorter completions move the bill |
| Cache misses | 1.25× on every write, nothing on a cold prefix | Structure prompts for cache hits; keep prefixes stable |
| Tokenizer shift | +30% tokens on newer models | Count with each model's own counter, never reuse old counts |
| Unattributed usage | One bill line, no owner | Gateway with per-team attribution from day one |
Rate multipliers are from Anthropic's published pricing and documentation; the 30 percent tokenizer figure is Anthropic's own statement about models from Opus 4.7 onward. The share of each driver in your bill is what the measurement establishes.
The cheapest fix is usually prompt structure, not a cheaper model. Stable prefixes that hit the cache move the bill more than any rate negotiation.
The measurement design, in the order it has to happen
Attributing a Claude API bill starts before any optimisation. First, stand up the gateway so every request carries a workload label. Second, enable the OpenTelemetry exporter and pull the Admin Cost API daily into the same warehouse — the two reconcile to the penny. Third, record the baseline before anyone tunes anything, because without a baseline no saving can be attributed to a change.
The five-minute cache window is the detail that surprises most teams: a cache entry lives five minutes by default and is refreshed for free on each read. A workload that reads the same prefix less often than every five minutes pays the write premium on every call — silently, because no error is raised.
Count before you compare
Token counting is free and rate-limited separately from inference. This is the first command in every cost engagement.
# Count the same real prompt under each candidate model's own tokenizer
curl -s https://api.anthropic.com/v1/messages/count_tokens \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"claude-opus-5",
"messages":[{"role":"user","content":"<your real production prompt>"}]}'
# -> {"input_tokens": N} N moves per model — compare, then multiply by that model's rateWe do not publish a per-developer or per-token figure without ninety days of our own measured data, and neither should anyone quoting you one. The design above produces your number on your estate — it is not transferable from a blog post.
Four numbers that survive a budget review
Each of these is produced by the two-week measurement, not by a pricing page.
- Effective input multiplier — (plain + 1.25×writes + 0.1×reads) ÷ total input. Below 1.0, caching pays for itself; above 1.0 it is costing you money.
- Output share of the bill — the five-times multiplier means output often dominates even at a fraction of the token count.
- Per-team spend with attribution — the number that makes the bill an owner's problem instead of one unexplained line.
- The reconciliation gap between OpenTelemetry estimates and the Admin Cost API — tracked as a percentage, investigated when it moves.
The rate card is the least interesting number on the invoice. The interesting ones are measured, not published.
Cost work continues on these pages
- Claude Code cost per developer — The eight metrics to instrument before you quote a per-developer figure.
- LLM cost optimisation — Semantic caching, routing and attribution once the bill is visible.
Cost questions before the API decision
How much does the Claude API cost per token?
It depends on the model and the token type: input tokens are the base rate, output tokens are typically five times that, and cached input reads are a tenth of the base. The exact figures are published by Anthropic and change with model generations, so the number to quote is the one measured on your model and your traffic, not a screenshot from a blog post.
Why is our Claude API bill higher than the published rates suggest?
Four causes account for most of it: output tokens at five times input, cache writes at 1.25 times base input, the newer tokenizer producing roughly 30 percent more tokens for the same text, and repeated full-price input that never hits the cache. The measurement design is what surfaces which of the four is driving your bill.
How do we forecast Claude API costs?
From three measured numbers: token volume per workload, the cache hit rate, and the model mix. Two weeks of instrumented traffic through a gateway produces all three, and the forecast is arithmetic after that. Without the measurement, any forecast is a guess dressed as a budget.
Next step
Measure the bill before the budget meeting
Two-week readiness blueprint at €4,900: we instrument your Claude API traffic, attribute spend per workload and team, and hand back a cost model with the four drivers identified. The plan is yours to keep whoever builds it.
