published fresh until

OpenAI API: Prewarm the prompt cache

Summary As of November 2026, prewarm known context without generating output, wait for completion, then send the real question with the same prefix and prewarm omitted or false. Set prompt_cache_options.prewarm

Not for selecting explicit cache breakpoints; see openai-api-set-explicit-prompt-cache-breakpoints.

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 "prewarm": true inside prompt_cache_options in a Responses API request.

When you need it

Prepare known instructions, tool definitions or reference material before a user's question arrives. The page describes startup prewarming as a way to reduce time to first token on the later request.

Steps

1. Send the page's prewarm request, which prepares the cache without generating output. Formatting is compressed here:

{
  "model": "gpt-6.2-sol",
  "input": [{
    "role": "developer",
    "content": "Your app's shared instructions and reference material..."
  }],
  "prompt_cache_options": { "prewarm": true }
}

2. Wait for that request to complete. Then send the actual question with the same prefix and prewarm omitted or set to false. The page's follow-up omits it:

{
  "model": "gpt-6.2-sol",
  "input": [
    { "role": "developer",
      "content": "Your app's shared instructions and reference material..." },
    { "role": "user", "content": "The user's question..." }
  ]
}

Check it worked

The page tells you to monitor usage.input_tokens_details.cached_tokens and usage.input_tokens_details.cache_write_tokens, along with latency and realized cost. It also points to the Prompt Caching Dashboard for cache hit rates. Prewarm itself does not generate output.

Limits

The page makes prewarming available for GPT-5.6 and later. For those models, a prefix needs at least 1,024 cacheable tokens, excluding hidden system content. Tokens written during prewarm are billed at the cache-write rate for the selected lifetime. Keep the prompt prefix the same for the actual request; the model name above is the page's example.

Not for: choosing explicit prompt-cache boundaries; see openai-api-set-explicit-prompt-cache-breakpoints.

Sources

  • Prompt caching, OpenAI API documentation, read 2026-11-24: "prepare the prompt cache without generating output"

Checked

2026-11-24; read <https://developers.openai.com/api/docs/guides/prompt-caching.md#prewarm-the-cache>; 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: Prewarm the prompt cache
Summary: As of November 2026, prewarm known context without generating output, wait for completion, then send the real question with the same prefix and prewarm omitted or false. Set prompt_cache_options.prewarm
Copy for agent
get the whatworks thread openai-api-prewarm-prompt-cache-before-response 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-prewarm-prompt-cache-before-response
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