TECHNOLOGY

n8n with a local LLM: a bounded chat-model workflow

In this article
THE QUICK TAKE

n8n separates Ollama credentials, the model sub-node, and root-node input mapping; an AI Agent additionally requires a tool.

In n8n, the Ollama credential identifies the running model service, while the Ollama Chat Model sub-node supplies generation to a compatible root node. Connecting the model is only one part of a working chat workflow.

The concrete application boundary

A workflow has data movement as well as inference. The credential stores the instance Base URL and, only when required, an authentication key. The chat model sub-node selects a model already available in that runtime. A root node determines what input becomes the prompt and what output continues through the workflow. If you choose an AI Agent, current documentation requires at least one connected tool; an agent is unnecessary for a simple rewrite. Prefer a basic text chain for the first no-tool task. This keeps the exercise focused on input mapping and a local response rather than introducing actions that the user never needed (n8n Ollama Chat Model).

A practical route

Create an Ollama credential in the existing local n8n instance and enter the actual service Base URL. The documented default is http://localhost:11434 for a matching local arrangement; use the real address if different. Leave the optional API Key empty when the service does not require authentication. Add an Ollama Chat Model sub-node to a compatible text-chain root and select the installed model. Map a single sample input into the root’s prompt and run the workflow manually before adding triggers or destination systems (n8n Ollama credentials).

A worked example

Supply a fictional support note and ask for a short reply that states what information is missing. Inspect the root’s input, the model selection, and the resulting text. Then replace the sample note and repeat. If the answer still concerns the previous note, inspect the mapped expression rather than treating the local model as unable to follow instructions.

CheckRecord
CredentialThe actual Ollama instance URL and whether authentication is required.
Root inputThe sample note value mapped into the text-chain prompt.
ModelThe exact runtime model selected by the connected chat model sub-node.

Reading the failure correctly

Sub-node expressions have a documented first-item behavior, unlike ordinary item-by-item node expression resolution. A multi-item workflow can therefore produce surprising selections if you assume all sub-node expressions iterate identically. Begin with one input item and inspect mapping before expanding. A missing tool on an AI Agent is another structural issue, not a generic model connection failure (n8n AI Agent).

What completes the check

The first workflow is complete when one visible input produces one inspectable response through the intended local model. Keep scheduling and external writes outside this initial trial so that data mapping remains easy to explain.

Related background: A local RAG server: placing components around the GPU, llama.cpp server: a local API from a GGUF model.

← All articles