Gateway: LlamaIndex

Platform

Point llama-index-llms-openai at Traccia with api_base and default_headers.

Use llama_index.llms.openai.OpenAI. Official constructor knobs are api_base and default_headers. LlamaIndex passes those through as the OpenAI SDK base_url. Set api_base to https://gateway.traccia.ai/openai/v1.

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 LLM

python
import os
from llama_index.llms.openai import OpenAI
llm = OpenAI(
model="gpt-4o-mini",
api_key=os.environ["OPENAI_API_KEY"],
api_base="https://gateway.traccia.ai/openai/v1",
default_headers={
"X-Traccia-Api-Key": os.environ["TRACCIA_API_KEY"],
"X-Traccia-Agent-Id": "billing-bot",
},
)
response = llm.complete("hello")

Do not put /chat/completions in api_base. The OpenAI client appends that path.

What 404s

OpenAIResponses Is Not This Gateway

LlamaIndex's OpenAIResponses class posts to the Responses API. This Gateway does not implement /v1/responses. Stay on the Chat Completions OpenAI class.

Next Steps

© 2026 Traccia.