Automatic Prompt Caching
Automatically injects cache_control into multi-turn calls to Anthropic models, so you get cache discounts with zero setup.
Anthropic prompt caching is opt-in — it only works if you attach cache_control markers yourself, so you miss the discount if you don't know about it. PleumRouter automatically injects cache breakpoints into multi-turn calls routed to Anthropic models — no request changes needed, enabled by default (operations setting routing.auto_cache_enabled).
curl https://apirouter.pleum.ai/v1/chat/completions \
-H "Authorization: Bearer plm_..." \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"messages": [
{"role": "system", "content": "<long system prompt, 4000+ chars>"},
{"role": "user", "content": "First question about the document."},
{"role": "assistant", "content": "..."},
{"role": "user", "content": "Follow-up question."}
]
}'How it decides#
Explicit always wins — if you attached cache_control anywhere in the request yourself, auto-injection backs off entirely. Requests already using explicit caching keep working unchanged.
No-op on the first turn — if the conversation has no assistant message yet (a first request), nothing is injected. It only intervenes on multi-turn conversations, where reuse is certain.
At most 2 injection points— the last block of the system prompt, and the last block of the second-to-last user message (where multi-turn prefix reuse is maximized). Each point is only used when its content totals at least 4,000 characters (matching Anthropic's minimum cacheable size; operator-tunable).
Injection happens only inside the request after it is converted to the Anthropic API format, so even if a fallback ends up serving the request from another (OpenAI-compatible) provider, cache_control never leaks there.
Billing and the response#
On a cache hit, the response usage exposes prompt_tokens_details.cached_tokens (hit tokens) and cache_creation_input_tokens (write tokens), and the discount/surcharge is applied to billing automatically. See the Chat Completions docs for caching rates.
"usage": {
"prompt_tokens": 12480,
"completion_tokens": 210,
"prompt_tokens_details": {"cached_tokens": 11900},
"cache_creation_input_tokens": 0
}cache_control explicitly — auto-injection steps aside and only your markers apply.