Prompt Buddy logoPrompt Buddy

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.

Import to Prompt Buddy

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

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/prompt-caching-workflow-guide.mdA 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.jsonA 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.jsonA 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

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. 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