openai · OpenAI Platform Docs
Prompt caching
Explains how to optimize prompt structure to leverage automatic prompt caching for reduced latency and cost by placing static content at the beginning of requests.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Prompt caching
Explains how to optimize prompt structure to leverage automatic prompt caching for reduced latency and cost by placing static content at the beginning of requests.
When To Use
Use when you need to reduce API latency and input token costs by restructuring prompts to ensure exact prefix matches for cached content.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/prompt-caching-workflow-guide.md | A guide explaining how prompt caching works, including structuring prompts, retention policies, and cost benefits. | Questions about a guide explaining how prompt caching works, including structuring prompts, retention policies, and cost benefits. |
examples/prompt-caching-openai-prompt-caching.json | A JSON object demonstrating the structure of a request using prompt caching parameters for an OpenAI model. | Exact payloads, commands, or snippets shown in A JSON object demonstrating the structure of a request using prompt caching parameters for an OpenAI model. |
examples/prompt-caching-openai-prompt-caching-usage-response.json | A JSON object demonstrating the usage field and prompt token details for a prompt caching API response. | Exact payloads, commands, or snippets shown in A JSON object demonstrating the usage field and prompt token details for a prompt caching API response. |
What This Skill Covers
- Model prompts often contain repetitive content, like system prompts and common instructions. OpenAI routes API requests to servers that recently processed th...
- Main sections:
Structuring prompts,How it works,Prompt cache retention,In-memory prompt cache retention,Extended prompt cache retention.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://developers.openai.com/api/docs/guides/prompt-caching.md
