DocsAPI
API reference
Use this reference to look up the full request surface: authentication, upstream selection, per-request headers, endpoints and error shapes.
Help me check this project's condense integration against the API reference. Read https://condense.chat/docs/reference/. Find where this project calls condense, then compare its routes, headers, credentials and error handling with the reference. A 403 on a provider route can mean the condense key lacks the Proxy permission (https://condense.chat/docs/api/#permissions). If it doesn't call condense yet, follow https://condense.chat/docs/quickstart/ instead. List anything that doesn't match, with the file and line, and ask me before changing it. Never print a key.
Introduction
condense.chat sits between your app and your LLM provider. Point your SDK at a provider route, add your condense key and keep your provider key. condense compacts the repeated context in each request before forwarding it upstream, with the same request and response shapes.
Choose the surface for your app:
- Provider routes are drop-in for the Anthropic and OpenAI SDKs. Point
base_urlat/anthropicor/openai/v1and everything else stays the same. - Cloud routes take your existing Vertex AI and Amazon Bedrock calls. Swap the host, keep the rest of the path, and the call still runs on your own cloud account.
/v1/compresscompacts a transcript directly and hands it back, with no upstream call. Pick a model per request.- Pass-through forwards any other provider path (a models list, embeddings) verbatim.
Base URL: https://api.condense.chat. The dialect is selected by the path prefix; the X-Condense-Upstream-Url header selects where the compacted request is forwarded. This host runs in the EU; the US endpoint covers the second host, https://api.us.condense.chat. New here? Start with the Quickstart, choose a model on Models, and review Rate limits before production.
Authentication
Two keys travel on every request: your condense key (gates access to condense.chat) and your upstream provider key (charged for the model call). We never store the upstream key, only a sha256 fingerprint in the usage ledger.
The condense API key (ck_api_…) always travels in the X-Condense-Auth-Token header, on every route. The upstream key goes in whatever header the provider expects: x-api-key for Anthropic, Authorization: Bearer for OpenAI, a Google credential for Vertex AI, and a Bedrock API key sent as a bearer token for Amazon Bedrock. Using a custom header for the condense key means Authorization is always available for the upstream, with no precedence conflicts in any SDK.
API access is enabled for organization accounts after an email or call with our team. See Get API access.
Anthropic
httpPOST /anthropic/v1/messages
X-Condense-Auth-Token: ck_api_<your-condense-key>
x-api-key: sk-ant-<your-anthropic-key>
anthropic-version: 2023-06-01
Content-Type: application/jsonOpenAI
httpPOST /openai/v1/chat/completions
X-Condense-Auth-Token: ck_api_<your-condense-key>
Authorization: Bearer sk-<your-openai-key>
Content-Type: application/jsonVertex AI
httpPOST /vertex/v1/projects/<project>/locations/<location>/publishers/anthropic/models/<model>:rawPredict
X-Condense-Auth-Token: ck_api_<your-condense-key>
Authorization: Bearer <your-google-access-token>
Content-Type: application/jsonAmazon Bedrock
httpPOST /bedrock/<region>/model/<model-id>/invoke
X-Condense-Auth-Token: ck_api_<your-condense-key>
Authorization: Bearer <your-bedrock-api-key>
Content-Type: application/jsonBring your own upstream
By default a provider route forwards to that provider's own API: /anthropic/… to api.anthropic.com, /openai/… to api.openai.com. Send X-Condense-Upstream-Url to forward to something else instead. It can be any endpoint that speaks the OpenAI or Anthropic request shape, such as a self-hosted gateway, a vLLM or router deployment, or another vendor's compatible API. condense compacts the conversation exactly as it always does, then forwards there.
| Anthropic routes | Send the host root (https://host/prefix). condense appends /v1/messages. |
|---|---|
| OpenAI routes | Send the base including /v1 (https://host/v1), matching the SDK base_url convention. condense appends /chat/completions. |
bashcurl https://api.condense.chat/openai/v1/chat/completions \
-H "X-Condense-Auth-Token: ck_api_..." \
-H "Authorization: Bearer sk-..." \
-H "X-Condense-Upstream-Url: https://my-gateway.example.com/v1" \
-d '{"model":"my-model","messages":[...]}'The URL must be https with a public host. Private and loopback addresses are rejected. If the upstream takes a different credential than the provider would, put it in X-Condense-Upstream-Key and it is used in place of whatever arrived in Authorization / x-api-key.
Overriding the upstream must be enabled on your account. Calls without the entitlement return 403.
This header is the only way to point condense somewhere else. To compress a transcript without any upstream call at all, use POST /v1/compress.
US endpoint
https://api.us.condense.chat serves the same API from AWS in the United States (us-east-1). Change the host in your base URL to use it. You keep the same API key, there's no setting to turn on, and your usage shows up in the same helm dashboard. The default host, api.condense.chat, runs in the EU.
| Anthropic | https://api.us.condense.chat/anthropic |
|---|---|
| OpenAI | https://api.us.condense.chat/openai/v1 |
| Direct compression | POST https://api.us.condense.chat/v1/compress |
| Vertex AI | https://api.us.condense.chat/vertex |
| Amazon Bedrock | https://api.us.condense.chat/bedrock/{region} |
bashcurl https://api.us.condense.chat/anthropic/v1/messages \
-H "X-Condense-Auth-Token: $CONDENSE_KEY" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"claude-haiku-4-5-20251001","max_tokens":256,"messages":[{"role":"user","content":"hi"}]}'Credentials go in the same headers as on the default host. Compression, pass-through, streaming, request headers and rate limits work the same way, and the same errors apply.
Routes under /v1 other than /v1/compress, such as GET /v1/me/requests/{request_id}, are served from api.condense.chat. The US host answers them with a 307 redirect, so call them on api.condense.chat directly.
The dense CLI uses the default host. If you want to run it through the US endpoint, get in touch.
What runs where
On the US endpoint, requests are received and processed in the US, conversation content is held in memory only and sent to our EU infrastructure for compression, and account and billing records are kept in the EU.
| US (us-east-1) | Receiving your request, holding conversation content in memory, handling it in the proxy, and forwarding it to your model provider. |
|---|---|
| EU | The compression models, API key and account checks, and account and billing records. |
On this endpoint your content doesn't stay in the US: conversation content goes to the EU for compression. The endpoint also isn't independent of the EU deployment, because it relies on our EU infrastructure to check API keys and load account settings.
Your model provider has its own processing locations. The subprocessor list shows the location and transfer safeguard for each provider we use.
Per-request headers
| Header | Effect |
|---|---|
X-Condense-Auth-Token | Required. Your condense API key (ck_api_…). Used on every route. |
X-Condense-Upstream-Url | Forward to this base instead of the provider default. Must be https with a public host. See Bring your own upstream. |
X-Condense-Upstream-Key | Credential for the upstream, overriding whatever arrived in Authorization / x-api-key. Useful when your own upstream takes a different key than the provider. |
X-Condense-Session-Id | Optional. Groups requests into a session so the dashboard can show per-session savings. A UUID, or any id of yours up to 128 characters (condense maps it to a stable UUID). The dense CLI sets this for you. |
X-Condense-Tenant | Optional. Your customer, workspace or account the request is for. Spend, savings and requests break down by it in the dashboard and the analytics API (group_by=tenant). Up to 128 characters. |
X-Condense-End-User | Optional. The person within that tenant. Falls back to the body's Anthropic metadata.user_id or OpenAI user. Dropped under zero data retention and removed with other identifiers after 7 days. |
X-Condense-Feature | Optional. Which part of your product made the call, e.g. chat or summarise. Up to 64 characters. |
X-Condense-Env | Optional. prod, staging, dev or your own name, up to 32 characters. |
X-Condense-Tags | Optional. Up to eight key=value pairs, comma separated, stored with the request. Dropped under zero data retention. |
Authorization / x-api-key | Your upstream provider key (Anthropic uses x-api-key; OpenAI, Vertex AI and Amazon Bedrock use Authorization: Bearer). Forwarded verbatim; never stored. |
Response headers
condense adds these headers to the response:
| Header | Meaning |
|---|---|
X-Request-Id | The request's id. |
X-Condense-Mode | How the request was handled: full, lite or passthrough. |
X-Condense-Mode-Reason | Sent when X-Condense-Mode was not full. |
X-Condense-Strategy | The compressor used. |
X-Condense-Added-Ms | The milliseconds condense spent before calling your provider. |
Tokens and dollars saved settle after the response. Read them with GET /v1/me/requests/{request_id} (or /v1/orgs/{org_id}/requests/{request_id} for an org), using a key with the Read permission.
Upstream response headers come back as-is, minus hop-by-hop headers and content-encoding (bodies are re-encoded in flight).
Worked examples
Use these short guides to try each provider and mode. Each one has a paragraph on what the mode does, the smallest possible curl that exercises it, and then the same call in Python (no SDK, just urllib) in a three-turn tool loop that computes (17 + 25) * 3. To use one, pick a tab, copy the snippet, replace the keys and run it.
proxy is the condense path: condense compresses your messages, forwards to the upstream, and returns the provider's normal completion. You pay for the upstream call. This is the default and what most callers want.
direct tabs are baselines. They don't touch condense at all, included so you can compare and see exactly which headers change.
Baseline: talk to OpenAI directly. Sends one OpenAI key in Authorization; no condense involvement. Use this as the control variant when comparing against the proxy tab.
bash# single-turn smoke
curl https://api.openai.com/v1/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"hi"}]}'python# three-turn tool loop; pip-free
import json, os
from urllib.request import Request, urlopen
URL = "https://api.openai.com/v1/chat/completions"
KEY = os.environ["OPENAI_API_KEY"]
TOOLS = [
{"type":"function","function":{"name":"add","parameters":{"type":"object","properties":{"a":{"type":"number"},"b":{"type":"number"}}}},
{"type":"function","function":{"name":"mul","parameters":{"type":"object","properties":{"a":{"type":"number"},"b":{"type":"number"}}}},
{"type":"function","function":{"name":"final_answer","parameters":{"type":"object","properties":{"text":{"type":"string"}}}},
]
def tool(name, args):
if name == "add": return str(args["a"] + args["b"])
if name == "mul": return str(args["a"] * args["b"])
return args["text"]
def post(messages):
body = json.dumps({"model":"gpt-4o-mini","messages":messages,"tools":TOOLS,"tool_choice":"auto"}).encode()
req = Request(URL, method="POST", data=body, headers={
"Authorization": f"Bearer {KEY}",
"Content-Type": "application/json",
})
return json.loads(urlopen(req).read())
messages = [{"role":"user","content":"Compute (17 + 25) * 3 using add and mul, then call final_answer."}]
for _ in range(6):
msg = post(messages)["choices"][0]["message"]
if not msg.get("tool_calls"): print(msg.get("content") or ""); break
messages.append(msg)
for tc in msg["tool_calls"]:
args = json.loads(tc["function"]["arguments"] or "{}")
result = tool(tc["function"]["name"], args)
print(f"{tc['function']['name']}({args}) -> {result}")
messages.append({"role":"tool","tool_call_id":tc["id"],"content":result})
if tc["function"]["name"] == "final_answer": raise SystemExitSame shape as direct, but the URL is condense's /openai/v1/chat/completions, the condense key rides in X-Condense-Auth-Token, and your OpenAI key stays in Authorization. Condense compresses, forwards, streams back the upstream response. Your code doesn't change.
bashcurl https://api.condense.chat/openai/v1/chat/completions \
-H "X-Condense-Auth-Token: $CONDENSE_KEY" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"hi"}]}'python# identical to the direct example, only URL + headers change
import json, os
from urllib.request import Request, urlopen
URL = "https://api.condense.chat/openai/v1/chat/completions"
OAI = os.environ["OPENAI_API_KEY"]
CON = os.environ["CONDENSE_KEY"]
TOOLS = [
{"type":"function","function":{"name":"add","parameters":{"type":"object","properties":{"a":{"type":"number"},"b":{"type":"number"}}}},
{"type":"function","function":{"name":"mul","parameters":{"type":"object","properties":{"a":{"type":"number"},"b":{"type":"number"}}}},
{"type":"function","function":{"name":"final_answer","parameters":{"type":"object","properties":{"text":{"type":"string"}}}},
]
def tool(name, args):
if name == "add": return str(args["a"] + args["b"])
if name == "mul": return str(args["a"] * args["b"])
return args["text"]
def post(messages):
body = json.dumps({"model":"gpt-4o-mini","messages":messages,"tools":TOOLS,"tool_choice":"auto"}).encode()
req = Request(URL, method="POST", data=body, headers={
"X-Condense-Auth-Token": CON,
"Authorization": f"Bearer {OAI}",
"Content-Type": "application/json",
})
return json.loads(urlopen(req).read())
messages = [{"role":"user","content":"Compute (17 + 25) * 3 using add and mul, then call final_answer."}]
for _ in range(6):
msg = post(messages)["choices"][0]["message"]
if not msg.get("tool_calls"): print(msg.get("content") or ""); break
messages.append(msg)
for tc in msg["tool_calls"]:
args = json.loads(tc["function"]["arguments"] or "{}")
result = tool(tc["function"]["name"], args)
print(f"{tc['function']['name']}({args}) -> {result}")
messages.append({"role":"tool","tool_call_id":tc["id"],"content":result})
if tc["function"]["name"] == "final_answer": raise SystemExitBaseline: talk to Anthropic directly. The Anthropic dialect puts the upstream key in x-api-key (not Authorization) and requires the anthropic-version header. Tools are typed; the model's tool calls come back as tool_use blocks; tool results go back as tool_result blocks.
bashcurl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"claude-haiku-4-5-20251001","max_tokens":256,"messages":[{"role":"user","content":"hi"}]}'pythonimport json, os
from urllib.request import Request, urlopen
URL = "https://api.anthropic.com/v1/messages"
KEY = os.environ["ANTHROPIC_API_KEY"]
TOOLS = [
{"name":"add","input_schema":{"type":"object","properties":{"a":{"type":"number"},"b":{"type":"number"}},"required":["a","b"]},
{"name":"mul","input_schema":{"type":"object","properties":{"a":{"type":"number"},"b":{"type":"number"}},"required":["a","b"]},
{"name":"final_answer","input_schema":{"type":"object","properties":{"text":{"type":"string"}},"required":["text"]},
]
def tool(name, args):
if name == "add": return str(args["a"] + args["b"])
if name == "mul": return str(args["a"] * args["b"])
return args["text"]
def post(messages):
body = json.dumps({
"model":"claude-haiku-4-5-20251001","max_tokens":1024,
"messages":messages,"tools":TOOLS,
}).encode()
req = Request(URL, method="POST", data=body, headers={
"x-api-key": KEY,
"anthropic-version": "2023-06-01",
"Content-Type": "application/json",
})
return json.loads(urlopen(req).read())
messages = [{"role":"user","content":"Compute (17 + 25) * 3 using add and mul, then call final_answer."}]
for _ in range(6):
resp = post(messages)
blocks = resp["content"]
messages.append({"role":"assistant","content":blocks})
calls = [b for b in blocks if b["type"] == "tool_use"]
if not calls:
print("".join(b.get("text", "") for b in blocks)); break
results = []
for b in calls:
result = tool(b["name"], b["input"])
print(f"{b['name']}({b['input']}) -> {result}")
results.append({"type":"tool_result","tool_use_id":b["id"],"content":result})
if b["name"] == "final_answer": raise SystemExit
messages.append({"role":"user","content":results})Anthropic-dialect proxy. The condense key rides in X-Condense-Auth-Token (same as the OpenAI path); your Anthropic key stays in x-api-key. Streaming ("stream": true) works identically to the direct path.
bashcurl https://api.condense.chat/anthropic/v1/messages \
-H "X-Condense-Auth-Token: $CONDENSE_KEY" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"claude-haiku-4-5-20251001","max_tokens":256,"messages":[{"role":"user","content":"hi"}]}'pythonimport json, os
from urllib.request import Request, urlopen
URL = "https://api.condense.chat/anthropic/v1/messages"
ANT = os.environ["ANTHROPIC_API_KEY"]
CON = os.environ["CONDENSE_KEY"]
TOOLS = [
{"name":"add","input_schema":{"type":"object","properties":{"a":{"type":"number"},"b":{"type":"number"}},"required":["a","b"]},
{"name":"mul","input_schema":{"type":"object","properties":{"a":{"type":"number"},"b":{"type":"number"}},"required":["a","b"]},
{"name":"final_answer","input_schema":{"type":"object","properties":{"text":{"type":"string"}},"required":["text"]},
]
def tool(name, args):
if name == "add": return str(args["a"] + args["b"])
if name == "mul": return str(args["a"] * args["b"])
return args["text"]
def post(messages):
body = json.dumps({"model":"claude-haiku-4-5-20251001","max_tokens":1024,"messages":messages,"tools":TOOLS}).encode()
req = Request(URL, method="POST", data=body, headers={
"X-Condense-Auth-Token": CON,
"x-api-key": ANT,
"anthropic-version": "2023-06-01",
"Content-Type": "application/json",
})
return json.loads(urlopen(req).read())
messages = [{"role":"user","content":"Compute (17 + 25) * 3 using add and mul, then call final_answer."}]
for _ in range(6):
resp = post(messages)
blocks = resp["content"]
messages.append({"role":"assistant","content":blocks})
calls = [b for b in blocks if b["type"] == "tool_use"]
if not calls:
print("".join(b.get("text", "") for b in blocks)); break
results = []
for b in calls:
result = tool(b["name"], b["input"])
print(f"{b['name']}({b['input']}) -> {result}")
results.append({"type":"tool_result","tool_use_id":b["id"],"content":result})
if b["name"] == "final_answer": raise SystemExit
messages.append({"role":"user","content":results})claude-agent-sdk-python is the official Anthropic SDK for spawning long-running tool-using agents. It shells out to claude under the hood, so all you need to do is point its ANTHROPIC_BASE_URL at condense's /anthropic prefix and pass your condense key via the SDK's env option. The direct mode isn't relevant here: the agent loop needs upstream completions.
bash# install once
pip install claude-agent-sdk
npm install -g @anthropic-ai/claude-code # the SDK shells out to thispythonimport anyio, os
from claude_agent_sdk import query, ClaudeAgentOptions
opts = ClaudeAgentOptions(env={
"ANTHROPIC_BASE_URL": "https://api.condense.chat/anthropic",
"ANTHROPIC_CUSTOM_HEADERS": f"X-Condense-Auth-Token: {os.environ['CONDENSE_KEY']}",
"ANTHROPIC_API_KEY": os.environ["ANT_API_TOKEN"],
})
async def main():
async for msg in query(prompt="Compute (17 + 25) * 3 step by step.", options=opts):
print(msg)
anyio.run(main)Every tool turn passes through condense, which compresses older context before forwarding upstream. To set additional per-request headers for one session (e.g. X-Condense-Session-Id), append them to ANTHROPIC_CUSTOM_HEADERS.
Endpoints
Each entry lists the method and path, what the route does and an example request. Requests use the base URL and the credentials described in Authentication.
Compress messages
Compress a transcript and get it back in the same shape: N messages in, N messages out, each compressed independently with its role and order preserved. No conversation tracking, no upstream model call. Requires the compress capability on your account; returns 403 otherwise.
Request body
modelstringRequired
helene-1.1 or adeline-1. An unknown or undeployed name returns 400 with the list of currently selectable compressors.messagesarrayRequired
{"role", "content"}). A message the compressor abstains on (empty, too short, or quality-gated) comes back with its original content unchanged.compression_ratenumber
helene-1.1 only. Fraction of tokens to remove, between 0 and 1. Omit to let the model pick the rate. Out-of-range values return 400.import httpx
resp = httpx.post(
"https://api.condense.chat/v1/compress",
headers={"X-Condense-Auth-Token": "ck_api_..."},
json={
"model": "helene-1.1",
"compression_rate": 0.6,
"messages": [
{"role": "system", "content": "You are a terse assistant."},
{"role": "user", "content": "<a long transcript to compress>"},
],
},
)
print(resp.json())const resp = await fetch("https://api.condense.chat/v1/compress", {
method: "POST",
headers: {
"X-Condense-Auth-Token": "ck_api_...",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "helene-1.1",
compression_rate: 0.6,
messages: [
{ role: "system", content: "You are a terse assistant." },
{ role: "user", content: "<a long transcript to compress>" },
],
}),
});
console.log(await resp.json());package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
body := []byte(`{"model":"helene-1.1","compression_rate":0.6,"messages":[{"role":"system","content":"You are a terse assistant."},{"role":"user","content":"<a long transcript to compress>"}]}`)
req, _ := http.NewRequest("POST", "https://api.condense.chat/v1/compress", bytes.NewReader(body))
req.Header.Set("X-Condense-Auth-Token", "ck_api_...")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
}use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = Client::new()
.post("https://api.condense.chat/v1/compress")
.header("X-Condense-Auth-Token", "ck_api_...")
.json(&json!({
"model": "helene-1.1",
"compression_rate": 0.6,
"messages": [
{"role": "system", "content": "You are a terse assistant."},
{"role": "user", "content": "<a long transcript to compress>"}
]
}))
.send().await?;
println!("{}", resp.text().await?);
Ok(())
}curl https://api.condense.chat/v1/compress \
-H "X-Condense-Auth-Token: ck_api_..." \
-H "Content-Type: application/json" \
-d '{
"model": "helene-1.1",
"compression_rate": 0.6,
"messages": [
{"role": "system", "content": "You are a terse assistant."},
{"role": "user", "content": "<a long transcript to compress>"}
]
}'json{
"model": "helene-1.1",
"messages": [
{"role": "system", "content": "terse assistant."},
{"role": "user", "content": "<surviving text, verbatim>"}
]
}Anthropic Messages
Identical request and response shape to api.anthropic.com/v1/messages. Streaming (stream: true) is preserved end-to-end; all anthropic-* headers (prompt caching, betas) forward through unchanged.
import httpx
resp = httpx.post(
"https://api.condense.chat/anthropic/v1/messages",
headers={"X-Condense-Auth-Token": "ck_api_...", "x-api-key": "sk-ant-...", "anthropic-version": "2023-06-01"},
json={"model": "claude-haiku-4-5", "max_tokens": 256, "messages": [{"role": "user", "content": "hi"}]},
)
print(resp.json())const resp = await fetch("https://api.condense.chat/anthropic/v1/messages", {
method: "POST",
headers: {
"X-Condense-Auth-Token": "ck_api_...",
"x-api-key": "sk-ant-...",
"anthropic-version": "2023-06-01",
"Content-Type": "application/json",
},
body: JSON.stringify({ model: "claude-haiku-4-5", max_tokens: 256, messages: [{ role: "user", content: "hi" }] }),
});
console.log(await resp.json());package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
body := []byte(`{"model":"claude-haiku-4-5","max_tokens":256,"messages":[{"role":"user","content":"hi"}]}`)
req, _ := http.NewRequest("POST", "https://api.condense.chat/anthropic/v1/messages", bytes.NewReader(body))
req.Header.Set("X-Condense-Auth-Token", "ck_api_...")
req.Header.Set("x-api-key", "sk-ant-...")
req.Header.Set("anthropic-version", "2023-06-01")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
}use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = Client::new()
.post("https://api.condense.chat/anthropic/v1/messages")
.header("X-Condense-Auth-Token", "ck_api_...")
.header("x-api-key", "sk-ant-...")
.header("anthropic-version", "2023-06-01")
.header("Content-Type", "application/json")
.json(&json!({ model: "claude-haiku-4-5", max_tokens: 256, messages: [{ role: "user", content: "hi" }] }))
.send().await?;
println!("{}", resp.text().await?);
Ok(())
}curl https://api.condense.chat/anthropic/v1/messages \
-H "X-Condense-Auth-Token: ck_api_..." \
-H "x-api-key: sk-ant-..." \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"claude-haiku-4-5","max_tokens":256,"messages":[{"role":"user","content":"hi"}]}'OpenAI Chat Completions
Identical request and response shape to api.openai.com/v1/chat/completions. Streaming is preserved; tool calls round-trip.
import httpx
resp = httpx.post(
"https://api.condense.chat/openai/v1/chat/completions",
headers={"X-Condense-Auth-Token": "ck_api_...", "Authorization": "Bearer sk-..."},
json={"model": "gpt-4o-mini", "messages": [{"role": "user", "content": "hi"}]},
)
print(resp.json())const resp = await fetch("https://api.condense.chat/openai/v1/chat/completions", {
method: "POST",
headers: {
"X-Condense-Auth-Token": "ck_api_...",
"Authorization": "Bearer sk-...",
"Content-Type": "application/json",
},
body: JSON.stringify({ model: "gpt-4o-mini", messages: [{ role: "user", content: "hi" }] }),
});
console.log(await resp.json());package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
body := []byte(`{"model":"gpt-4o-mini","messages":[{"role":"user","content":"hi"}]}`)
req, _ := http.NewRequest("POST", "https://api.condense.chat/openai/v1/chat/completions", bytes.NewReader(body))
req.Header.Set("X-Condense-Auth-Token", "ck_api_...")
req.Header.Set("Authorization", "Bearer sk-...")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
}use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = Client::new()
.post("https://api.condense.chat/openai/v1/chat/completions")
.header("X-Condense-Auth-Token", "ck_api_...")
.header("Authorization", "Bearer sk-...")
.header("Content-Type", "application/json")
.json(&json!({ model: "gpt-4o-mini", messages: [{ role: "user", content: "hi" }] }))
.send().await?;
println!("{}", resp.text().await?);
Ok(())
}curl https://api.condense.chat/openai/v1/chat/completions \
-H "X-Condense-Auth-Token: ck_api_..." \
-H "Authorization: Bearer sk-..." \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"hi"}]}'OpenAI Responses
Drop-in for the OpenAI Responses API (used by Codex). Same request and response shape as api.openai.com/v1/responses.
import httpx
resp = httpx.post(
"https://api.condense.chat/openai/v1/responses",
headers={"X-Condense-Auth-Token": "ck_api_...", "Authorization": "Bearer sk-..."},
json={"model": "gpt-4o-mini", "input": "hi"},
)
print(resp.json())const resp = await fetch("https://api.condense.chat/openai/v1/responses", {
method: "POST",
headers: {
"X-Condense-Auth-Token": "ck_api_...",
"Authorization": "Bearer sk-...",
"Content-Type": "application/json",
},
body: JSON.stringify({ model: "gpt-4o-mini", input: "hi" }),
});
console.log(await resp.json());package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
body := []byte(`{"model":"gpt-4o-mini","input":"hi"}`)
req, _ := http.NewRequest("POST", "https://api.condense.chat/openai/v1/responses", bytes.NewReader(body))
req.Header.Set("X-Condense-Auth-Token", "ck_api_...")
req.Header.Set("Authorization", "Bearer sk-...")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
}use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = Client::new()
.post("https://api.condense.chat/openai/v1/responses")
.header("X-Condense-Auth-Token", "ck_api_...")
.header("Authorization", "Bearer sk-...")
.header("Content-Type", "application/json")
.json(&json!({ model: "gpt-4o-mini", input: "hi" }))
.send().await?;
println!("{}", resp.text().await?);
Ok(())
}curl https://api.condense.chat/openai/v1/responses \
-H "X-Condense-Auth-Token: ck_api_..." \
-H "Authorization: Bearer sk-..." \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o-mini","input":"hi"}'Claude on Vertex AI
Claude on Vertex AI, on your own Google Cloud project. Swap your Vertex host for https://api.condense.chat/vertex, keep the rest of the path, and add your condense key. condense compresses the earlier turns of long conversations and adds one short instruction after your system prompt. Short conversations aren't compressed, and responses come back in Vertex's format.
Path
/vertex/{version}/projects/{project}/locations/{location}/publishers/anthropic/models/{model}:{verb}
{version} is v1 or v1beta1. {location} picks the Google host condense forwards to: global goes to aiplatform.googleapis.com, us and eu go to aiplatform.{location}.rep.googleapis.com, and any other location goes to {location}-aiplatform.googleapis.com.
Credentials
Your condense key in X-Condense-Auth-Token and your Google access token in Authorization: Bearer.
Request body
Vertex's Anthropic body. The model comes from the path, so condense removes any model from the body. It sets anthropic_version to vertex-2023-10-16 if you leave it out.
Compressed
:rawPredict and :streamRawPredict on publishers/anthropic, under a project path as shown above.
Forwarded unchanged
Every other path and method under /vertex that isn't covered in Gemini on Vertex AI, including count-tokens and other publishers such as Mistral. These calls aren't compressed and don't show up in your usage.
Streaming
Call :streamRawPredict with "stream": true in the body. The SSE stream is relayed back to you.
Limits
The same rate limits and errors as the other routes. A version other than the two above returns 404.
bashcurl "https://api.condense.chat/vertex/v1/projects/$GOOGLE_PROJECT/locations/global/publishers/anthropic/models/claude-sonnet-4-6:rawPredict" \
-H "X-Condense-Auth-Token: $CONDENSE_KEY" \
-H "Authorization: Bearer $GOOGLE_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"anthropic_version":"vertex-2023-10-16","max_tokens":256,"messages":[{"role":"user","content":"hi"}]}'Gemini on Vertex AI
Gemini on Vertex AI, on your own Google account. Swap your Vertex host for https://api.condense.chat/vertex, keep the rest of the path, and add your condense key. condense compresses the earlier turns of long conversations and adds one short instruction at the end of your systemInstruction, after your own text. Short conversations aren't compressed, and responses come back in Gemini's format.
Path
With a project: /vertex/{version}/projects/{project}/locations/{location}/publishers/google/models/{model}:{verb}. In express mode, without a project: /vertex/{version}/publishers/google/models/{model}:{verb}. {version} and {location} work as in Claude on Vertex AI.
Credentials
Your condense key in X-Condense-Auth-Token, plus your Google access token in Authorization: Bearer or an express mode key in x-goog-api-key or ?key=. A condense key in ?key= returns 400.
Compressed
:generateContent and :streamGenerateContent?alt=sse, in Gemini's native format.
Forwarded unchanged
:streamGenerateContent without alt=sse, :countTokens, cachedContents and Vertex's OpenAI-compatible endpoint. These calls aren't compressed and don't show up in your usage.
Explicit caches
A request that names a cache with cachedContent doesn't get the added instruction.
Streaming
Add alt=sse to :streamGenerateContent to get compression. The SSE stream is relayed back to you.
Limits
The same rate limits and errors as the other routes. This route is for Vertex AI only: calls to the Gemini Developer API at generativelanguage.googleapis.com aren't covered.
bashcurl "https://api.condense.chat/vertex/v1/projects/$GOOGLE_PROJECT/locations/global/publishers/google/models/gemini-3.8-flash:generateContent" \
-H "X-Condense-Auth-Token: $CONDENSE_KEY" \
-H "Authorization: Bearer $GOOGLE_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"contents":[{"role":"user","parts":[{"text":"hi"}]}]}'Amazon Bedrock
Amazon Bedrock, on your own AWS account. Swap https://bedrock-runtime.{region}.amazonaws.com for https://api.condense.chat/bedrock/{region}, keep the rest of the path, and add your condense key. condense compresses the earlier turns of long conversations and adds one short instruction after your system prompt. Short conversations aren't compressed, and responses come back in your provider's format.
{region} is an AWS region and picks the host condense forwards to. This route always targets bedrock-runtime, so Bedrock Mantle isn't on it.
Credentials
Your condense key in X-Condense-Auth-Token and a Bedrock API key in Authorization: Bearer. On a compressed path, a request with no bearer token returns 401, and x-api-key doesn't count as one. SigV4 isn't supported, because a signature covers the host and the body, and condense changes them.
Compressed
model/{modelId}/invokeandmodel/{modelId}/invoke-with-response-stream, when the model ID containsanthropic.. That covers inference profile IDs too.anthropic/v1/messagesopenai/v1/chat/completionsopenai/v1/responses.previous_response_idisn't forwarded andstoreis set tofalse, so send the whole conversation on each request.
Request body
On InvokeModel, send Bedrock's Claude body. condense removes any model and stream fields, sets anthropic_version to bedrock-2023-05-31 if you leave it out, and moves an anthropic-beta header into the body as anthropic_beta.
Forwarded unchanged
Everything else under /bedrock/{region}, including Converse, ConverseStream and InvokeModel on non-Claude models. These calls aren't compressed and don't show up in your usage.
Streaming
invoke-with-response-stream returns application/vnd.amazon.eventstream. To get Anthropic SSE instead, send Accept: text/event-stream without also accepting the eventstream type. The Messages, Chat Completions and Responses paths stream with "stream": true. On Chat Completions, condense adds stream_options.include_usage unless you set stream_options yourself.
Limits
The same rate limits and errors as the other routes. A region that isn't in AWS's format returns 404.
bashcurl "https://api.condense.chat/bedrock/eu-west-1/model/eu.anthropic.claude-opus-4-6-v1/invoke" \
-H "X-Condense-Auth-Token: $CONDENSE_KEY" \
-H "Authorization: Bearer $AWS_BEARER_TOKEN_BEDROCK" \
-H "Content-Type: application/json" \
-d '{"anthropic_version":"bedrock-2023-05-31","max_tokens":256,"messages":[{"role":"user","content":"hi"}]}'Pass-through
Any other path under a provider prefix (a models list, embeddings, and so on) is forwarded to the upstream unchanged. The compression pipeline does not touch it; this is purely an SDK-compat convenience so one base URL covers the whole provider surface.
import httpx
resp = httpx.get(
"https://api.condense.chat/openai/v1/models",
headers={"X-Condense-Auth-Token": "ck_api_...", "Authorization": "Bearer sk-..."},
)
print(resp.json())const resp = await fetch("https://api.condense.chat/openai/v1/models", {
method: "GET",
headers: {
"X-Condense-Auth-Token": "ck_api_...",
"Authorization": "Bearer sk-...",
},
});
console.log(await resp.json());package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.condense.chat/openai/v1/models", nil)
req.Header.Set("X-Condense-Auth-Token", "ck_api_...")
req.Header.Set("Authorization", "Bearer sk-...")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
}use reqwest::Client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = Client::new()
.get("https://api.condense.chat/openai/v1/models")
.header("X-Condense-Auth-Token", "ck_api_...")
.header("Authorization", "Bearer sk-...")
.send().await?;
println!("{}", resp.text().await?);
Ok(())
}curl https://api.condense.chat/openai/v1/models \
-H "X-Condense-Auth-Token: ck_api_..." \
-H "Authorization: Bearer sk-..."Debugging requests
Failures come back as standard HTTP status codes with the dialect's normal error body; the full breakdown is in Errors below. Two things help when something goes wrong:
- Rate limits. A
429carries aRetry-Afterheader. Retry after that delay with backoff. See Rate limits. - Request id. Every response carries
X-Request-Id(send your own and we keep it). If a request misbehaves, quote that id and reach us via contact. We can correlate it on our side.
Compression never breaks a call on its own: if the condense pipeline hits an internal error mid-request, the proxy forwards your original body upstream unchanged and the request completes without compression.
Backwards compatibility
condense avoids breaking changes. The request and response shapes are the provider's own (Anthropic, OpenAI, Vertex AI, Amazon Bedrock), so upgrading condense never changes the wire format your SDK expects. Model ids are stable aliases: helene-1.1 and adeline-1 keep pointing at the current best engine while internal versions move underneath.
Changes we make freely, without notice:
- adding new routes, optional request fields, and response fields;
- adding new models behind new aliases;
- changing the format of opaque identifiers (keys, request ids).
Retirements are announced ahead of time on Deprecations, and notable changes land in the Changelog.
Errors
Errors follow standard HTTP status codes. Bodies are the dialect's native error JSON for upstream-origin failures (so SDK error parsers keep working); condense-origin failures use a small {"error": {"type": "...", "message": "..."}} shape.
| Status | Meaning |
|---|---|
400 | Bad request body, a malformed Authorization header, or an unknown model / out-of-range compression_rate on /v1/compress. |
401 | Missing or invalid condense key, or no bearer token on a compressed Amazon Bedrock path. |
402 | A spend limit on your organization, a person or a key is used up (error type budget_exceeded), or your credit balance has run out on a /v1/compress call. |
403 | Your key is valid but the account isn't entitled to what the request asked for: compress, the proxy itself, or an upstream URL override. Also returned when the key lacks the permission for the route (Proxy, Models from condense, Read or Manage), when your admin has paused personal keys, and on a compressed /vertex path when the request has no Google credential. |
404 | A path that isn't a valid /vertex or /bedrock path, such as an unknown Vertex version or a malformed AWS region. |
413 | The request body is over the size limit. The response body states the limit. |
429 | Rate-limited. The Retry-After response header says how many seconds to wait. |
5xx | Upstream provider error. The upstream status and body are forwarded verbatim. |
Compression itself never breaks a conversation: if the condense pipeline hits an internal error mid-request, the proxy forwards your original body upstream unchanged and the call completes without compression.
Management API
The management API reads and changes what you see in the dashboard: usage, request logs, keys, members and limits. Its routes live under https://api.condense.chat/v1/. List your organizations with GET /v1/orgs; organization routes take its org_id. The tables below show organization routes after /v1/orgs/{org_id}, so /keys means /v1/orgs/{org_id}/keys.
Send a key in X-Condense-Auth-Token. It needs the Read permission for GET requests and Manage for everything else. A company key acts with the access of the person who created it, and a personal key with yours. A missing permission or access level returns 403.
Who can call what
Admins can call every route. Everyone else needs the access level below.
| Access | Routes |
|---|---|
| View on API | GET /keys |
| Manage on API | POST /keys, and PATCH, /roll and DELETE on a key. Members who aren't admins can change only the keys they created. |
| View on Teams | GET /members, GET /usage, /analytics/sessions |
| View on Teams and API | /requests/{request_id}, /usage/by-model, /savings/daily |
| View on Teams or API | GET /overview, GET /budgets |
| View, by traffic | /requests, /requests/export, the other /analytics/… routes, /usage/series, /budgets/overview. You need View on each product the traffic filter covers. Grouping by member or group also needs View on Teams, and /usage/series and /analytics/export group by member unless you pass another group_by. |
| Manage, by limit | POST /budgets, and PUT and DELETE on a limit. You need Manage on the side the limit covers: Teams for people, API for keys, both for a company limit. |
| Admin | Invites, member access, roles, seats, raise requests, billing, credits, settings, webhooks and the audit log. |
Paths in this table are relative to /v1/orgs/{org_id}.
People and API traffic
Request logs, analytics, /usage/series and /budgets/overview take a traffic filter.
traffic=people: everything not sent with a company key. That is your staff's coding agents, the dense CLI and personal keys. Needs View on Teams.traffic=api: only requests sent with company keys. Needs View on API.- Leave it out to cover both. Needs View on both.
Keys
| Route | What it does |
|---|---|
GET /keys | Lists company keys with their permissions, limit, expiry, created_by_user_id and 30-day usage. |
POST /keys | Creates a company key. Returns id, prefix and secret. The secret is shown once. |
PATCH /keys/{key_id} | Changes name, proxy, models, access or rpm_limit. Send only the fields you change. |
POST /keys/{key_id}/roll | Returns a new secret. The old one keeps working for 24 hours. A key can be rolled once: a second roll returns 409. |
DELETE /keys/{key_id} | Revokes the key at once. |
POST /v1/tokens | Creates a personal key. Same body; the response also has expires_at. |
Request body
namestring
expires_in_daysinteger
proxyboolean
true.modelsboolean
false. If your organization doesn't resell condense's models, true returns 400.accessstring
none, read or manage. Default none.rpm_limitinteger
PATCH, null removes the limit.A key needs at least one permission. A body with proxy and models false and access set to none returns 400. To create a key that can proxy and read usage, call with a key that has Manage:
bashcurl https://api.condense.chat/v1/orgs/$ORG_ID/keys \
-H "X-Condense-Auth-Token: $CONDENSE_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"support-agent","proxy":true,"access":"read","rpm_limit":600}'Members and invites
| Route | What it does |
|---|---|
GET /members | Lists members with role, teams_access, api_access, personal_keys, seat_tier and seat_ends_at, which is set while a removed seat runs to the end of its period. |
PATCH /members/{user_id}/access | Sets teams_access and api_access (none, view or manage) and personal_keys (boolean). Leave a field out to keep it. Returns the member. An admin returns 409: admins always have full access. |
POST /members/invite | Invites by email, with an optional role, seat_tier, teams_access, api_access and personal_keys. The person gets that access when they accept. An organization billed by credits can't send seat_tier. |
Next steps
- Rate limits: review request and credit limits before production.
- Models: choose a compaction model.
- Changelog: read notable changes to the routes.