Gateway: n8n
Point the n8n OpenAI credential at the Gateway with the agent ID in the Base URL and one header for your Traccia key. No workflow change.
An n8n AI Agent or OpenAI node can send its model calls through the Gateway. Change the OpenAI credential, not the workflow: put the agent ID in the Base URL and add one header with your Traccia key. Spend Cap and Model Boundary then apply to every call, and each call is traced.
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.OpenAI Credential
The n8n OpenAI credential has a Base URL and a single custom header. The Gateway reads the agent ID from the Base URL, so that one header is enough.
- Open the OpenAI credential your OpenAI Chat Model node uses.
- Set Base URL to
https://gateway.traccia.ai/agents/<agent-id>/v1, with your agent ID and no trailing slash. - Turn on Add Custom Header.
- Header Name
X-Traccia-Api-Key, Header Value your Traccia API key. - Keep your OpenAI key in API Key. Save. n8n tests the connection against the Gateway.
API Key: $OPENAI_API_KEYBase URL: https://gateway.traccia.ai/agents/support-agent/v1Header Name: X-Traccia-Api-KeyHeader Value: $TRACCIA_API_KEYSame Agent ID As In Traccia
X-Traccia-Agent-Id, the header wins.HTTP Request Node
If you call the model from an HTTP Request node instead, use the standard route with both Traccia headers. Method POST, URL https://gateway.traccia.ai/openai/v1/chat/completions, JSON body.
Authorization: Bearer $OPENAI_API_KEYContent-Type: application/jsonX-Traccia-Api-Key: $TRACCIA_API_KEYX-Traccia-Agent-Id: support-agent{ "model": "gpt-4o-mini", "messages": [{ "role": "user", "content": "hello" }]}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.
What 404s Or Is Out Of Scope
- OpenAI node embeddings, Assistants, and images
- n8n Cloud "Use Gateway credits" (that is n8n's product, not Traccia)
- Tools and nested agent steps. The Gateway sees model calls only; use the SDK for those.
- OTLP observe (OTLP Ingestion) without changing the model URL. That traces. It does not enforce Spend Cap on the provider call.
Next Steps
© 2026 Traccia.