OpenAI has introduced better prompt caching in GPT-6, making it faster and cheaper to build AI agents that handle complex, multi-step tasks. If you’re new to building with AI, this update means your agents can work more efficiently, especially when tackling long-running jobs like refactoring code or generating detailed documents.
Prompt caching is a technique that reuses shared context across multiple API requests. Instead of processing the same instructions and tool definitions repeatedly, GPT-6 saves this shared information in a cache. This reduces both the time and cost of running your agent.
How prompt caching works
When your AI agent performs a task, it often makes a series of API calls that build on each other. Many of these calls share the same context, such as instructions, tool definitions, or reference material. With prompt caching, GPT-6 identifies and stores these shared elements, reusing them across requests.
For example, if your agent is refactoring a codebase, it might use the same tools and instructions repeatedly. Instead of processing these elements anew each time, GPT-6 retrieves them from the cache. This reduces the number of tokens billed and speeds up response times.
Tip
Prompt caching can reduce costs by up to 90% for cached input tokens, making it especially valuable for long-running tasks.
What's new in GPT-6
GPT-6 introduces several improvements to prompt caching:
- Higher cache hit rates: The system now caches shared prefixes reused within a 30-minute window by default, increasing the likelihood of cache hits.
- Better monitoring: A new Prompt Caching Dashboard helps you track cache performance and diagnose misses.
- More control: You can choose which parts of your prompt to cache, adjust reasoning effort without breaking cache, and prewarm the cache to reduce latency.
Monitoring cache performance
The Prompt Caching Dashboard is a key tool for understanding how well caching is working in your application. It shows:
- Cache hit rates over time
- Input composition (cached vs. uncached tokens)
- Diagnostics for unexpected cache misses
When you encounter a cache miss, the diagnostics tool helps you identify the cause, such as changes to tools, settings, or input. This information lets you optimize your integration for better caching.
Optimizing your caching setup
Here are some strategies to maximize cache hit rates in your AI agent:
- Choose what to cache: Use explicit cache breakpoints to specify which prompt prefixes to reuse.
- Adjust reasoning effort: Change reasoning effort between responses without breaking cache by appending a
configuration_update. - Preserve cache during tool changes: Keep tool definitions and schemas stable, and use
allowed_toolsortool_choiceto manage tool availability. - Prewarm the cache: Prepare known context (like shared instructions or tool definitions) ahead of time to reduce latency.
Getting started
To take advantage of these improvements:
- Monitor cache hit rates in the Prompt Caching Dashboard.
- Investigate unexpected misses with the diagnostics tool.
- Follow OpenAI’s prompt caching guide to optimize your setup.
Read next
- What OpenAI’s Math Advisory Group Means for Beginners Building AI
- What Agent Anomaly Detection Means for Beginners Building AI Agents
Want to try all of this hands-on? Start with the free Claude Code from Zero course.
Source
Based on OpenAI’s announcement, “Better prompt caching for GPT-6”. Written for people learning to build with these tools.