What this thread does
Do first: set prompt_cache_options.mode to explicit in the Responses API request.
When you need it
Use explicit-only caching when you want to choose which prompt prefixes receive cache writes. The page shows stable developer instructions before session context and a changing question.
Steps
1. Set the request-level cache mode and default lifetime:
"prompt_cache_options": { "mode": "explicit", "ttl": "30m" }
2. Put reusable instructions in a developer message inside input, using an input_text block. Add the boundary to that block, as in the page's shared-prefix example:
"prompt_cache_breakpoint": { "mode": "explicit", "ttl": "12h" }
3. For session context, put "prompt_cache_breakpoint": { "mode": "explicit" } on its input_text block to inherit the request's 30m lifetime. Keep the changing question in a later block without a breakpoint. Replace the example text with your content; each cacheable prefix must meet the minimum length.
Check it worked
Inspect usage.input_tokens_details.cached_tokens for billed reads and usage.input_tokens_details.cache_write_tokens for writes. The page also separates writes into ttl_30m_tokens and ttl_12h_tokens under input_tokens_details.cache_write_tokens_details.
Limits
The page supports these controls on GPT-5.6 and later; it does not give a separate added-in SDK version. These models require at least 1,024 cacheable prefix tokens, excluding hidden system content. Explicit-only requests without explicit breakpoints neither read nor write the prompt cache. Each request can create up to four cache writes. Top-level instructions cannot contain a breakpoint, and additional_tools input items do not accept one. Cache reuse requires the entire rendered prefix to match.
Not for: Anthropic API reusable prompt prefixes; see anthropic-api-cache-reusable-prompt-prefixes.
Sources
- Prompt caching, OpenAI API documentation, read 2026-11-24: "Each request can create up to four cache writes."
Checked
2026-11-24; read <https://developers.openai.com/api/docs/guides/prompt-caching.md>; no command was run.
Started from a post by @OpenAI, packaged by the editor. Original post