LLM ROUTING

Map OpenRouter cache breakpoints to the selected provider

In this article
THE QUICK TAKE

A cache breakpoint marks reusable prompt material under a supported provider contract; reuse, lifetime and billing must be observed rather than assumed.

A conversation often repeats a large reference document while changing only the final question. Prompt caching can reuse processing of the stable portion, but OpenRouter documents different controls for providers and API families. A cache-aware client therefore needs a deliberate request layout and current capability information, rather than one universal flag applied to every model.

Place stable reference material deliberately

For a hypothetical manual-question-answering app, put the unchanged manual before the new question. An early changing value can reduce prefix reuse even if the manual text remains identical. Keep the reference content stable when the task allows it, while preserving the real user question and necessary instructions. Caching should follow a sound information layout, not force the product to omit context needed for a correct answer.

Use the provider’s supported breakpoint control

The current guide distinguishes automatic caching and explicit controls. Anthropic-style Chat Completions examples can place cache_control on selected blocks. Responses does not expose that same per-input-block form; the documentation describes prompt_cache_breakpoint conversion for supported routes instead. Choose the actual family and provider behavior before writing a wrapper. Similar concepts do not imply identical JSON nesting or identical cache lifetimes across endpoints.

Account for provider selection and cache locality

OpenRouter documents sticky routing behavior intended to improve cache reuse. This does not mean every provider shares one cache. A route change can alter whether previously processed material is reusable. Keep the selected provider and reported cache usage with a representative evaluation. The manual app should not infer that identical prompt text guarantees a hit on any eligible backend after a fallback.

Read cache usage in the correct response shape

The guide distinguishes input-token details for Responses from prompt-token details for Chat Completions, including cache writes and reads. A cache write is not the same event as a cache read. Preserve those counters separately. Exact billing rules vary by provider and model, so evaluate the real request pattern instead of promising that marking a large block always makes a one-off request cheaper.

Evaluate reuse without changing the answer contract

Send representative follow-up questions against the same manual and inspect both cache counters and answer quality. Then vary the stable prefix intentionally to understand the integration’s behavior. This is an evaluation plan, not a measured performance claim. The successful design preserves the needed source and task semantics while making reuse observable, with expiration and fallback treated as normal possibilities rather than unexplained failures.

Documentation and further study

Related engineering guides: OpenRouter prompt caching: verifying savings in usage data; OpenRouter provider routing: the difference between only and order.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles