Gateway: LiteLLM

Platform

Route LiteLLM completion() through Traccia with api_base and extra_headers. Prefix openai/ or anthropic/.

LiteLLM's knobs are api_base (alias base_url) and extra_headers (or headers). The model prefix chooses the provider path. Do not append /chat/completions or /v1/messages to the base. LiteLLM adds those.

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-Compatible

Prefix the model with openai/ so LiteLLM uses the OpenAI client Chat Completions path. Include /v1 on api_base. LiteLLM's own docs say a missing /v1 is a common 404. The value is https://gateway.traccia.ai/openai/v1.

python
import os
from litellm import completion
response = completion(
model="openai/gpt-4o-mini",
api_key=os.environ["OPENAI_API_KEY"],
api_base="https://gateway.traccia.ai/openai/v1",
extra_headers={
"X-Traccia-Api-Key": os.environ["TRACCIA_API_KEY"],
"X-Traccia-Agent-Id": "billing-bot",
},
messages=[{"role": "user", "content": "hello"}],
)

Anthropic

Prefix the model with anthropic/. LiteLLM appends /v1/messages to a custom Anthropic base unless LITELLM_ANTHROPIC_DISABLE_URL_SUFFIX=true. Leave that unset. Set api_base to https://gateway.traccia.ai/anthropic with no /v1.

python
import os
from litellm import completion
response = completion(
model="anthropic/claude-sonnet-4-5",
api_key=os.environ["ANTHROPIC_API_KEY"],
api_base="https://gateway.traccia.ai/anthropic",
extra_headers={
"X-Traccia-Api-Key": os.environ["TRACCIA_API_KEY"],
"X-Traccia-Agent-Id": "billing-bot",
},
messages=[{"role": "user", "content": "hello"}],
)

Do Not Double /v1

If api_base is https://gateway.traccia.ai/anthropic/v1 and the suffix is still on, LiteLLM posts to /anthropic/v1/v1/messages.

Not Documented Here

Gemini through LiteLLM is not verified against /google/v1beta/models/.... Use the Gemini SDK page. LiteLLM embeddings and Responses-style routes are not this Gateway.

Next Steps

© 2026 Traccia.