GPT‑6 使持久化智能体能够长时间处理复杂任务,从重构代码库到生成经过充分研究的文档和演示文稿。这些智能体背后的应用程序会发出一系列相互构建的 API 请求,通常会沿用先前轮次中的相同指令、工具定义和上下文。OpenAI 会缓存这些共享上下文,以便跨请求复用计算,从而缩短响应时间,并为开发者提供高达 90% 的缓存输入 token 折扣。
随着 GPT‑6 系列的推出,我们发布了一套改进的提示缓存系统,默认情况下可实现更高的缓存命中率。我们现在对在 30 分钟窗口内复用的符合条件的共享前缀提供缓存折扣。我们还引入了新工具,帮助开发者监控缓存性能、诊断未命中情况,并选择要缓存多少提示。
监控缓存并诊断缓存未命中
新的 提示缓存仪表板(在新窗口中打开) 显示你的应用程序输入中有多少来自缓存。跟踪随时间变化的命中率,并使用输入构成图表比较已缓存和未缓存的 token。这些视图可帮助你发现缓存命中的下降,并评估应用程序的更改如何影响缓存性能。
当你看到意外的缓存未命中时,使用 提示缓存诊断工具(在新窗口中打开) 来了解发生了什么。将某个请求与最近的响应进行比较,以识别模型、工具、设置或输入中阻止复用的更改。受影响的估计 token 数量可帮助你评估影响规模,并决定如何优化集成以最大化缓存命中率。
{
"prompt_cache_diagnostics": {
"type": "cache_miss",
"reason": "tools_changed",
"comparison_reusable_tokens": 5629,
"cache_missed_tokens": 5629
}
}
为你的应用程序优化缓存
选择要缓存的内容。 显式缓存断点让你选择要复用哪些提示前缀。更新后的 提示缓存指南(在新窗口中打开) 解释了如何使用它们、缓存前缀保持符合条件的时长,以及工具和输入的变化如何影响复用。
在不破坏缓存的情况下调整推理投入。 在 GPT‑6 模型上,你现在可以在响应之间 更改推理投入(在新窗口中打开),而不会破坏缓存。通过追加 configuration_update,同时保持请求级推理投入不变,为更难的任务提高投入,或为常规后续任务降低投入。这让你可以调整任务需要多少推理,同时保留可复用上下文。
在工具和指令变化时保留缓存。 随着智能体的工具使用需求变化,保持工具定义、schema 和顺序稳定,以便较早的上下文保持可复用。使用 allowed_tools 仅使相关工具可调用,或在不需要工具时将 tool_choice 设置为 none,而不是移除定义。使用新的开发者消息将新指令追加到上下文末尾,以覆盖较旧的指令。请参阅我们关于 管理工具更改的指南(在新窗口中打开)。
预热缓存以降低延迟。预热(在新窗口中打开) 会提前准备已知上下文,以便请求到达时模型可以更快开始响应。例如,应用程序可以在启动期间、用户提出第一个问题之前,预热共享指令、工具定义或参考资料。这将处理移出用户的等待时间。
这些可选控制建立在引擎的默认性能之上,帮助你根据工作负载定制缓存。
1 / 3
开始使用
在 提示缓存仪表板(在新窗口中打开) 中监控缓存命中率。
使用 诊断工具(在新窗口中打开) 调查意外未命中。
遵循 提示缓存指南(在新窗口中打开) 改进你的设置,或 使用 Codex(在新窗口中打开) 审查你的代码、应用改进并衡量结果。
GPT‑6 enables persistent agents to work for hours on complex tasks, from refactoring codebases to producing well-researched documents and presentations. The applications behind these agents make a series of API requests that build on one another, often carrying forward the same instructions, tool definitions, and context from earlier turns. OpenAI caches that shared context to reuse computation across requests, reducing response times and giving developers discounts of up to 90% on cached input tokens.
With the GPT‑6 family, we launched an improved prompt caching system that delivers higher cache hit rates by default. We now give cache discounts for eligible shared prefixes reused within a 30-minute window. We’re also introducing new tools to help developers monitor cache performance, diagnose misses, and choose how much of a prompt to cache.
Monitor caching and diagnose cache misses
The new Prompt Caching Dashboard(opens in a new window) shows how much of your application’s input is served from cache. Track hit rates over time and use the input composition chart to compare cached and uncached tokens. These views help you spot drops in cache hits and evaluate how changes to your application impact caching performance.
When you see an unexpected cache miss, use the prompt caching diagnostics tool(opens in a new window) to understand what happened. Compare a request with a recent response to identify changes to the model, tools, settings, or input that prevented reuse. The estimated number of affected tokens helps you assess the size of the impact and decide how you can optimize your integration to maximize cache hit rates.
{
"prompt_cache_diagnostics": {
"type": "cache_miss",
"reason": "tools_changed",
"comparison_reusable_tokens": 5629,
"cache_missed_tokens": 5629
}
}
Optimize caching for your application
Choose what to cache. Explicit cache breakpoints let you choose which prompt prefixes to reuse. The refreshed prompt caching guide(opens in a new window) explains how to use them, how long cached prefixes remain eligible, and how changes to tools and inputs affect reuse.
Adjust reasoning effort without breaking cache. On GPT‑6 models, you can now change reasoning effort(opens in a new window) between responses without breaking cache. Raise effort for a harder task or lower it for a routine follow-up by appending a configuration_update while leaving request-level reasoning effort unchanged. This lets you adjust how much reasoning a task needs while preserving reusable context.
Preserve cache as tools and instructions change. As your agent’s tool use needs change, keep tool definitions, schemas, and ordering stable so earlier context stays reusable. Use allowed_tools to make only the relevant tools callable, or set tool_choice to none when no tools are needed, instead of removing definitions. Use new developer messages to append new instructions towards the end of the context to override older ones. See our guidance on managing tool changes(opens in a new window).
Prewarm the cache to reduce latency.Prewarming(opens in a new window) prepares known context ahead of time so the model can start responding sooner when a request arrives. For example, an application can prewarm shared instructions, tool definitions, or reference material during startup, before the user asks their first question. This moves processing out of the user’s wait time.
These optional controls build on the engine’s default performance, helping you tailor caching to your workload.
1 of 3
Get started
Monitor cache hit rates in the Prompt Caching Dashboard(opens in a new window).
Investigate unexpected misses with the diagnostics tool(opens in a new window).
Follow the prompt caching guide(opens in a new window) to improve your setup, or use Codex(opens in a new window) to review your code, apply improvements, and measure results.
本文内容采集自官方网站,排版和翻译可能与原页面存在差异。
阅读官方全文