n8n-nodes-prenzllmgateway
v0.1.2
Published
Chat Model node for n8n — use a private LLM gateway as the LLM behind an AI Agent or LLM Chain (with tool calling).
Maintainers
Readme
n8n-nodes-prenzllmgateway
A custom n8n community node that exposes a private LLM gateway as a Chat Model. It plugs into the AI Agent (Tools Agent) and Basic LLM Chain Chat Model slot, just like the built-in OpenAI / Anthropic chat-model nodes — including function/tool calling.
It talks to a backend endpoint, POST /api/agent/messages, which:
- takes a native OpenAI-style
messagesarray (system / user / assistant / tool), - selects the assistant by persona id or name (which governs model + system prompt),
- passes
tools/tool_choicestraight through and returnstool_calls— so the n8n Tools Agent works end-to-end.
Requirements
- A gateway instance exposing
/api/agent/messagesand/api/agent/assistants. - An API key (sent as
Authorization: Bearer <key>by default). - n8n with community nodes enabled. For use inside an AI Agent, also set
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true.
Credentials — "Prenz LLM Gateway API"
| Field | Default | Notes |
|---|---|---|
| Base URL | – (required) | Root URL of your gateway, no trailing slash |
| API Key | – | API key for the gateway |
| Auth Header Name | Authorization | Change if your gateway expects e.g. X-API-Key |
| Add "Bearer " Prefix | true | Standard Bearer-token auth |
The credential Test button uses the
Authorizationheader. The node's own requests honour a custom Auth Header Name if you set one.
Node properties
- Persona (Assistant) — dropdown loaded live from
/api/agent/assistants. Selects the assistant by id. Leave on Default LLM to use the instance default model with no persona. - Options → Timeout (ms) — request timeout (default 60000).
- Options → Temperature — only applied when using the default LLM provider.
- Options → Max Tokens —
-1uses the provider default.
Build & publish
npm install --ignore-scripts
npm run build # tsc + copies icon and codex metadata into dist/
npm pack --dry-run # inspect the exact files that will be published
npm publish --access public # publish to npmThen install in n8n via Settings → Community Nodes → Install → n8n-nodes-prenzllmgateway,
with N8N_COMMUNITY_PACKAGES_ENABLED=true and N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true.
Usage
- Add an AI Agent (or Basic LLM Chain) node.
- Click the Chat Model
+→ choose Prenz LLM Gateway Chat Model. - Select/create the Prenz LLM Gateway API credential and pick a persona.
- (Optional) connect tools to the agent — the node forwards them and handles
tool_calls.
Notes / limitations
- Tool calling depends on the underlying LLM provider/model actually emitting tool calls.
- No streaming in v1 (single JSON response). SSE can be added later via
_streamResponseChunks. - Token usage is not reported (the backend endpoint does not return usage in v1).
@langchain/coreis an optional peer dependency on purpose — n8n provides it, and a second copy would break LangChain'sinstanceofchecks inside the Agent.
