prenzllmgateway

Chat Model node for n8n — use a private LLM gateway as the LLM behind an AI Agent or LLM Chain (with tool calling).

Package Information

Released: 4 mo ago
Downloads: 19 weekly / 62 monthly
Latest Version: 0.1.2
Author: prenz

Documentation

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 messages array (system / user / assistant / tool),
  • selects the assistant by persona id or name (which governs model + system prompt),
  • passes tools / tool_choice straight through and returns tool_calls — so the n8n Tools
    Agent works end-to-end.

Requirements

  • A gateway instance exposing /api/agent/messages and /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 Authorization header. 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 — -1 uses 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 npm

Then 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

  1. Add an AI Agent (or Basic LLM Chain) node.
  2. Click the Chat Model + → choose Prenz LLM Gateway Chat Model.
  3. Select/create the Prenz LLM Gateway API credential and pick a persona.
  4. (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/core is an optional peer dependency on purpose — n8n provides it, and a second
    copy would break LangChain's instanceof checks inside the Agent.

Discussion