# Prompt caching costs: choosing the cache lifetime — a Grodmir guide

> Prompt caching lowers the price of a repeated prompt start, but writing to the cache costs extra and a longer lifetime costs more. The right lifetime depends on how soon your requests return to the same prefix.

Grodmir Optimize measures and cuts LLM API costs in the customer's infrastructure, from request metadata and token usage only.

## What is prompt caching?

Providers store the start of a request that repeats across calls, the prefix: a system prompt, tool definitions or documents. Later requests that begin with the same prefix pay a reduced price for the cached part instead of the full input price.

[Answer source](https://grodmir.com/en/prompt-caching-cost#what-is-prompt-caching)

## Why does the cache lifetime matter?

Writing to the cache costs more than normal input, and a longer lifetime costs more to write. If requests return after the cache has expired, you pay the write again. If they return quickly, a long lifetime only adds the higher write price.

[Answer source](https://grodmir.com/en/prompt-caching-cost#why-lifetime-matters)

## What lifetimes do Anthropic and OpenAI offer?

Anthropic: 5 minutes, with cache writes at 1.25× the input price, or 1 hour at 2×. OpenAI Responses API: 30 minutes by default, with writes at 1.25×, or 12 hours at 2.5×. Ratios from the provider price lists read in November 2026.

[Answer source](https://grodmir.com/en/prompt-caching-cost#anthropic-and-openai)

## What about Google Gemini?

Gemini 4 models use implicit caching: cached input is billed at the lower read price, with no write charge and no lifetime setting. There is no lifetime to choose there.

[Answer source](https://grodmir.com/en/prompt-caching-cost#google-gemini)

## How does Grodmir Optimize choose the lifetime?

It measures, per route and prefix hash, how long requests take to return to the same prefix and proposes the lifetime with the lower total cost. After your approval the proxy sets it on each request; the request content stays the same. On OpenAI this needs the Responses API; Chat Completions routes get an instruction instead.

[Answer source](https://grodmir.com/en/prompt-caching-cost#how-grodmir-chooses)

## What must stay stable for caching to work?

The prefix must be identical byte for byte. A timestamp, a request id or reordered tools at the start of a prompt break the cache. Grodmir Optimize never changes the prefix; it reports the likely cause and you fix it in code.

[Answer source](https://grodmir.com/en/prompt-caching-cost#stable-prefix)

- [Grodmir Optimize — LLM API cost optimisation](https://grodmir.com/en/llm-cost-optimization)
- [LLM cost audit: free scan and paid audit — Grodmir Optimize](https://grodmir.com/en/llm-cost-audit)



Content updated: 2026-11-29

Amounts before a change goes live are estimates; only savings measured in the Savings Ledger are billed. [How to start with Grodmir Optimize](https://grodmir.com/en/optimize/start) · [Grodmir Optimize Terms](https://grodmir.com/optimize-terms)

Source: https://grodmir.com/en/prompt-caching-cost
