Package Information
Documentation
n8n-nodes-kong-ai-gateway
An n8n community node package that integrates Kong AI Gateway into your n8n workflows.
It uses the OpenAI-compatible endpoints exposed by Kong's AI Proxy plugin, allowing you to route requests to any LLM provider (OpenAI, Azure OpenAI, Anthropic, Cohere, Mistral, Llama, and others) through a single, centrally managed gateway.
Nodes
This package exposes three nodes:
- Kong AI Gateway – Chat Model — LangChain-compatible chat model for use inside n8n AI Agent workflows
- Kong AI Gateway – Chat — Standard chat node for direct, non-agent LLM calls
- Kong AI Gateway – Embeddings — Embeddings node for vector generation workflows
Installation
In your n8n instance, go to Settings > Community Nodes and install:
n8n-nodes-kong-ai-gateway
Or via npm:
npm install n8n-nodes-kong-ai-gateway
Credential Setup
All three nodes share the same credential type: Kong AI Gateway API.
- In n8n, go to Credentials > New Credential
- Search for Kong AI Gateway API
- Fill in the fields:
| Field | Description |
|---|---|
| Base URL | The base URL of your Kong Gateway (e.g. https://kong.example.com) |
| API Key Header Name | The HTTP header used for authentication. Defaults to Authorization. If you use Kong's Key Auth plugin, set this to apikey. |
| API Key Header Value | The value for the header (e.g. Bearer sk-xxx for Authorization, or your raw API key for Key Auth) |
- Click Test to verify the connection.
Kong-Side Setup
Each node requires a Kong route configured with the AI Proxy plugin.
Example declarative configuration (YAML):
_format_version: "3.0"
services:
- name: ai-gateway
url: https://api.openai.com
routes:
- name: chat-route
paths:
- /llm/chat
strip_path: true
plugins:
- name: ai-proxy
config:
route_type: llm/v1/chat
auth:
header_name: Authorization
header_value: "Bearer <YOUR_OPENAI_API_KEY>"
model:
provider: openai
name: gpt-4o
For embeddings, set route_type: llm/v1/embeddings on the corresponding route.
Refer to the Kong AI Gateway documentation for full configuration options, including rate limiting, request transformation, logging, and multi-provider routing.
Node Reference
Kong AI Gateway – Chat Model
A LangChain-compatible chat model designed for use inside the n8n AI Agent node. Connects to Kong's Chat Completions API or Responses API and supports tool calling.
| Parameter | Default | Description |
|---|---|---|
| Output Format | Completion |
Completion uses the Chat Completions API (messages format). Responses uses the Responses API (input format). |
| Route Path | /llm/chat |
Kong route path for the Chat Completions API. Shown when Output Format is Completion. |
| Responses Route Path | /responses |
Kong route path for the Responses API. Shown when Output Format is Responses. |
| Model (Optional) | (empty) | Model name to include in the request (e.g. gpt-4o). Leave empty if Kong selects the model automatically via the AI Proxy plugin. |
| Max Tokens | 1024 |
Maximum number of tokens to generate. |
| Temperature | 1 |
Sampling temperature (0–2). |
| Max History Messages | 12 |
Maximum number of messages to retain in conversation history before sending to Kong. The system prompt is always preserved and never counted. History trimming happens client-side inside the node — older messages are dropped to prevent Kong from rejecting long multi-turn conversations. Set to 0 to disable trimming. |
Notes:
- Tool calling is supported in
Completionmode only. - In
Completionmode, the node correctly handles tool call pairs (assistant + tool result messages) during history trimming — incomplete pairs are never sent to the API.
Kong AI Gateway – Chat
A standard chat node for direct LLM calls, without the AI Agent context.
| Parameter | Default | Description |
|---|---|---|
| Output Format | Completion |
Completion returns the full Chat Completions response. Responses returns the Responses API format. |
| Route Path | /llm/chat |
Kong route path for the Chat Completions endpoint. |
| Model (Optional) | (empty) | Model name to include in the request. Leave empty if Kong manages model selection. |
| Max Tokens | 4096 |
Maximum number of tokens to generate. |
| Temperature | 1 |
Sampling temperature (0–2). |
| Max History Messages | 30 |
Maximum number of messages to retain in conversation history. Same trimming logic as the Chat Model node. |
Kong AI Gateway – Embeddings
Generates vector embeddings via Kong's embeddings endpoint.
| Parameter | Default | Description |
|---|---|---|
| Route Path | /llm/embeddings |
Kong route path for the embeddings endpoint. |
| Model (Optional) | (empty) | Model name to include in the request. Leave empty if Kong manages model selection. |
| Dimensions | 512 |
Number of dimensions for the output embedding vectors. |
| Batch Size | 512 |
Number of inputs to process per request. |
Known Limitations
- No streaming support — Nodes wait for the complete response before returning. SSE streaming is not supported.
- No function/tool calling in Chat node — Tool use is only available in the Chat Model node when used inside an AI Agent.
- Responses API does not support tool messages — Tool calling is only available in
Completionmode.
Development
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run dev
# Lint
npm run lint