Skip to content
Rapid Router
← API reference

Response caching

Part of the Rapid Router API reference. One OpenAI-compatible endpoint, https://rapidrouter.ai/api/v1, in front of every model in the catalog.

13Response caching

Different from prompt caching below: this replays the whole response, and a replay is completely free. Opt in per request with the X-RR-Cache: true header (X-OpenRouter-Cache is accepted for drop-in) and optionally set X-RR-Cache-TTL in seconds, default 300, up to 86400. Non-streaming chat completions only.

curl https://rapidrouter.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $RAPIDROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-RR-Cache: true" \
  -H "X-RR-Cache-TTL: 600" \
  -d '{ "model": "google/gemini-3.6-flash",
        "messages": [{ "role": "user", "content": "Hello" }] }'

# first response:  X-RR-Cache-Status: miss   (billed normally, then stored)
# same body again: X-RR-Cache-Status: hit    (identical body, billed $0)

The cache key is the SHA-256 of your request body, minus gateway-only fields like user and session_id. JSON property order matters, like OpenRouter: the same fields serialised in a different order are a different entry, so keep your client's serialisation stable. Entries are scoped to your account and never shared, error responses are never stored, and a hit still appears in your usage log, at a cost of zero.