By Maria Belen Corvalan Amil·July 24, 2026·9 min read

The Four Mechanics Behind Your LLM Bill

Why the rate card doesn't predict what you pay

LLM PricingCost Optimization

All figures are illustrative estimates from a hypothetical scenario, using published Anthropic rates as of July 2026. Your numbers will differ.

Consider a CV screener: it takes a résumé, extracts structured fields, scores the candidate against a role, and writes a short justification.

Nothing exotic. This is what an LLM feature looks like inside any HR product.

Stacked bar chart splitting one request into an input token segment and a smaller output token segment
Request breakdown: 7,200 input / 1,500 output

At 1,000 CVs a day on Opus 4.8:

Bar chart projecting the per-request cost out to a daily cost and then a monthly cost
Daily and monthly cost: $73.50/day → ~$2,205/month

$2,205 a month. That's the number the rate card gives you. Hold onto it.

01 — Cache Break-Even

The problem

The Claude API is stateless. Every request is independent, so you resend everything, every time.

Bar chart highlighting that the vast majority of a request is unchanged boilerplate resent on every call
What repeats: 97% identical every call

97% of your input is the same text on every request. At 1,000 CVs a day that's $35/day for text Anthropic has already read 999 times.

The solution

Prompt caching tells Anthropic: this prefix never changes, store it processed, reuse it next time. You mark where the stable part ends:

JSON request snippet showing a cache_control marker placed right after the stable part of the system prompt, dividing it into a cached region above and an uncached region below
Breakpoint: cache_control in system block

Everything above the breakpoint gets cached. Everything below is priced normally.

The trap

There isn't one cache price. There are three.

Bar chart comparing three cache pricing multipliers: base rate, cache write premium, and the much lower cache read rate
Rates on Opus 4.8: 1.0× / 1.25× / 0.1×

Writing the cache costs more than not caching. You pay a 25% premium once to pay 90% less afterward — an investment with a payback period, not a discount.

Chart comparing cumulative cost with caching against cumulative cost without caching, crossing over at the second call
Break-even is 2 calls: 1.35 vs 2.00

Three more worth knowing:

  • The 1-hour cache costs 2.0× to write — it needs 3+ hits to pay off. At 2 calls it's worse than not caching.
  • Anything variable above the breakpoint kills it. A ${new Date()} means zero hits and a 25% surcharge on every call.
  • The failure is silent. Check response.usage.cache_read_input_tokens — if it stays at 0, nothing will tell you.

Back to the screener

Bar chart comparing daily cost before enabling caching to daily cost after
Before $73.50/day → After ~$42/day

One line of config. 43% off the bill.

What's left: output is untouched at $37.50/day — now 89% of the total. That's Block 04's problem.

02 — Quadratic Resend

The problem

Block 01 assumed one call per CV. That's not how agents work.

The moment your screener uses tools — fetch the role, query the ATS, look up salary bands — you're in a loop. And every turn resends the entire conversation.

Diagram of four conversation turns, where each new turn resends every prior turn plus one new message, so the payload grows one block per turn
Turn growth: A / AB / ABC / ABCD

The trap

Costs don't grow with the conversation. They grow with the square of it.

Bar chart showing cumulative resent tokens rising much faster than turn count across 10, 20, and 30 turns
10 turns = 55 units, 20 = 210, 30 = 465

Ten turns of content, 55 units on the invoice. That's n(n+1)/2.

And the units aren't small. Tool results are the heaviest thing in an agent's context — a single ATS response can be 3,000 tokens of JSON, paid for on every subsequent turn.

  • Thinking tokens count too — extended thinking stays in context and gets resent at input rates.
  • This is usually the dominant cost in agent work, not the model tier. Teams downgrade Opus to Sonnet and wonder why the bill barely moves.

Back to the screener

Same base, now a 15-turn agent averaging 1,500 tokens of tool results per turn:

Bar chart comparing daily agent cost with a naive resend-everything approach against caching combined with pruning old tool results
Naive ~$127/day vs caching + pruning ~$58/day

These swing widely with how much your tool results weigh. Two things fix it: cache the stable prefix and prune tool results you're done with. A salary lookup from turn 3 doesn't need to be in context on turn 14.

03 — Tokenizer Drift

The problem

You don't pay per character. You pay per token — and how text splits into tokens is a property of the model, not of your text.

The trap

Anthropic changed the tokenizer in Opus 4.7. Same text, up to 35% more tokens.

Bar chart comparing token count produced from the same CV text under the old tokenizer and the new one
Per CV: 1,000 tokens vs 1,350 tokens, +35%

The rate card says $5.00/MTok in both cases. Your bill goes up 35% anyway.

Everyone compares models by price per million tokens. Nobody asks how many tokens the same text produces. It's an invisible variable that breaks every price comparison.

  • It hits Spanish, code, and proper nouns hardest — exactly where tokenizers differ most.
  • Migrations are where it bites. You upgrade for quality and inherit a cost increase nobody mentioned in the changelog.

Back to the screener

Before switching versions, run 50 real CVs through both and compare usage.input_tokens. Twenty minutes, and it's the only way to know what a migration costs.

Bar chart comparing daily input cost at the old tokenizer rate against the new, higher tokenizer rate
At daily scale: $36.00 → $48.60, +$12.60/day

$380/month for changing a version string.

04 — The 5× Rule

The pattern

Across every workhorse tier, output costs exactly 5× input.

Table listing input and output price per million tokens for Haiku, Sonnet, and Opus, with output marked as 5 times input on every row
Rate card: Haiku $1/$5, Sonnet $3/$15, Opus $5/$25

Know your input price, multiply by five. That's the whole rule.

The trap

Two ring gauges side by side: output is 17% of tokens but 51% of cost
Same screener, two sides of the bill

Output is 17% of your tokens and 51% of your bill.

This inverts where you optimize. Everyone trims the prompt. But cutting 100K input tokens saves $0.50 — cutting 100K output tokens saves $2.50. Output optimization pays 5× more.

  • Thinking tokens bill as output. Extended thinking without a budget generates thousands of tokens at the most expensive rate on the card.
  • max_tokens is a cap, not a target — but a verbose prompt will fill it. "Write a brief justification" versus "write a thorough analysis" is a real line item.

Back to the screener

Ask for structured output instead of prose — a score, five fields, two sentences:

Bar chart comparing daily output cost between verbose prose output and constrained structured output
1,500 tokens $37.50/day → 600 tokens $15.00/day

$675/month for a tighter output spec.

Where the bill actually landed

Bar chart of monthly cost dropping in three steps from the original bill down through intermediate optimizations to the final 73% lower bill
$2,205 → $1,261 → $586, 73% lower

That's a 73% reduction in this scenario, and the model never changed. No downgrade, no quality tradeoff — just four mechanics the pricing page doesn't describe.

The order matters, and it's the answer to "how do you optimize LLM costs" in an interview:

  1. Pick the cheapest model that clears the quality bar — Haiku is 5× cheaper than Sonnet, 25× cheaper than Opus
  2. Constrain output — pays 5× more than trimming input
  3. Manage context — the dominant cost in agent loops
  4. Cache the stable prefix — 90% off what repeats
  5. Measure real tokens when you migrate — the rate card doesn't tell you

Four mechanics: when to cache, how much context you're dragging, how many tokens your text actually becomes, and which side of the bill you're on.

A note on the numbers

Everything here is a worked example, not a benchmark. The screener is hypothetical, the token counts are round numbers chosen to make the arithmetic legible, and the savings are what the arithmetic implies — not measured results from production.

Rates are Anthropic's published prices as of July 2026 and will change. Cache multipliers, tokenizer behaviour, and model pricing are documented by Anthropic and are the source of truth over anything here.

The point isn't the dollar figures. It's the four mechanics, which hold regardless of what the rate card says on the day you read this.