Gateway: Anthropic SDK

Platform

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

Vercel AI SDK's Anthropic provider defaults to 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

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

HeaderValue
X-Traccia-Api-KeyWorkspace key from Settings → API Keys
X-Traccia-Agent-IdSame 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

python
import os
from 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

Batches, token counting, and the legacy /v1/complete path are not this Gateway.

Next Steps

© 2026 Traccia.