When does inflating the system prompt actually lower cost per call?
Counterintuitively, a much LONGER system prompt can drive down cost-per-call below a shorter one. Explain when this flips, and derive the rough hits-per-write threshold above which the verbose-but-cached prompt wins. Be concrete about the discount mechanism on at least one real provider (Anthropic or OpenAI).
A long system prompt costs more on the first call (the cache write) and cheaper on every subsequent hit (the cache read at ~10% on Anthropic, ~50% on OpenAI).
Think of a gym with two memberships. The cheap one charges five dollars every time you walk in. The expensive one charges fifty dollars to sign up, then fifty cents per visit. If you visit once, the cheap one wins. If you visit a hundred times, the expensive one wins by a mile. Long cached prompts are the expensive membership: an upfront premium on the first call, then a tiny per-call charge after. Once you visit (call) enough times, it pays off, and that crossover usually comes after just a few calls because the per-hit discount is so steep.
Detailed answer & concept explanation~10 min readEverything 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. 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.
4 min: name prefix caching, identify write-vs-read pricing tiers, derive break-even N = (L*w - S)/(S - L*r), apply Anthropic and OpenAI numbers to a 5000-vs-500-token example, classify the workload by call rate vs TTL.
Real products, models, and research that use this idea.
- Anthropic's prompt-caching launch in 2024 reported up to 90% cost reduction on long-context workloads (RAG, coding agents) with break-even at 2-3 cache hits.
- OpenAI's automatic prompt caching (2024+, GPT-4o and later) discounts ~50% on cached prefix tokens with no write premium, making the verbose-prompt win immediate from the second call.
- Anthropic's extended-TTL tier (1 hour, 2026) targets slow-call-rate workloads where the default 5-minute TTL expires too often.
- Anthropic's Computer Use SDK and Claude Code both rely on multi-kilo-token tool schemas in the system prompt; the verbose prompt is cheaper per agent step because the tool schemas cache across the entire session.
- SGLang and vLLM self-hosted serving expose RadixAttention prefix caching with no write premium, so the verbose-prompt-wins regime is the steady-state behavior for any self-hosted long-prompt deployment.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhat happens to the break-even formula when output tokens are factored in?
QHow does Anthropic's extended-TTL tier change the workload classification?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating prompt-caching value as a flat discount on every call. The actual structure has a write premium on the first call and a read discount on subsequent hits, and the break-even is amortized over the hit count, not per call.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.