Prompt caching

Prompt caching

Prompt caching

TL;DR

TL;DR

Prompt caching is an LLM API feature that stores the processed form of a repeated prompt prefix, so later requests that start with the same text cost less and respond faster.

Prompt caching is an LLM API feature that stores the processed form of a repeated prompt prefix, so later requests that start with the same text cost less and respond faster.

What is prompt caching?

Prompt caching is a feature of large language model APIs that stores the processed form of the beginning of a prompt, called the prefix, so that later requests starting with the same text do not pay to process it again. The model still writes a new response each time. Only the repeated input is reused.

It exists because most production prompts are repetitive. A support agent sends the same instructions, policies, and tool definitions on every turn, and only the last message changes. With prompt caching the provider bills those repeated AI tokens at a steep discount and returns the first words sooner. A prompt cache does not change what the model says.

Key takeaways

  • What is cached: the processed prefix of the input. The answer is always generated fresh.

  • Match rule: the start of the new prompt must be identical to the cached one.

  • Payoff: lower input cost and faster responses on repeated context.

  • Design rule: put stable content first and changing content last.

How prompt caching works

A model reads a prompt from the first token to the last and builds internal state as it goes. That work is the same every time the same text appears at the start. Prompt caching saves the state for a prefix and loads it when a new request begins with the same tokens.

  1. First request. The provider processes the full prompt and writes the prefix to the cache. Some providers charge a small premium for this write.

  2. Later requests. If the new prompt starts with the same prefix, the provider reads it from the cache and processes only the new part.

  3. Expiry. Cached prefixes live for a short time, often minutes, and the timer resets when the entry is used.

The match is exact. Changing one character near the top, such as a timestamp or a customer name, makes everything after it a cache miss. This is why prompt structure matters more than any setting: the system prompt, tool definitions, and reference documents go first, and the live conversation goes last. Prompt caching also works inside the context window. It lowers the price of filling the window but does not make it larger.

Prompt caching across providers

Provider

How it is enabled

Pricing pattern

Cache lifetime

Anthropic (Claude)

Automatic, or explicit cache breakpoints

Writes cost more than normal input, reads cost a small fraction

5 minutes by default, 1 hour optional

OpenAI

Automatic on long prompts

Cached input tokens billed at a discount

Short, extended by reuse

Google (Gemini)

Implicit caching, or explicit context caching

Discount on cached tokens, storage fee for explicit caches

Set by the developer for explicit caches

Anthropic’s prompt caching documentation lists the multipliers: a 5-minute cache write costs 1.25 times the base input price, a 1-hour write costs 2 times, and a cache read costs 0.1 times. On those numbers a cached prefix pays for itself on the second request. Rates and minimum prompt lengths change, so check the provider’s current page before modeling cost.

Prompt caching vs semantic caching vs response caching

Technique

What is stored

When it hits

What the model does

Prompt caching

Processed prompt prefix

Same starting text

Generates a fresh answer

Semantic caching

Past question and answer pairs

A new question with similar meaning

Skipped on a hit

Response caching

Exact request and response

Identical request

Skipped on a hit

Prompt caching is the only one of the three that always produces a new answer, so it carries no risk of serving a stale reply. Semantic caching saves more per hit but can return an answer that was right for a different customer.

Why prompt caching matters for customer support

Support conversations are long and repetitive in exactly the way caching rewards. Each turn resends the instructions, the policies, and the conversation so far. Without caching, a ten-turn chat pays to process the same policy text ten times. With it, most of that input is billed at the cached rate, which changes the math in any buy versus build cost comparison and in per-resolution pricing models.

Speed matters as much as cost. Less input to process means a shorter time to first token, and on a phone call that separates a natural pause from dead air. Guides to AI support response time and low-latency AI voice agents show how tight those budgets are.

Prompt caching example

A support agent’s prompt has 6,000 tokens of instructions, policies, and tool definitions, followed by the conversation. On the first customer message the provider processes all of it and writes the 6,000-token prefix to the cache. On the second message, sent twenty seconds later, the prefix is read from the cache at the reduced rate, and only the new turns are processed at the full price. By the eighth message the conversation history has grown, and that history is cached too, because each request extends the same beginning. If a developer then adds the current time to the first line of the prompt, every request becomes a miss and the bill returns to the uncached level.

How is prompt caching measured?

The main metric is cache hit rate: cached input tokens divided by total input tokens. Providers report cached and uncached tokens separately in the API response, so it can be tracked per request. A healthy multi-turn agent should see most of its input served from cache after the first turn.

Two secondary metrics show the effect. Cost per conversation should fall as the hit rate rises. Latency to the first token should fall on turns that hit the cache. A sudden drop in hit rate after a release usually means someone edited the top of the prompt.

How AI agents use prompt caching

Agents benefit more than simple chat apps because they call the model many times for one task. Each step in a tool calling loop resends the instructions, the tool list, and all previous steps. Caching turns that growing prefix into cheap input, which makes multi-step work affordable.

It also changes how prompts are written. Teams that practice context engineering treat prefix stability as a design constraint: fixed instructions first, retrieved documents next, conversation last. As this post on the role of prompts in AI argues, small prompt changes have large effects, and with caching they also have a price. Support teams using Fini do not manage prompt structure by hand. They write policies and procedures, and the Fini platform assembles what the model sees.

How to implement prompt caching

  1. Order the prompt. Put instructions, tools, and reference content at the top, and put anything that varies per request at the bottom.

  2. Remove volatile text from the prefix. Move dates, names, and session IDs to the end or into the final user message.

  3. Keep tool definitions stable. Reordering or renaming tools breaks the cache for everything after them.

  4. Match the lifetime to traffic. Use a longer cache lifetime when gaps between requests exceed the default.

  5. Log cached tokens. Track hit rate per route and alert when it drops.

Common prompt caching mistakes

The most frequent mistake is a dynamic value at the top of the prompt. A greeting with the customer’s name in line one can reduce the hit rate to zero. The second is assuming caching is on and never checking the token counts, especially on prompts shorter than the provider’s minimum.

Some teams expect prompt caching to fix answer quality or reduce output cost. It does neither. Output tokens are billed in full, and the model can hallucinate from a cached prompt as easily as from a fresh one.

Frequently Asked Questions

What is prompt caching in simple terms?

Prompt caching lets an LLM provider remember the start of a prompt it has already processed. When the next request begins with the same text, the provider reuses that work, charges less for those input tokens, and starts responding sooner. The model still writes a new answer every time.

How does prompt caching work?

The provider saves the model’s internal state for a prompt prefix after the first request. Later requests that start with the identical prefix load that state and process only the new text. The cache expires after a short period, and any change inside the prefix causes a miss.

How much does prompt caching save?

It depends on the provider and on how much of the prompt repeats. On Anthropic’s published rates a cache read costs one tenth of the normal input price, and a five-minute cache write costs 25% more than normal input. Agents with long, stable prefixes see the largest savings.

What is the difference between prompt caching and semantic caching?

Prompt caching reuses the processed prompt prefix and always generates a new answer. Semantic caching stores earlier answers and returns one when a new question means the same thing, skipping the model. Prompt caching is safer for personalized replies. Semantic caching saves more on repeated generic questions.

Does prompt caching change the model’s answer?

No. The cached prefix is the same input the model would have processed anyway, so the response is generated as usual. Caching affects cost and speed only. If answers change after enabling it, look for a prompt edit made at the same time.

How long does a prompt cache last?

Lifetimes are short. Anthropic’s default is five minutes, refreshed each time the cache is used, with a one-hour option at a higher write price. Other providers keep entries for a similar window. Traffic with long idle gaps needs a longer lifetime or will miss often.

Learn More

Learn More

Workforce optimization (WFO)

W

Customer self-service

C

AI sycophancy

A

Computer use agent

C

System prompt

S

Backchanneling

B

Omnichannel customer support

O

Voice biometrics

V

Non-human identity (NHI)

N

Semantic caching

S

Time to first token (TTFT)

T

Durable execution

D

AI audit trail

A

Conversational AI greeting

C

Agent assist vs AI agent

A

Knowledge base

K

Average handling time (AHT)

A

Telephony

T

Customer acquisition cost (CAC)

C

Business process outsourcing (BPO)

B

AI tokens

A

Human in the loop (HITL)

H

AI grounding vs retrieval-augmented generation (RAG)

A

Short message service (SMS)

S

Call center

C

Data annotation

D

Ticket routing

T

Customer service quality assurance (QA)

C

Live chat

L

Speech Synthesis Markup Language (SSML)

S

Batch inference

B

Barge-in

B

SLA compliance rate

S

Queue management

Q

Prompt versioning

P

Emotion detection

E

Retrieval-augmented generation (RAG)

R

Natural language understanding (NLU)

N

Text classification

T

Call routing

C

Customer churn rate

C

Speech-to-speech

S

Intent recognition

I

Voice of the employee (VoE)

V

Confidence score

C

Resolution-based pricing

R

AI personalization

A

Voice cloning

V

Asynchronous messaging

A

Hallucination

H

ReAct agent pattern

R

Long-term memory

L

Forecast accuracy

F

Customer feedback loop

C

Structured output

S

Outbound voice AI

O

AI guardrails

A

Direct preference optimization (DPO)

D

Prompt chaining

P

SIP transfer

S

Fallback intent

F

Conversation summarization

C

Auto-tagging

A

Cost per contact

C

VoIP jitter

V

Model card

M

Ticket prioritization

T

Sentiment analysis

S

Agent utilization rate

A

Speech-to-intent

S

Prompt engineering

P

Knowledge atlas

K

SOC 2 AI support

S

Prosody

P

Chatbot containment rate

C

Speech synthesis

S

Fine-tuning

F

ISO 42001

I

Intent-based search

I

After-call work (ACW)

A