Prompt缓存2026:重复请求成本最高降90%(Anthropic+OpenAI)
每个客服请求都把同一份2000 token的系统提示词发给API。你每次都按原价付相同的钱。
Prompt Caching: Stop Paying Twice for the Same Tokens
Prompt caching is a provider feature that stores recently used input tokens and charges much less when they are reused. Anthropic introduced it in 2024, OpenAI followed with automatic caching, and by 2026 it is the single easiest cost optimization available to any LLM app - in many cases cutting input costs by up to 90% on stable prefixes.
How It Works
When your request includes a prefix that was already processed recently (system prompt, few-shot examples, tool definitions, document context), the provider reuses the cached computation. Anthropic's model: cached input tokens cost roughly 90% less than fresh input tokens, and cache writes cost a fraction of fresh reads. OpenAI applies automatic caching to repeated input prefixes at about a 50% discount on cached input tokens. Both are automatic in the sense that you do not need to change your prompt - but you do need to keep the cached prefix stable.
The Rules That Make Caching Work
- Keep your system prompt and instructions first - cacheable prefixes must come before any changing content. If user-specific context varies, put it after the static prefix.
- Do not reorder - even a one-token change in the prefix invalidates the cache for the whole prefix.
- Mind the TTL - Anthropic caches for 5 minutes (default) up to 1 hour; OpenAI's cache window is shorter. Bursty apps may not benefit; steady traffic does.
- Share static context across requests - a support bot serving 10,000 requests with the same 2,000-token instructions is the perfect case.
Realistic Savings
A chat app with a 3,000-token static system prompt, 10k requests/day: without caching, that prefix costs roughly $3-9/day in input tokens depending on model. With caching at a 90% discount, it drops to under a dollar. Across a month, that is $60-250 saved - for adding zero code and just keeping prompts stable.
FAQ
Is prompt caching automatic? OpenAI caches automatically; Anthropic requires opting in with a cache_control parameter but the discount is larger.
Does caching affect output quality? No - the cache stores computation, not a canned answer.
Which providers support it? OpenAI, Anthropic, Google Gemini, and others, each with slightly different pricing and TTLs.
Can I cache my whole context window? Only the prefix is cacheable; cache invalidation is all-or-nothing for the prefix.
