prompt-cache-optimization

Installation
SKILL.md

Prompt Cache Optimization (OpenAI)

Operating procedure for getting maximum prompt-cache hit rate on OpenAI API workloads, distilled from OpenAI's "Prompt Caching 201" cookbook. Applied correctly, caching cuts time-to-first-token (TTFT) latency by up to ~80% and input token cost by up to 90%, with discounts up to 98.75% on some models. Caching is automatic and free — your job is to stop breaking it: stabilize prefixes, route requests stickily, and measure cached_tokens.

Scope note: the source explicitly applies to models before GPT-5.6. For GPT-5.6 and later, consult the current platform Prompt Caching guide before relying on these mechanics.

When to use

Use this skill when:

  • Designing or reviewing prompt/message layout for any repeated OpenAI API call — system prompts, tool definitions, schemas, conversation loops, agents.
  • usage.prompt_tokens_details.cached_tokens is low or zero on traffic that repeats a prefix.
  • TTFT latency or input token spend is a problem at scale (long contexts benefit most: 67% faster TTFT at 150k+ tokens vs 7% at 1024 tokens, measured over 2,300 iterations).
  • Choosing between Chat Completions vs Responses API, or Batch vs Flex Processing.
  • Setting truncation/compaction policy for long conversations or Realtime (voice) sessions.

Do NOT use when:

  • Prompts are under 1024 tokens and cannot reasonably be lengthened — caching never activates below 1024 tokens.
  • Requests share no repeated prefix (fully unique one-off prompts) — there is nothing to cache.
  • Targeting GPT-5.6+ — verify against the current platform guide first.
Installs
5
GitHub Stars
8
First Seen
Oct 21, 2026