Skip to content

Prompt caching

Smart cache is rout.my's automatic prompt-caching layer for supported models, especially Anthropic Claude. It is enabled by default, so most requests need no extra fields or SDK changes.

For long or repeated conversations, smart cache can reduce the cost of cached input tokens and improve time-to-first-token on long contexts. Exact savings depend on the provider, model, and request shape.

What smart cache does

When smart cache is active, rout.my manages provider-side prompt caching for you. You send the same OpenAI-compatible, Anthropic-compatible, or Responses request as usual, and the service applies caching only where the selected model supports it.

If a model or endpoint does not support provider-side prompt caching, the request still works normally.

Your cache_control always wins

If your request already contains provider caching markers, rout.my leaves them untouched and does not add its own.

This applies to Anthropic-style cache_control blocks in messages. Use this when you want to manage exact cache breakpoints yourself.

When you manage caching yourself, you are responsible for the provider's rules and limits, including Anthropic's maximum number of cache breakpoints.

The smart_cache parameter

You can override smart cache per request with a top-level boolean field:

ValueBehavior
smart_cache: falserout.my does not touch caching for this request. It injects nothing and modifies nothing. Any caching markers you send pass through exactly as-is.
smart_cache: trueForce-enable smart cache for this request, even if it is disabled in your dashboard settings. If you also send your own cache_control blocks, your blocks still win.
absentYour dashboard setting decides.

smart_cache is accepted on OpenAI-compatible Chat Completions, Anthropic-compatible Messages, and Responses requests. rout.my uses it only for routing this request and does not forward the field to the provider.

Disable smart cache for one request

bash
curl https://api.rout.my/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4.6",
    "smart_cache": false,
    "messages": [
      { "role": "user", "content": "Summarize this long document." }
    ]
  }'

Use this when you need a fully hands-off request and want any provider caching markers to pass through exactly as you sent them.

Force smart cache for one request

bash
curl https://api.rout.my/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4.6",
    "smart_cache": true,
    "messages": [
      { "role": "user", "content": "Continue this long conversation." }
    ]
  }'

Use this when your dashboard setting is off but a specific long-context request should still use smart cache.

Dashboard setting

Your dashboard includes a per-user cache setting for Claude. Leave it on to let rout.my handle supported requests automatically, or turn it off if you prefer to manage caching yourself.

The request-level smart_cache field overrides the dashboard setting only for that request.

Notes

  • Smart cache changes caching behavior only; it does not change your prompt or requested model.
  • You do not need to add smart_cache: true when the dashboard setting is already on.
  • If you send your own cache_control, rout.my stays hands-off for that request.

API documentation for rout.my.