Features / Caching and context
Repeat answers at a tenth. Long chats that still fit.
Turn on the response cache with one header: an exact repeat is answered from cache at 10% of the original charge. Middle-out compression fits long chats.
What it does
- Opt-in response cache
- One header, or a default on the key. Nothing is cached unless you ask.
- A hit is a tenth
- An exact repeat bills 10% of the original charge and shows HIT in x-uplink-cache.
- Your organization only
- The cache key includes your organization, so no other account ever reads your answers.
- Middle-out compression
- transforms: ["middle-out"], or context_overflow on the key, fits a long chat into the context window instead of failing it.
- Shared prompt caching
- On the Anthropic format a large system prompt that many accounts send can get a cache breakpoint; x-uplink-crowd-cache: off leaves a request out.
- Readable headers
- x-uplink-cache, -cache-ttl, -cache-age and -cache-source-id on cached answers; x-uplink-compressed on compressed ones.
Pricing · live catalog, 2026-11-04
| Request | What happens | Charge |
|---|---|---|
| First request (miss) | 6,000 in, 400 out on Claude Sonnet 5.5 | $0.0084 |
| Exact repeat (hit) | Answered from the cache, no model call | $0.00084 |
| Middle-out compression | Dropped messages are never sent or billed | No fee |
Request example
curl · cache one request
curl https://api.uplinkswitch.com/v1/chat/completions \
-H "Authorization: Bearer $UPLINK_API_KEY" \
-H "x-uplink-cache: on" \
-H "x-uplink-cache-ttl: 3600" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5-5",
"messages": [{"role": "user", "content": "What are your opening hours?"}]
}'Python · read the cache header
from openai import OpenAI
client = OpenAI(base_url="https://api.uplinkswitch.com/v1", api_key="sk-uplink-live-...")
raw = client.chat.completions.with_raw_response.create(
model="claude-sonnet-5-5",
messages=[{"role": "user", "content": "What are your opening hours?"}],
extra_headers={"x-uplink-cache": "on"},
)
print(raw.headers.get("x-uplink-cache")) # HIT or MISScurl · middle-out
curl https://api.uplinkswitch.com/v1/chat/completions \
-H "Authorization: Bearer $UPLINK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5-5",
"transforms": ["middle-out"],
"messages": [ ... a long chat ... ]
}'curl · defaults on a key
curl -X PATCH https://api.uplinkswitch.com/v1/keys/KEY_ID \
-H "Authorization: Bearer $UPLINK_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{"response_cache_ttl": 600, "context_overflow": "middle-out"}'- A hit answers with
x-uplink-cache: HITand the request id of the answer it replays inx-uplink-cache-source-id. transformsis never sent on to the model;[]turns a key’s default off for one request.
Questions
The answer to a request from your organization, keyed by the model and the whole body (stream, user and metadata aside). An exact repeat within the time to live is answered from the cache. Chat completions, messages and embeddings, streamed or not; a streamed hit is replayed as the same events.
A tenth of the original charge. In the table, a Claude Sonnet 5.5 request that cost $0.0084 costs $0.00084 on a repeat, at today's catalog price.
Send x-uplink-cache: on, with x-uplink-cache-ttl from 60 to 86,400 seconds (300 unless set), or give the key a response_cache_ttl so every request on it is cached. x-uplink-cache: off skips a key’s default; x-uplink-cache-clear: true asks the model again and keeps the new answer. OpenRouter’s x-openrouter-cache headers work too.
When the prompt plus room for the answer is longer than the model's context window (1,000,000 tokens on Claude Sonnet 5.5), whole messages are dropped from the middle until it fits. System messages, the first user message and the latest turn are kept, and a tool call stays with its results. x-uplink-compressed says how many messages were dropped.
No. A request with a server tool, a redacted request and a fallback model’s answer are never kept, so a cached answer is always the model you named answering the body you sent.
More features
Agent tools
Web search, fetch, MCP and code.
Files and redaction
PDFs for every model.
Routing
Auto router, fallbacks, presets.
Guardrails and app sign-in
Guardrails on your traffic.
MCP gateway
One MCP endpoint
Endpoints
Embeddings, rerank, transcription.
Observability
Every session, request by request.
All features
Every group, with live prices.