Concept

Prompt caching vs response caching: what is the difference?

Prompt caching and response caching save cost at different points in an LLM call. Prompt caching reuses a repeated prompt prefix, such as a long system prompt or document, at the model provider, which bills those input tokens at a reduced rate while the model still generates a fresh completion. Response caching stores a complete response at the gateway or application layer and returns it for an identical or similar request, so the model is not called at all. They are complementary: response caching saves the whole call, and prompt caching saves the repeated context within a call.

Last updated

Key facts

  • Prompt caching discounts repeated input tokens; the model still generates a new completion.
  • Response caching returns a stored response and skips the model call.
  • On FastRouter, response cache hits are billed at 0.1× standard token pricing and cache storage is free.
  • On FastRouter, provider-native prompt caching is included on every plan; response caching is included from the Pro plan.
  • The two are complementary and can be used on the same traffic.

What is prompt caching?

Prompt caching is a feature of model providers that stores the processed form of a repeated prompt prefix. When a later request starts with the same content, the provider reads it from cache and bills those input tokens at a reduced rate. The model still runs and produces a new completion.

Prompt caching depends on the start of the prompt staying the same between requests. Large static content, such as system instructions, retrieved context and few-shot examples, belongs at the beginning of the prompt, with content that changes at the end.

What is response caching?

Response caching stores the full response to a request in a cache that sits in front of the model, usually in a gateway or in the application. When a matching request arrives later, the stored response is returned and the model is not called, which removes both the model cost and the model latency.

Matching can be exact, where only an identical request reuses a response, or semantic, where a request that is close enough in meaning also counts as a match. Entries expire after a time to live, so stale answers are eventually replaced.

How do prompt caching and response caching compare?

The two differ in what is reused, where the cache lives and whether the model runs. Prompt caching reuses part of the input and still produces a new output. Response caching reuses the whole output and produces nothing new. The table below sets out the differences that matter when choosing between them.

Prompt caching compared with response caching
AspectPrompt cachingResponse caching
What is reusedA repeated prompt prefix (input tokens)A complete stored response
Where the cache livesAt the model providerAt the gateway or application layer
Model callStill madeSkipped on a cache hit
OutputFreshly generated on every requestThe stored response, returned again
What is savedCost of the repeated input tokensCost and latency of the whole call
What must matchThe beginning of the promptThe request, exactly or by similarity
Typical fitLong system prompts, document Q&A, multi-turn chatFAQs, repeated queries, summaries that are requested again

When should you use each one?

Use prompt caching when requests share a long, stable beginning but need a different answer each time. Use response caching when the same or a very similar request recurs and the same answer is acceptable. Many workloads have both patterns, so the two are often enabled together.

  • Prompt caching fits long system prompts and tool definitions, question answering over the same documents, growing conversation history and pipelines that reuse few-shot examples.
  • Response caching fits frequently asked questions, stateless bots, dashboards that reload the same summaries and repeatable classification or description requests.

How FastRouter handles prompt caching and response caching

FastRouter offers both and treats them as separate features. Prompt caching is provider-native: the cache lives at the model provider, and FastRouter keeps each conversation on the provider whose cache is warm. Response caching is FastRouter's own gateway cache, so it works the same way across every provider you route to.

  • Prompt caching is automatic, with no request changes, on OpenAI, DeepSeek, Google AI Studio, Google Vertex AI, Grok, Moonshot AI and Baseten. Anthropic Claude requires cache_control markers, with a 5-minute (default) or 1-hour TTL.
  • Cached context is billed as low as 0.10× the normal input price on supported providers. Caching applies past a per-model minimum, for example 1,024 tokens on OpenAI.
  • Response caching is enabled by sending a cache_key header. If the header is omitted, response caching is disabled.
  • A similarity_threshold of 1.0 matches only identical requests. The default of 0.75 also reuses minor rewordings and paraphrases.
  • Response cache lifetime defaults to 3,600 seconds and can be set from 60 to 86,400 seconds per request.
  • Response cache hits return in under 10ms and are billed at 0.1× standard token pricing. Misses are billed at the standard rate and stored for reuse.
  • Provider-native prompt caching is included on every plan. Response caching is included on Pro, Business and Enterprise, as listed on the pricing page.
FAQ

Common questions

Yes. They are complementary. Response caching answers repeated or similar requests from a stored response without calling the model. Requests that miss the response cache still go to the model, where prompt caching reduces the cost of any repeated prompt prefix.

No. Prompt caching only changes how repeated input tokens are processed and billed. The model still generates a fresh completion for every request. Response caching is different: on a cache hit it returns the stored response instead of generating a new one.

For prompt caching, every API response includes a prompt_tokens_details object with cached_tokens and cache_write_tokens, and a cached_tokens value above 0 means the cache was hit. For response caching, responses served from cache include cached: true and a similarity score.

Provider-native prompt caching is included on every FastRouter plan, including the free Starter plan. Response caching is not included on Starter and is included on the Pro, Business and Enterprise plans, according to the plan comparison on the pricing page.

Try it on your own traffic

Point your existing OpenAI-compatible client at FastRouter and send a request. Free to start, no credit card required.