Stop pasting headers on every request. Set cartie.set_tenant("marketing") once at startup. Every subsequent call to OpenAI / Anthropic carries the attribution + egress gate headers automatically.
Single-file Python + TypeScript SDKs. Zero dependencies beyond the upstream LLM client. Just curl into your repo.
curl -O https://cartieai.com/api/sdk/cartie.py pip install openai # That's it. import cartie in your code.
import cartie
cartie.set_proxy(key="ck_live_...")
cartie.set_tenant("marketing")
client = cartie.openai() # drop-in for openai.OpenAI()
client.chat.completions.create(
model="gpt-5.2",
messages=[{"role": "user", "content": "Draft a blog headline"}],
)
# Egress gate (refuse cross-cloud bleed):
with cartie.egress(source="gcp", dest="aws", data_gb=1024,
token_pct=0.05, enforce=True):
# If verdict is rose, proxy returns 412 BEFORE the upstream call.
client.chat.completions.create(model="gemini-3-flash", ...)curl -O https://cartieai.com/api/sdk/cartie.ts npm install openai # That's it. import * as cartie from './cartie' in your code.
import * as cartie from './cartie';
cartie.setProxy({ key: process.env.CARTIE_KEY! });
cartie.setTenant('marketing');
const client = cartie.openai({ apiKey: process.env.OPENAI_KEY! });
await client.chat.completions.create({
model: 'gpt-5.2',
messages: [{ role: 'user', content: 'Hello' }],
});
// Egress gate inside an async scope:
await cartie.withEgress(
{ source: 'gcp', dest: 'aws', dataGB: 1024, tokenPct: 0.05, enforce: true },
() => client.chat.completions.create({ model: 'gemini-3-flash', ... }),
);Every header below is added to your OpenAI / Anthropic calls when the corresponding setter is configured. Skip the setter → header is omitted.
| Header | Configure with | What it does |
|---|---|---|
| X-Cartie-Key | set_proxy(key=…) | Authenticate the proxy. Required for every call. |
| X-Cartie-Tenant | set_tenant("marketing") | Per-department chargeback. Splits a shared bill. |
| X-Cartie-Source-Cloud | set_egress(source=…) | Egress preflight: source cloud (aws / gcp / azure / snowflake). |
| X-Cartie-Dest-Cloud | set_egress(dest=…) | Egress preflight: destination cloud. |
| X-Cartie-Data-GB | set_egress(data_gb=…) | Payload size for the preflight calculation. |
| X-Cartie-Token-Budget-Pct | set_egress(token_pct=…) | Tokens generated per GB of input (default 10%). |
| X-Cartie-Egress-Enforce | set_egress(enforce=True) | When true, proxy 412s rose verdicts before forwarding. |
Sign in, click "New proxy key" in the LLM Proxy panel, copy the secret into cartie.set_proxy(key=…), and you're live.