Cache writes now cost extra on most major providers. How do you decide whether a prefix is worth caching, which TTL to pay for, and when to use explicit breakpoints instead of automatic caching?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
Caching used to be free money on some providers. With paid writes it is an investment with a payback period, and the maths is simple enough to do out loud.
Full worked answer
Caching used to be free money on some providers. With paid writes it is an investment with a payback period, and the maths is simple enough to do out loud.
The current shape, as of late 2026: Anthropic writes cost 1.25x input for a 5-minute TTL and 2x for 1 hour, with reads at 0.1x on most models and lower on the newest (0.05x on Opus 5.5 and Sonnet 5.5). OpenAI, from GPT-5.6, charges 1.25x for the default 30-minute lifetime and 2.5x for a 12-hour lifetime, with reads at 0.1x (0.05x on GPT-6.1 Sol and Terra). GPT-5.5 and earlier have no write fee. Check the current pricing page, because these numbers move every generation.
Break-even, with prefix cost P and n reads within the TTL:
- No caching: (1 + n) × P.
- 1.25x write, 0.1x reads: (1.25 + 0.1n) × P. Cheaper from n = 1 (1.35P against 2P). One reuse pays back.
- 2x write: (2 + 0.1n) × P. Needs n ≥ 2 (2.2P against 3P).
- 2.5x write: (2.5 + 0.1n) × P. Also needs n ≥ 2 (2.7P against 3P).
So the question is never "is caching good", it is "how many hits does this prefix get inside the TTL". That comes from your traffic, not intuition:
- Shared system prompt and tools on a busy endpoint: hits every few seconds, so the cheapest short TTL is right, and each hit refreshes it.
- Agent loops: each step re-sends the growing context within seconds, so short TTLs work, and caching is a 5-10x input-cost lever.
- Bursty or slow traffic (a user who comes back every 20 minutes, a nightly job that reuses a large document across a few hours): this is where the longer TTL earns its premium. Compute the inter-arrival times per prefix and pick the TTL that covers most of them.
- One-off prefixes (a unique long document read once): caching costs 25% or more extra for nothing.
When to use explicit breakpoints over automatic caching: when you know your prompt structure better than the heuristic does. Put breakpoints after the stable blocks (tools, system prompt, a shared document) so you pay writes only on prefixes that will be reused, and keep volatile per-user content out of what gets written. OpenAI's explicit-only mode exists for exactly this, and Anthropic lets you combine one automatic cache_control field with explicit breakpoints. Automatic is fine when the prompt is simple and stable.
What to put on the dashboard: cache-write tokens, cache-read tokens and hit rate per route, and the effective cost per request. The failure I look for is a route with high write volume and low read volume, which means you are paying a premium to cache things nobody reuses.
What a good answer covers
- Caching used to be free money on some providers
- With paid writes it is an investment with a payback period, and the maths is simple enough to do out loud
- The current shape, as of late 2026
- OpenAI, from GPT-5.6, charges 1.25x for the default 30-minute lifetime and 2.5x for a 12-hour lifetime,…
- GPT-5.5 and earlier have no write fee
Key terms: Agent loops · Bursty or slow traffic · One-off prefixes
Interviewer follow-ups to expect
Your cache hit rate is 95% but your bill went up after a model upgrade. What do you check?
How would you choose a TTL from a histogram of inter-arrival times?
Where should breakpoints go in a multi-tenant RAG prompt?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep