The short answer: on a request with a long, repeated system prompt, prefix caching roughly halves the bill, and routing easy traffic to a small model cuts it again. In my worked model below, 1,000 requests on Claude Sonnet 5.5 cost $25.00 uncached and $11.72 with a 90% cache hit rate [1]. Sending 70% of them to Haiku 5.5 instead brings the blend to about $3.95 [1].
The bigger point is where the money goes. Output tokens are billed at five times the input rate on all three Claude tiers I priced, and caching does nothing for them [1]. So the levers are different for input and output, and I’ll take them one at a time.
What one LLM API request actually costs
A request has up to four billable parts: ordinary input tokens, tokens written to a prompt cache, tokens read back from that cache, and output tokens. Anthropic lists all four per model, in USD per million tokens (MTok), and these are the rates I used, as listed on 5 December 2026 [1]:
| Model | Input | 5-minute cache write | Cache hit | Output |
|---|---|---|---|---|
| Claude Haiku 5.5 (prompts up to 100,000 tokens) | $0.10 | $0.125 | $0.01 | $0.50 [1] |
| Claude Sonnet 5.5 | $2 | $2.50 | $0.10 | $10 [1] |
| Claude Opus 5.5 | $4 | $5 | $0.20 | $20 [1] |
OpenAI’s list has the same shape: gpt-6.1-terra is $1.00 input, $5.00 output and $0.05 cached input per million tokens, and gpt-6-luna is $0.10, $0.50 and $0.01 [4]. Google’s Gemini 3.8 Flash is a useful warning about dates: its paid input price is $0.75 through December 31, 2026 and $1.50 starting January 1, 2027 [3].
Two things inflate token counts without changing your text. Anthropic says the tokenizer in Claude 4.7 and later produces approximately 30% more tokens for the same text [1]. And reasoning or “thinking” tokens are billed as output: Google labels its column “Output price (including thinking tokens)” [3].
A worked cost model: cost per 1,000 requests across three tiers
The token counts here are my assumptions, illustrative rather than measured, so swap in your own. Each request carries an 8,000-token shared prefix (system prompt plus tool definitions), 2,000 tokens of new input and 500 output tokens, priced at the rates in [1]. With caching on, 90% of requests read the prefix from a 5-minute cache and 10% write it [1].
| Per 1,000 requests | Haiku 5.5 | Sonnet 5.5 | Opus 5.5 |
|---|---|---|---|
| No caching | $1.25 | $25.00 | $50.00 [1] |
| Prefix caching, 90% hit rate | $0.62 | $11.72 | $23.44 [1] |
| Saving | 50% | 53% | 53% [1] |
Haiku saves slightly less because its cache hits are billed at 0.1x the input price, while hits on Sonnet 5.5 and Opus 5.5 are 0.05x [1].
The saving stops near half because output is untouched: on Sonnet 5.5, the 500 output tokens alone cost $5.00 per 1,000 requests at $10 per MTok [1]. If you want a bigger cut, the output side needs its own work, which I cover under max_tokens below.
The routing line is simple arithmetic on the same table. A 70/30 split between Haiku 5.5 and Sonnet 5.5 costs $8.38 per 1,000 requests uncached and $3.95 cached, against $11.72 for cached Sonnet alone [1]. That only holds if the small model is good enough for most of the traffic, which is a quality question no price list answers. Who gets to make that trade-off, and how the spend lands back on their budget, is an organisational question I covered in a post on FinOps practices for AI and SaaS spend.
The small model has a price step to watch. A Haiku 5.5 request whose prompt is over 100,000 tokens pays $0.50 input and $2.50 output per MTok, five times the rates in the table [1]. Long-context traffic routed to the small model keeps much less of the saving.
Prompt caching vs semantic caching
These are two different mechanisms, and I think the confusion between them is most of why the debate gets heated. Prompt (prefix) caching is a provider feature: the provider stores the processed state of the start of your prompt and bills a re-use at a discount. OpenAI says plainly that “Cache reuse requires the entire rendered prefix to match” [2].
Semantic caching is something you build. You embed an incoming query, look for a similar earlier one, and return the stored answer without calling the model at all. In my view it is closer to a search index than a new idea, and I’d engineer it like one.
The best primary write-up I found is DoorDash’s engineering post from October 29, 2026 [8]. Its gateway “reuses exact or semantic cache hits”, and on a warm pass the hit rate rose from 6.2% to 99.4% while search cost per 1,000 queries fell from $0.7385 to $0.0045 [8].
Read that headline carefully, though. The widely shared “98%” is about web-search grounding: on 7,988 retail queries, search cost per 1,000 fell from $7.90 to $0.110 [8].
DoorDash writes that “Reported costs cover search-provider charges and exclude model inference” [8]. It is one company’s result on one workload, and it is not a saving on LLM tokens.
DoorDash also reports where its approach lost: “native search outperformed DSG across all five models tested” on the recency-focused FreshQA benchmark [8]. A semantic cache that serves a stored answer has the same weakness on anything time-sensitive.
Which caching breaks when you add a router
Prefix caching is fragile by design, because any change before the cached point is a miss. Anthropic’s docs say that modifying tool definitions “invalidates the entire cache”, and that changing thinking parameters invalidates cached message prefixes [10]. A router that varies the tool list or reasoning settings per route will quietly turn hits into fresh writes.
That matters because writes cost more than plain input: 1.25x for a 5-minute cache write [1]. In my model, Sonnet 5.5 with every request writing and none reading costs $29.00 per 1,000 requests, more than the $25.00 with caching off [1]. Anthropic notes caching pays off after one cache read on the 5-minute tier [1].
OpenAI’s newer models carry the same trap: for GPT-5.6 and later, cache writes cost 1.25x the uncached input rate for the default 30-minute lifetime [2].
I couldn’t find an explicit statement, in either Anthropic’s or OpenAI’s caching docs, on whether a prefix cached on one model can be read by another. The nearest is OpenAI listing model among the settings that affect the cached prefix, with the note “A different model can use different weights and caching behavior” [2].
I’d assume each route builds its own cache and plan for the write cost on every model a prefix lands on.
Two smaller traps. Anthropic won’t cache prompts shorter than 512 tokens on Opus 5.5, Sonnet 5.5 and Haiku 5.5, and returns no error when it skips them [10]. And a cache entry only becomes available after the first response starts, so a burst of parallel requests can all pay for writes [10].
How to measure cache hit rate
OpenAI gives the formula: track the token cache-hit rate “by dividing total cached tokens by total input tokens”, grouped by user, workspace or day [2]. Anthropic returns the same two counts in each response as cache_read_input_tokens and cache_creation_input_tokens [10]. For an agent, I’d log both per step, because one changed tool definition mid-session shows up as a run of writes. A hit rate is only worth tracking if someone is told when it drops, which is what budget alerts that fire while there is still time to act are for.
On OpenAI, routing itself affects hits: cached states live on individual machines, and traffic above 15 requests per minute can lead to overflow routing [2]. On models before GPT-5.6, a stable prompt_cache_key is the documented way to keep related requests together, at about 15 requests per minute per key [2]. On GPT-5.6 and later, OpenAI says it “handles cache routing automatically; the key is not needed to optimize caching” [2].
max_tokens not respected? What actually enforces the cap
On the Claude API, a response that hits the cap comes back with stop_reason set to max_tokens [6]. If a completion looks longer than the cap, my first suspect is a count made with something other than that model’s own tokenizer. The gap can be large: Anthropic says the tokenizer in Claude 4.7 and later produces approximately 30% more tokens for the same text [1].
Mind the direction, though. Counting a newer model’s output with the older tokenizer gives a lower number, so that particular mismatch would hide an overshoot, not create one.
I couldn’t verify the cause of the specific overshoot reported in the r/LLMDevs thread; no primary source I read describes a model exceeding its cap.
On reasoning models the opposite problem is common. OpenAI warns a capped response can end “before any visible output tokens are produced, meaning you could incur costs for input and reasoning tokens without receiving a visible response” [5]. It recommends reserving at least 25,000 tokens at first [5].
Can a Claude Max subscription be your API backend?
Not through the app, unless Anthropic has explicitly permitted the route you’re using. The consumer terms bar accessing the services “through automated or non-human means, whether through a bot, script, or otherwise” [7]. The clause opens with two exceptions: “Except when you are accessing our Services via an Anthropic API Key or where we otherwise explicitly permit it” [7].
What Max offers instead is $100 of monthly Claude API credit with no rollover, which you claim by linking a Claude Console organization to the plan [9]. New subscribers can claim after 7 days, and the credit covers the Claude API and the Agent SDK but not Claude Code [9].
Which lever to pull first
My opinion, from the arithmetic above: get prefix caching working before anything else, since it is a configuration change worth about half the input-heavy bill [1]. Then route, but keep each route’s prefix stable so caching survives it. Batch work that can wait gets a further 50% off on Anthropic, and the batch and cache discounts stack [1]. Turning that list into something a team runs every month is a workflow problem, which I covered separately in automating the FinOps workflow.
None of this is visible from a provider invoice, which arrives with no team or feature dimension. If you buy these models through Amazon Bedrock, Azure OpenAI or Vertex AI, CloudPi's AI cost analytics allocates that spend through the same projects and dimensions as the rest of your cloud bill. API bills paid directly to OpenAI, Anthropic or Google aren’t covered today.
Sources
- Pricing – Claude Platform Docs (Anthropic)
- Prompt caching | OpenAI API
- Gemini Developer API pricing (Google)
- Pricing | OpenAI API
- Reasoning models | OpenAI API
- Stop reasons and fallback – Claude Platform Docs
- Consumer Terms of Service – Anthropic
- How DoorDash Reduced LLM Search Costs by 98% Without Losing Accuracy – DoorDash Engineering
- API credits for Max, Ultra, and Team plans – Claude Platform Docs
- Prompt caching – Claude Platform Docs
