Prompt Caching
Reduce repeated prompt cost when the selected model and upstream support cache controls.
Overview
Prompt caching lets a model reuse the processing of a large, unchanging prefix (a long system prompt, a document, a tool schema) across requests, so you pay less and get faster responses for the repeated part. Caching is model-specific: some providers expose explicit cache markers, some cache implicitly, and some don't support it at all.
Explicit cache control (Claude)
On Claude models, mark the reusable prefix with cache_control. Subsequent requests that share that prefix read it from cache at a reduced rate.
{
"model": "anthropic/claude-sonnet-4.6",
"max_tokens": 512,
"system": [
{
"type": "text",
"text": "<a long, reused style guide or document>",
"cache_control": { "type": "ephemeral" }
}
],
"messages": [{ "role": "user", "content": "Summarize section 3." }]
}Implicit caching (OpenAI / others)
Some models cache automatically — keep the stable part of your prompt at the very start so the unchanging prefix can be matched and reused. No special field is needed; you simply structure the prompt prefix-first.
Cache tokens in usage
When caching applies, the response usage reports cached tokens so you can verify it is working and track savings. Field names vary by provider (e.g. cached_tokens, cache_read_input_tokens).
{
"usage": {
"prompt_tokens": 2200,
"completion_tokens": 120,
"prompt_tokens_details": { "cached_tokens": 2048 }
}
}Model-dependent features
OneRouter keeps protocol compatibility and forwards model-specific parameters where supported. Features such as tool calling, structured output, reasoning, prompt caching, web search, image input, audio input, video generation, and provider-specific options depend on the selected model and upstream provider. Check the model detail page before relying on a feature in production.