ENGINEERING
n8n + your own gateway: AI in every workflow, one endpoint
Why one endpoint matters more in automation than in chat
This isn't an announcement. It's the same gateway pattern applied to a place where it matters more than usual: workflows that touch customer data don't get a human in the loop deciding, per request, whether something sensitive should leave the building.
A developer using an AI coding assistant sees every prompt before it's sent. An n8n workflow doesn't — it fires on a schedule or a webhook, pulls a customer record or a support ticket or an invoice, and hands it to a model node without anyone reviewing that particular request as it happens. That makes the gateway question sharper, not optional: where does that workflow's outbound traffic actually terminate, and who's logging it?
- Data containment. Workflow traffic terminates at your gateway before going upstream — no automation quietly sending customer data straight to a vendor endpoint because nobody thought to check.
- Cost attribution per workflow or team. One credential per workflow, or per team's workspace, instead of a shared key buried in a credential everyone reuses without tracking it.
- Model swaps without touching every workflow. Change what's behind the gateway; every node using that credential picks it up automatically.
- An audit trail per automation. When something a workflow generated looks wrong, you can trace the exact request instead of guessing which of forty workflows made the call.
The one field that matters
n8n's OpenAI credential has a Base URL field alongside the API key. Point it at your gateway:
Base URL: https://gateway.your-company.com/v1
API Key: sk-your-gateway-key
Every node built on that credential — the Chat Model attached to an AI Agent node, the standalone OpenAI node, any LangChain-based node in n8n's AI category — routes through your gateway the moment it uses this credential. You don't touch the workflow logic at all; you're redirecting the credential, and every node referencing it inherits the change the next time it runs.
For anything n8n's OpenAI nodes don't cover — a model call inside custom logic, or a provider your gateway exposes that doesn't map to an OpenAI node cleanly — drop down to an HTTP Request node: POST to /v1/chat/completions with an Authorization: Bearer sk-your-gateway-key header and a standard OpenAI-shaped JSON body. Same gateway, same credential discipline, no dependency on a specific node type existing.
Why streaming isn't the problem here
Chat clients need SSE streaming or the interface sits frozen waiting for tokens to appear. Most n8n workflows don't have a UI waiting on partial output — a node runs, gets a complete response, and passes it to the next node in the chain. That simplifies what your gateway needs to handle for this traffic: no long-lived streaming connection to keep alive through the whole request, no buffering concern to chase down later. The gateway just needs to return a complete response before the node's timeout, which is usually a much easier bar to clear than keeping a chat UI fed token by token.
Verify it's working
Don't take the credential screen's word for it. Execute the workflow once — manually, from the n8n editor, with a real trigger payload — and check your gateway's request log for a matching entry: model, timestamp, and token count should line up with the node's input. If nothing shows up, the most common cause is a credential that got duplicated at some point and the node is still pointed at the old one; n8n doesn't warn you when a workflow references a stale credential, it just quietly keeps working against whatever endpoint that credential holds.
Gotchas we hit in production
- rpm/tpm limits per key matter more than in interactive use. A workflow triggered on every incoming webhook can fan out fast; a per-key rate limit protects the rest of the team's budget from one workflow's traffic spike.
- One credential per workflow or team, not one shared credential for the whole n8n instance. The audit trail is only as granular as your credential boundaries — a single shared key gives you one line item for everything.
- Node timeout, not proxy timeout, is usually the binding constraint. Set it generously for any node doing multi-step reasoning or working with long context, since n8n marks the node failed the moment it runs out before the gateway answers.
Try it on ours
Our gateway (iSol API) runs exactly this setup on sovereign infrastructure — US$ 99/month, 14-day trial.