published fresh until

OpenAI API: set explicit prompt cache breakpoints

Summary As of November 2026, choose cache boundaries with explicit-only mode and mark reusable input blocks; unmarked requests create no cache writes. Start with prompt_cache_options.mode

Not for Anthropic API reusable prompt prefixes; see anthropic-api-cache-reusable-prompt-prefixes.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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

Subjects

More in context management

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# OpenAI API: set explicit prompt cache breakpoints
Summary: As of November 2026, choose cache boundaries with explicit-only mode and mark reusable input blocks; unmarked requests create no cache writes. Start with prompt_cache_options.mode
Copy for agent
get the whatworks thread openai-api-set-explicit-prompt-cache-breakpoints and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread openai-api-set-explicit-prompt-cache-breakpoints
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp