Skip to content

Examples and guides for using the OpenAI API

Update Prompt Caching 201 retention guidance (#2680)

ani-oai65290c6d72df
diff --git a/examples/Prompt_Caching_201.ipynb b/examples/Prompt_Caching_201.ipynb
index 7f1f49de..0079af15 100644
--- a/examples/Prompt_Caching_201.ipynb
+++ b/examples/Prompt_Caching_201.ipynb
@@ -219,9 +219,8 @@
"- Using Chat Completions with reasoning models, since the hidden chain-of-thought tokens are dropped\n",
"\n",
"## 6. Extended Prompt Caching & Zero Data Retention\n",
- "In-memory caches generally last 5-10 minutes of inactivity (up to one hour) but enabling [extended retention](https://developers.openai.com/api/docs/guides/prompt-caching#extended-prompt-cache-retention) allows for caches to last for up to 24 hours.\n",
- "Extended Prompt Caching works by offloading the key/value tensors to GPU-local storage when memory is full, significantly increasing the storage capacity available for caching. Because the cache is stored for longer, this can increase your cache hit rate. Internally we have seen improvements of 10% for some use cases. \n",
- "If you don’t specify a retention policy, the default is `in_memory`. \n"
+ "\n",
+ "[Extended Prompt Caching](https://developers.openai.com/api/docs/guides/prompt-caching#extended-prompt-cache-retention) works by offloading the key/value tensors to GPU-local storage when memory is full, significantly increasing the storage capacity available for caching. For `gpt-5.5`, `gpt-5.5-pro`, and all future models, the default is `24h` and `in_memory` is not supported."
]
},
{
@@ -242,14 +241,11 @@
"metadata": {},
"source": [
"\n",
- "KV tensors are the intermediate representation from the model’s attention layers produced during prefill. Only the key/value tensors may be persisted in local storage; the original input content, such as prompt text, is only retained in memory.\n",
- "Prompt caching can comply with [Zero Data Retention](https://developers.openai.com/api/docs/guides/your-data) because cached prompts are not logged, not saved to disk, and exist in memory only as needed. However, extended prompt caching requires storing key/value tensors to GPU-local storage as application state. This storage requirement means that requests leveraging extended prompt caching are not ZDR eligible - however if a ZDR customer explicitly asks in their request for Extended Prompt Caching the system will honor that. ZDR customers should be cautious about this and consider policies to monitor their requests for this parameter. \n",
- "\n",
+ "KV tensors are the intermediate representation from the model’s attention layers produced during prefill. Only the key/value tensors may be persisted in local storage; all original input content is only retained in memory.\n",
"\n",
"**Insight: What Is Actually Cached?**\n",
"The KV cache just holds the model’s key/value tensors (linear projections of the hidden‑states) so we can reuse them on the next inference step. The KV cache is an intermediate representation. It’s essentially just a bunch of numbers internal to the model - that means no raw text/multi-modal inputs are ever stored, regardless of retention policy.\n",
"\n",
- "\n",
"## 7. Realtime API\n",
"\n",
"Caching in the Realtime API works the same as with the Responses API - all the audio, text or images passed in will be cached, and any change to the prefix will break the cache. However, given the shorter context window of the Realtime API (currently 32k), managing truncation is especially relevant. A 32k context model with 4,096 max output tokens can only include 28,224 tokens in the context before truncation occurs. \n",