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

OpenAI: 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.

  1. Open the OpenAI credential your OpenAI Chat Model node uses.
  2. Set Base URL to https://gateway.traccia.ai/agents/<agent-id>/v1, with your agent ID and no trailing slash.
  3. Turn on Add Custom Header.
  4. Header Name X-Traccia-Api-Key, Header Value your Traccia API key.
  5. Keep your OpenAI key in API Key. Save. n8n tests the connection against the Gateway.
n8n OpenAI credential
bash
API Key: $OPENAI_API_KEY
Base URL: https://gateway.traccia.ai/agents/support-agent/v1
Header Name: X-Traccia-Api-Key
Header Value: $TRACCIA_API_KEY

Same Agent ID As In Traccia

The agent ID in the URL is the one your policies are scoped to, like the Agent ID you would pass to init. If you also send 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.

HTTP Request headers
bash
Authorization: Bearer $OPENAI_API_KEY
Content-Type: application/json
X-Traccia-Api-Key: $TRACCIA_API_KEY
X-Traccia-Agent-Id: support-agent
HTTP Request body
json
{
"model": "gpt-4o-mini",
"messages": [{ "role": "user", "content": "hello" }]
}

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