Gateway: HTTP

Platform

Call the Gateway with cURL or any HTTP client. Use the full path the Gateway implements, plus both Traccia headers.

If a platform can set a URL and two extra headers, it can use the Gateway. Post to the full path. Do not stop at the client base URL. Keep the provider API key in the provider's own auth header.

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.

OpenAI Chat Completions

bash
curl -sS https://gateway.traccia.ai/openai/v1/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Traccia-Api-Key: $TRACCIA_API_KEY" \
-H "X-Traccia-Agent-Id: billing-bot" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "hello"}]
}'

Anthropic Messages

bash
curl -sS https://gateway.traccia.ai/anthropic/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-H "X-Traccia-Api-Key: $TRACCIA_API_KEY" \
-H "X-Traccia-Agent-Id: billing-bot" \
-d '{
"model": "claude-sonnet-4-5",
"max_tokens": 256,
"messages": [{"role": "user", "content": "hello"}]
}'

Gemini Generate Content

bash
curl -sS "https://gateway.traccia.ai/google/v1beta/models/gemini-2.5-flash:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Traccia-Api-Key: $TRACCIA_API_KEY" \
-H "X-Traccia-Agent-Id: billing-bot" \
-d '{
"contents": [{"parts": [{"text": "hello"}]}]
}'

Streaming

OpenAI stream: true and Gemini :streamGenerateContent are implemented. Anthropic streaming on /v1/messages is the same route with stream: true.

Next Steps

© 2026 Traccia.