Predict the break-even read count for Anthropic prompt caching given the 1.25x / 0.1x rates
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Anthropic charges 1.25x the normal input rate on the cache WRITE (the first request that populates a cached prefix) and 0.1x the normal input rate on each cache READ (every subsequent hit on the same prefix). Compute the minimum number of total cache reads N (not counting the write) after which the cumulative cost is strictly LOWER than running the same N+1 requests against an uncached endpoint at 1.0x. Show the inequality and the integer answer.
Cached cost (write + N reads) = 1.25 + 0.1N. Uncached cost (N+1 calls) = N+1. Set cached < uncached: 0.25 < 0.9N, so N > 0.28. Caching wins from the FIRST read (1.35 < 2.0).
Picture a coffee shop that charges $1.25 to engrave your favorite order on a card the first time you visit and $0.10 each time you flash that card later. Without the card, every drink is $1.00. After your first refill ($1.25 + $0.10 = $1.35 total) you've spent more than the $1 for a single drink but less than the $2 you'd have spent on two regular drinks. From your second card flash onward, you're saving by a wide margin. The card pays off remarkably fast.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: the inequality and its solution + why N=1 is the break-even + what the '2 reads' figure actually measures + TTL implications + Anthropic vs OpenAI cache mechanics + production placement of cache_control.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Quoting 'two reads to break even' without showing the inequality. That number compares cached vs cached without the premium, not cached vs uncached. The cached recipe wins versus uncached on the very first read.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.