CCAR-F Domain 1: Prompt Caching Architecture & Cost ROI
Mechanics of Anthropic Prompt Caching (`cache_control`), prefix token minimums, 5-minute rolling TTL refresh rules, cache pricing economics, and prefix structure.
1. The Mechanics of Ephemeral Prompt Caching
Anthropic Prompt Caching allows developers to mark long, repetitive prompt context (system instructions, large tool sets, or reference documentation) with cache_control: { "type": "ephemeral" }. Once cached, subsequent API calls hitting the same prefix bypass initial token computation.
2. Minimum Token Thresholds per Model
| Model | Minimum Cacheable Prefix Length |
|---|---|
| Claude 3.5 Sonnet & Claude 3 Opus | 1,024 Tokens minimum |
| Claude 3.5 Haiku & Claude 3 Haiku | 2,048 Tokens minimum |
Crucial Rule: If your cached prefix contains fewer than the required threshold, the API processes the tokens as standard un-cached input without error, but no cache read discount will apply.
3. Cache Economics & Financial ROI
Pricing Structure
- Cache Write: 1.25× the base input token price (+25% surcharge on initial write).
- Cache Read: 0.10× the base input token price (90% discount on every hit!).
- Break-Even Point: A cached prompt breaks even on just the second request hitting the cache within the TTL window.
4. The 5-Minute Rolling TTL Refresh Rule
The cache lifetime is 5 minutes. However, every time a request successfully reads the cache (a cache hit), the 5-minute TTL timer is reset back to 5 minutes. In active multi-user applications, a cached context can persist indefinitely.
5. Strict Prefix Ordering Rules
Cache matching requires exact byte-for-byte prefix continuity from the start of the request:
[System Prompt] → [Tool Declarations] → [Static Reference Docs] → [Dynamic User Turn]
(Cached) (Cached) (Cached) (Uncached)
If you place dynamic content (like a timestamp or user name) before the static documents, the cache prefix will break and invalidate the cache!