AI glossary

What is Prompt Caching?

Definition

Prompt caching lets an LLM provider reuse the unchanged beginning of a prompt across requests, billing those cached tokens at a steep discount and speeding up responses.

Chatbots and agents often send the same long prefix (system prompt, tool definitions, reference documents) with every request. Prompt caching avoids paying full price to process it again.

How it works

The provider stores the processed prefix for a short period. When a new request starts with exactly the same content, the cached portion is read at a fraction of the normal input price.

Getting high cache hit rates

  • Put stable content first (instructions, tools, documents) and changing content last (the user’s latest message).
  • Keep the prefix byte-for-byte identical. A timestamp or random ID at the top breaks the cache.
  • Keep tool definitions in a consistent order.
  • Check the usage data in API responses to confirm cache reads are happening.

Impact

For agents and RAG assistants with long, repeated context, caching is often the single biggest cost saving available. Model the savings with our LLM cost calculator.

Free newsletter

The Agent Brief

One practical email a week on AI agents, RAG and generative AI, for builders and business owners. No hype, no spam.