Gateway: OpenAI SDK
PlatformPoint the official OpenAI Python or TypeScript client at Traccia. Chat Completions only.
Set base_url (Python) or baseURL (TypeScript) to https://gateway.traccia.ai/openai/v1. Send both Traccia headers on the client with default_headers / defaultHeaders. Keep OPENAI_API_KEY on the client.
What this Gateway accepts
OpenAI:
POST /openai/v1/chat/completions and GET /openai/v1/models. Anthropic: POST /anthropic/v1/messages. Gemini Developer API: POST /google/{v1beta|v1}/models/{model}:generateContent and :streamGenerateContent. Embeddings, the OpenAI Responses API, Assistants, Azure OpenAI paths, Vertex AI paths, and Anthropic Batches are not this Gateway. Those requests 404.Headers
| Header | Value |
|---|---|
| X-Traccia-Api-Key | Workspace key from Settings → API Keys |
| X-Traccia-Agent-Id | Same Agent ID you would pass to init |
Keep the provider API key on the client. The Gateway forwards it and does not store it. Missing Traccia key returns 401. Missing agent ID returns 400.
Client
import osfrom openai import OpenAI
client = OpenAI( api_key=os.environ["OPENAI_API_KEY"], base_url="https://gateway.traccia.ai/openai/v1", default_headers={ "X-Traccia-Api-Key": os.environ["TRACCIA_API_KEY"], "X-Traccia-Agent-Id": "billing-bot", },)
response = client.chat.completions.create( model="gpt-4o-mini", messages=[{"role": "user", "content": "hello"}],)The official client appends /chat/completions to this base. The request that must land is POST https://gateway.traccia.ai/openai/v1/chat/completions. Do not put /chat/completions in base_url.
What Works
client.chat.completions.create(includingstream=True)client.models.list(auth only, no policy check)
What 404s
Not Chat Completions
client.responses.create, embeddings, Assistants, Realtime, and Azure OpenAI /openai/deployments/{id}/chat/completions are not this Gateway.Next Steps
© 2026 Traccia.