Caching Plus Batching
Definition
The combined cost-optimisation pattern of layering Prompt Caching on top of the Message Batches API to stack a cache discount on top of the 50% batch discount.
Key points
- Prompt caching works in the Message Batches API at the same pricing (0.1× read, 1.25×/2× write).
- Batch API gives a flat 50% cost reduction; caching adds the read/write multipliers on top.
- Use the 1-hour cache TTL with batches — the 5-minute TTL expires before async batch jobs run, so a 5m cache would be lost.
- Batches are not ZDR-eligible; caching is. If ZDR is required, the batching leg disqualifies the combo — see ZDR Eligibility.
- Concrete case (playbook): follow-up synthesis summaries taking 40+ seconds passing 80K+ accumulated tokens → enable prompt caching on the synthesis subagent to cut transfer overhead.
Why it matters for the exam
- Cost-optimisation questions reward stacking both discounts and, critically, choosing the 1-hour TTL for batches. A frequently tested combination.
Common gotchas
- Defaulting to the 5-minute TTL with batches — it expires before the async job completes, wasting the cache write.
- Assuming the combo is ZDR-safe — the batch leg is not ZDR-eligible.
See also
Sources
Referenced by
Practice questions optional · AI
Generate fresh practice questions about this concept with AI. These are not vault-verified.