Response caching
Opt in to exact response caching and zero-cost cache hits.
Exact response caching is disabled unless you turn it on for a request. It is best for deterministic prompts, evaluations, classification, and repeated examples. Streaming requests are never cached.
Enable the cache
Add outerlane.cache to the request body. true uses a one-hour TTL; an object can choose ttlSeconds from 60 seconds to 24 hours.
{
"model": "openai/gpt-6.1-sol",
"messages": [{ "role": "user", "content": "Classify this message as billing, bug, or feature." }],
"outerlane": {
"cache": { "enabled": true, "ttlSeconds": 3600 }
}
}With the OpenAI SDK, send the same object through extra_body.
response = client.chat.completions.create(
model="openai/gpt-6.1-sol",
messages=[{"role": "user", "content": "Classify this message."}],
extra_body={"outerlane": {"cache": True}},
)A cache key is the SHA-256 hash of your user ID and normalized upstream request payload. Prompts are not stored in the cache; only the hashed key and response JSON are held temporarily in Redis until the TTL expires.
Cache hits
A hit returns the stored response without another upstream call. x_outerlane.cache_hit is true, the token counts remain visible for analytics, and costUsd and chargedUsd are 0.
Exact means exact: model, messages, sampling options, tools, and other upstream parameters must normalize to the same payload. Temperature is not overridden automatically, so set deterministic options yourself when needed.
Cached entries expire automatically at their TTL in Redis. Use redaction when prompts may contain emails or embedded credentials.