Gateway: Anthropic SDK
Point the official Anthropic Python or TypeScript client at Traccia. Messages API only. Do not add /v1 to the base URL.
Set base_url / baseURL to https://gateway.traccia.ai/anthropic. Do not add /v1. The official SDK default is https://api.anthropic.com and it appends /v1/messages. Adding /v1 yourself produces /anthropic/v1/v1/messages and 404s.
This URL Is Not Universal
https://api.anthropic.com/v1 and appends /messages. That client needs /anthropic/v1. Use the Vercel AI SDK page for that knob.What this Gateway accepts
POST /openai/v1/chat/completions and GET /openai/v1/models, also under /agents/{agent_id}/v1 and /openai/agents/{agent_id}/v1 with the agent ID in the path. 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. For OpenAI-compatible clients that allow only one extra header, such as n8n, put the agent ID in the URL instead: https://gateway.traccia.ai/agents/<agent-id>/v1. If both are set, the header wins.
Client
import osfrom anthropic import Anthropic
client = Anthropic( api_key=os.environ["ANTHROPIC_API_KEY"], base_url="https://gateway.traccia.ai/anthropic", default_headers={ "X-Traccia-Api-Key": os.environ["TRACCIA_API_KEY"], "X-Traccia-Agent-Id": "billing-bot", },)
message = client.messages.create( model="claude-sonnet-4-5", max_tokens=256, messages=[{"role": "user", "content": "hello"}],)The request that must land is POST https://gateway.traccia.ai/anthropic/v1/messages.
What Works
client.messages.create(including streaming)
What 404s
Messages Only
/v1/complete path are not this Gateway.Next Steps
© 2026 Traccia.