Skip to content
Blog

Prompt caching: when it saves money and when it costs more

Cache writes cost more than plain input and reads cost a tenth. The break-even point, worked examples for Claude and OpenAI, and how to tell which way your traffic goes.

By the Alye team7 min readCostAnthropicOpenAI

Prompt caching can cut the input cost of a long prompt by about 90%. It can also make every request 25% more expensive. Which one you get depends on how often the same prefix is reused before the cache expires.

How caching is billed

With Anthropic's Claude, you mark the part of the prompt to cache: usually the system prompt, tool definitions or a long document. The first request writes it to the cache at a higher price; later requests that start with the same prefix read it at a much lower price.

Claude Sonnet 4.5, per million tokensPriceCompared with input
Input$3.001×
Cache write$3.751.25×
Cache read$0.300.1×
Output$15.005×

By default the cache lives for about five minutes and the timer resets each time it's read. If no request reuses the prefix in that window, the next one pays the write price again.

The break-even point

Take a 10,000-token system prompt on Claude Sonnet 4.5, sent with every request:

Requests within the cache lifetimeWithout cachingWith cachingDifference
1$0.030$0.037525% more
2$0.060$0.040533% less
10$0.300$0.064579% less
100$3.000$0.334589% less

With caching, the cost is one write ($0.0375) plus $0.003 for each later read. So caching pays off as soon as the same prefix is used twice within the cache lifetime, and the savings approach 90% at high reuse.

OpenAI is different

OpenAI caches automatically for prompts of 1,024 tokens or more and charges nothing extra to write. The discount on cached input varies by model, from half price to a tenth:

Model, per million tokensInputCached inputDiscount
gpt-5$1.25$0.12590%
gpt-5-mini$0.25$0.02590%
gpt-4.1$2.00$0.5075%
gpt-4o-mini$0.15$0.07550%

There is no write penalty, so the only question is how much of your input hits the cache. Keep the static part of the prompt first and identical.

How to tell which way your traffic goes

1. Separate cache reads and writes

Both providers return cached and cache-write token counts in each response. Total them per service: if writes are close to reads, the cache is expiring before it's reused.

2. Look at the time between requests

A service handling one request every ten minutes will rarely hit a five-minute cache. A chat assistant with steady traffic almost always will.

3. Compare cost per request before and after

Turn caching on for one service and compare its average cost per request over the same hours of the day. Alye shows cache reads and writes separately for every call and service, so this takes minutes. See Claude cost tracking and OpenAI cost tracking.

Prices are list prices on the date of this post, from our model price list. Check your provider's pricing page for current rates.

See this in your own numbers. Alye records every LLM call with its cost by service, model and customer. Free for 500,000 calls a month.

Get started free

More from the blog