Response cache

Replay a stored answer to an identical request on Chat Completions, Responses and Messages, turned on per request, per key or for the whole organization.

What it does

The response cache stores a complete, successful answer and replays it, unchanged, when the same request comes again. A hit never reaches a model or a provider, so it answers in milliseconds and is never charged provider cost. It works on all three text APIs.

It is not prompt caching. Prompt caching is the provider reusing a prompt prefix: the model still runs and you pay for the output. The response cache skips the model entirely and returns the stored answer, so use it only where the same request should get the same answer (tests, evals, repeated lookups, idempotent pipelines).

POST/v1/chat/completionsPOST/v1/responsesPOST/v1/messages
Prompt cachingResponse cache
What is reusedA prompt prefix, at the providerThe whole answer, at the gateway
Does the model runYesNo
You payCached input rate, then outputThe hit price (free today)
Turned on byThe route (automatic or cache_control)You: a header, a key or the organization
Response headerCached tokens in usageX-Explabs-Cache: HIT

Turn it on for one request

Send X-Explabs-Cache: true. The first call answers from the model and saves the answer (X-Explabs-Cache: MISS); the same call again is replayed (X-Explabs-Cache: HIT, with a fresh x-request-id). No header in the response means the cache was not used.

Request headerValues
X-Explabs-Cachetrue reads and saves for this request; false bypasses the cache whatever the settings say
X-Explabs-Cache-TtlSeconds a saved answer stays readable, 1 to 31,536,000 (365 days). Default the organization's time to live, else 7 days
X-Explabs-Cache-SeedUp to 128 printable characters. A different seed never shares an entry, so it partitions the cache (one per test run, for example)

An unreadable value is refused with 400 invalid_cache_header before the call. These headers stay at the gateway and never reach the provider.

curl -si https://api.experientiallabs.ai/v1/chat/completions \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -H "X-Explabs-Cache: true" \
  -H "X-Explabs-Cache-Ttl: 86400" \
  -d '{"model": "gpt-6-luna", "messages": [{"role": "user", "content": "Capital of Japan?"}]}' \
  | grep -i '^x-explabs-cache'
# first call:  x-explabs-cache: MISS
# second call: x-explabs-cache: HIT

Turn it on for a key or the organization

Without the header, a key's mode decides, then the organization default. The request header always wins: X-Explabs-Cache: false bypasses a cache the key or organization turned on.

LevelWhereValues
RequestX-Explabs-Cache headertrue, false
API keyAPI Keys page, or the key routefollow (default), on, off
OrganizationSettings > Data controls, or the organization routeOn or off (off by default), with a default time to live

The organization setting is written by org admins; a key's mode by the key's creator or an org admin. Both routes also take the organization's own key, so an agent can turn the cache on. Changes are audited and reach the gateway within seconds. GET on the organization route also returns blockers (why the cache cannot apply right now: unverified, quarantined, capture_off, zero_data_retention) and the plan's hit_price.

GET/api/orgs/{org_id}/response-cachePUT/api/orgs/{org_id}/response-cacheGET/api/orgs/{org_id}/keys/{key_id}/response-cachePUT/api/orgs/{org_id}/keys/{key_id}/response-cache
curl -X PUT https://api.experientiallabs.ai/api/orgs/ORG_ID/response-cache \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"enabled": true, "ttl_seconds": 86400}'

What counts as the same request

A hit needs the same API (Chat Completions, Responses or Messages), the same body (JSON key order does not matter) and the same seed, sent with the same API key from the same country. Entries never cross organizations or keys, and a change to what the key may call (a newly blocked model, a narrower model allowlist) makes older entries a miss. A hit never replays an answer the caller could not have received.

Only complete, successful answers are saved: a 2xx with a whole JSON body, or a stream that reached its final event, at most 8 MiB. An error or a cut stream is never saved. A cached stream is replayed as one text/event-stream body; SSE clients parse it the same way.

Same requestMiss
Same body with keys in another orderAny other field or message changes
Same key, same seedAnother key, another seed
Same countryA request from another country

When nothing is cached

The cache follows your data controls: it never stores more than your organization stores. Nothing is read or saved when any of these holds.

CaseWhy
Prompt storage is off, or the organization requires zero data retentionA saved answer is stored content
The key is set to Do not store, or the request sends X-Explabs-Storage (or Helicone-Omit-*)The request asked to store less
The request demands zero data retention (provider.zdr: true)The same
A Responses request with store: false, previous_response_id or backgroundUnstored, or the answer depends on earlier state
The key has IP rulesA hit could not check them
The organization is not verified (the card verification), or is under reviewThe cache is for verified organizations only

Deleting stored content or turning storage off makes every saved answer unreachable at once. New saves are capped per organization (64 MiB or 5,000 entries per UTC day) and across the platform; past a cap the call is answered by the model as usual and simply not saved.

X-Explabs-Cache: false
HTTP/1.1 400 Bad Request

{"error": {"code": "invalid_cache_header",
  "message": "X-Explabs-Cache must be true or false."}}

Pricing

A hit dispatches nothing, so it never charges provider cost. What a hit itself costs is a plan setting with three modes: free, a fixed fee per hit, or a share of the cost the hit saved. It is free on every plan today. The price may change; the organization route's hit_price always states your current terms, and usage.cost on a replayed answer states what that hit was charged (0 while free).

hit_price.modeA hit costs
free (today, every plan)Nothing
per_hithit_nano_usd per hit
saved_sharesaved_share_bps basis points of the saved cost

See hits in Observability

Every hit is a row in Requests, marked Cached, with zero tokens, the hit charge as its cost, and the cost it saved (what the original answer cost). The saved cost is never counted as spend. In the Request log API, an item carries cache_hit and cache_saved_usd.

GET/api/orgs/{org_id}/usage/requests
{
  "request_id": "req_01JD8ZK4M2Q7V9X3N5T6B8C0EF",
  "model": "gpt-6-luna",
  "cache_hit": true,
  "cache_saved_usd": 0.0000129,
  "input_tokens": 0,
  "output_tokens": 0,
  "cost_usd": 0
}

Coming from Helicone

This is the same cache that serves the Helicone-Cache-* headers on Helicone hostnames, now on the main gateway too. On our base URL use X-Explabs-Cache, X-Explabs-Cache-Ttl and X-Explabs-Cache-Seed. See Moving from Helicone.

HeliconeHere
Helicone-Cache-Enabled: trueX-Explabs-Cache: true
Cache-Control: max-age=NX-Explabs-Cache-Ttl: N
Helicone-Cache-SeedX-Explabs-Cache-Seed
Helicone-Cache: HITX-Explabs-Cache: HIT