Skip to content

Prompt Caching ⚠ verify

Definition

A mechanism to cache a prefix of a prompt (tools, system, messages) so repeated requests reuse it at a large discount, reducing cost and latency for stable context.

Key points

  • Cache type: "ephemeral" (only supported type): "cache_control": {"type": "ephemeral"}.
  • TTL: default "5m" (5 minutes); extended "1h" (1 hour, additional cost): {"type": "ephemeral", "ttl": "1h"}.
  • Pricing (× base input): cache read (hit) = 0.1×; cache write = 1.25× (5m) / 2× (1h). Breakpoints add no cost.
  • Minimum cacheable prompt length (per model): 1,024 tokens (Opus 4.8, Sonnet 5, Haiku 4.5, Opus 4.1, Sonnet 4.6/4.5/4); 2,048 (Opus 4.7, Mythos Preview, Haiku 3.5); 4,096 (Opus 4.6, Opus 4.5); 512 (Fable 5, Mythos 5 — but 1,024 on Amazon Bedrock). Shorter prompts are processed without caching, no error returned.
  • Breakpoints: max 4 explicit cache_control breakpoints per request; 20-block lookback window per breakpoint.
  • Usage fields: cache_creation_input_tokens (written), cache_read_input_tokens (served from cache), input_tokens (after last breakpoint, uncached). total = cache_read + cache_creation + input_tokens. 1-hour TTL adds cache_creation: { ephemeral_5m_input_tokens, ephemeral_1h_input_tokens }.
  • Cacheable: tools, system messages, text messages, images, documents, tool_use, tool_results. Not cacheable: thinking blocks (directly), sub-content blocks, empty text blocks.
  • Changing tool_choice invalidates cached message blocks (tools + system stay cached). All caching buckets still count toward the context window.
  • ZDR: prompt caching is ZDR-eligible (unlike the MCP connector and Batches) — see ZDR Eligibility.

Why it matters for the exam

  • Cost-optimisation scenarios: recognising the 0.1× read / 1.25× / 2× write multipliers and picking the right TTL. Heavily tested with numeric answers.

Common gotchas

  • Prompts below the per-model minimum are silently NOT cached — no error, just no savings.
  • Only 4 breakpoints; the 20-block lookback means placement matters.
  • 5-minute TTL expires between async batch jobs — use the 1-hour TTL with batches (see Caching Plus Batching).

See also

Sources