When can an LLM cache save money?

A cache hit can save prompt work. It still leaves a new answer to generate.

This comic separates KV reuse, shared-prefix reuse and caching a whole response. They have different validity rules and different effects on the bill.

Using invented rates, ten requests go from $0.0200 to $0.0038 for the shared prefix. That's an 81% saving on this subtotal. The rest of the request still has a cost.

Download this comic as a PDF

Comic page 1 of 6: When can an LLM cache save money?
Read page 1 as text

When can an LLM cache save money?

Repeating instructions can be cheaper. A similar prompt is not enough.

WHAT WE WILL FIGURE OUT

01

Three different things called cache

02

Follow one matching prefix

03

Do the cost arithmetic

OUR EXAMPLE

An invented price example for ten requests sharing a 1,000-token prefix.

Follow the steps. Ask the obvious questions. Check the result.

Part 9 of 18 · Challenge: page 5 · Suggested answers: page 6

Comic page 2 of 6: Three different things called cache
Read page 2 as text

Three different things called cache

1

ONE WORD, THREE IDEAS

KV reuse

prefix reuse

answer reuse

KV reuse

prefix reuse

answer reuse

Which cache are we talking about?

Separate KV reuse within generation, prefix reuse across requests, and reuse of a complete previous answer.

KV state / matching prefix / response cache

2

WITHIN ONE ANSWER

FOLLOW THE CHANGE

earlier K,V

next decode

earlier K,V

→

next decode

A decoder reuses earlier K and V as the answer grows. This is a serving optimization, not automatically a billing discount.

The cat... continues without rebuilding all prior KV

3

ACROSS REQUESTS

FOLLOW THE CHANGE

stable prefix

new suffix

stable prefix

→

new suffix

A compatible runtime may reuse computed state for an eligible matching prefix. The new suffix still needs work.

Stable instructions + changing question

4

REUSING AN ANSWER

FOLLOW THE CHANGE

old answer

validity check

old answer

→

validity check

A response cache returns an earlier result. Semantic similarity alone does not prove that the old answer is valid now.

Same topic can still require a different answer

Comic page 3 of 6: Follow one matching prefix
Read page 3 as text

Follow one matching prefix

5

STABLE PREFIX FIRST

FOLLOW THE CHANGE

stable policy

date + question

stable policy

→

date + question

Can I move the timestamp to the front?

A changing early field can break the shared prefix. Put genuinely stable material before per-request fields where supported.

Stable policy → changing date and question

6

MATCH THE ACTUAL INPUT

exact match

provider rules

exact match

provider rules

Provider cache rules can include text, images, tool definitions and configuration. Similar meaning is not exact prefix equality.

Check provider-specific cache-hit conditions

7

A HIT IS CONDITIONAL

minimum size

expiry

routing

minimum size

expiry

routing

Minimum lengths, expiry, routing and cache boundaries can affect reuse. Observe reported hits instead of assuming them.

No reported hit: do not count a saving

8

OUTPUT STILL RUNS

FOLLOW THE CHANGE

prefix hit

new generation

prefix hit

→

new generation

A prefix-cache hit avoids eligible repeated prompt work. It is not a cached answer and does not skip new generation.

Reused prefix + new suffix + new output

Comic page 4 of 6: Do the cost arithmetic
Read page 4 as text

Do the cost arithmetic

9

INVENTED PRICES

$2/M input

$0.20/M reads

$2/M input

$0.20/M reads

How would I calculate a saving?

Suppose ordinary input costs $2 per million tokens and cache reads cost $0.20. These are teaching rates, not vendor prices.

First prefix fill charged at ordinary input rate

10

NO REUSE

INVENTED PREFIX-ONLY PRICES

No reuse

$0.0200

Suffix, output and other charges excluded

10 × 1,000

→

10,000 tokens

Ten requests each send the 1,000-token prefix. That is 10,000 input tokens at the invented ordinary rate.

10,000 / 1,000,000 × $2 = $0.0200

11

NINE CACHE HITS

INVENTED PREFIX-ONLY PRICES

No reuse

$0.0200

Reuse

$0.0038

Suffix, output and other charges excluded

$0.0020

+ $0.0018

= $0.0038

One ordinary fill plus nine reads costs $0.0020 + $0.0018. Suffix, output, write premiums and storage are excluded here.

Prefix subtotal: $0.0038; saving: $0.0162

12

CHECK THE WHOLE BILL

prefix savings

full bill differs

prefix savings

full bill differs

The saving is 81% of this subtotal.

It is not 81% off the entire application bill. Include every priced component and actual hit rate.

Price the whole request, not only the reused prefix

Comic page 5 of 6: Your turn. Can you explain what happens?
Read page 5 as text

Your turn. Can you explain what happens?

Use the same example. Change one detail. What follows?

KEEP THIS EXAMPLE IN MIND

An invented price example for ten requests sharing a 1,000-token prefix.

Try first. Suggested answers are on the next page.

1

What changes if every request puts a fresh timestamp before the shared instructions?

What makes you say that?

2

In the invented example, what is the prefix-only cached subtotal?

What makes you say that?

3

Does a prefix hit return the previous complete answer?

What makes you say that?

Write your answers in the comments.

Comic page 6 of 6: Suggested answers
Read page 6 as text

Suggested answers

When can an LLM cache save money?

01

What changes if every request puts a fresh timestamp before the shared instructions?

It can break prefix matching from the beginning and reduce reuse.

02

In the invented example, what is the prefix-only cached subtotal?

$0.0038 under the stated invented rates and assumptions.

03

Does a prefix hit return the previous complete answer?

No. It reuses eligible prefix computation; the new suffix and output still run.

Try the challenge on page 5. Suggested answers follow on page 6.