Prompt Caching

What is Prompt Caching?

Prompt caching is a technique in which an AI provider stores the processed form of repeated prompt content, such as standard instructions, so later requests can reuse it at lower cost and latency.

Updated November 2026 · 2 min read


Prompt caching is a feature of AI model APIs that stores the processed form of a repeated prompt prefix, such as a long system prompt, so later requests starting with the same content are processed faster and billed at a discount. Many AI applications send the same content over and over. A customer service assistant includes the same long system prompt in every request. A document assistant sends the same contract with every question about it. A coding assistant sends the same files repeatedly. Caching that repeated content means it is processed once and reused.

Major model providers, including Google, Anthropic and OpenAI, introduced prompt caching in 2024. Some apply it automatically. Others require developers to mark which parts of the prompt to cache. Discounts on cached input vary by provider and model, from about half price to as little as a tenth of the standard input price, and some providers charge a premium when content is first written to the cache. Anthropic, for example, charges 1.25 times the base input price for cache writes and a tenth of it for reads. Cached content usually expires after a few minutes without use, though some providers offer retention of an hour or longer. Providers also set a minimum prefix length, often around 1,000 tokens, below which nothing is cached.

How it works

Caching matches on the start of the prompt, called the prefix. If a new request begins with exactly the same tokens as a recent one, the cached processing for that prefix is reused. Content after the first difference is processed normally. Underneath, the provider is storing the KV cache for the prefix.

How to design prompts for caching

  • Put stable content first: system instructions, tool definitions, reference documents and examples.
  • Put variable content last: the user's question, timestamps and session details.
  • Keep the stable part identical. A single changed character, such as today's date near the top, breaks the cache for everything after it.
  • Keep conversation history in order, so earlier turns form a stable prefix.

An example

Consider a hypothetical support assistant with an 8,000-token system prompt and product reference, followed by a short customer question. It handles 2 million requests a month. The team discovers its prompt begins with the current date and time, which changes every request and prevents caching. Moving the timestamp to the end of the prompt lets the 8,000-token prefix be cached. With cached input priced at a tenth of the standard rate, a request with an 8,000-token cached prefix and a 200-token question costs the equivalent of about 1,000 full-price input tokens instead of 8,200. After cache writes and misses, input costs fall by about 85%, and time to first token drops noticeably.

Common pitfalls

  • Dynamic content at the top of the prompt.
  • Short cache lifetimes: low-traffic applications may not reuse the cache before it expires.
  • Not checking cache hit rates, which providers usually report in usage data.

Prompt caching reuses processing of identical prompt starts. Semantic caching reuses whole answers to similar questions. Both are standard tools in AI cost optimization.

Frequently asked questions

How much does prompt caching reduce input costs?

It depends on the provider and on how much of each prompt repeats. Cached input is discounted from about half price to as little as a tenth of the standard input price, and some providers charge a premium to write content into the cache. Anthropic, for example, bills cache writes at 1.25 times the base input price and cache reads at a tenth.

How should you structure prompts to get the most from prompt caching?

Place stable content first, including system instructions, tool definitions, reference documents and examples, and put variable content such as the user's question, timestamps and session details at the end. Prompt caching matches on the prefix, so a single changed character near the top, like today's date, breaks the cache for everything that follows it.

What is the difference between prompt caching and semantic caching?

Prompt caching reuses the provider's processing of an identical prompt prefix, so the model still runs but the repeated input is cheaper and faster. Semantic caching stores whole answers in the application or an AI gateway and returns them for new questions with the same meaning, skipping the model call entirely.

Book a demo