- Home
- Resources
- Integrations
- Ollama Chat Model
n8n Ollama Chat Model nodeConfigure Ollama Chat Model in n8n.
Ollama serves language models from your own machine, and the n8n Ollama Chat Model node is how a workflow talks to them. It carries 21 parameters and a single output port, with no main input of its own. Branch it onto an AI Agent or a chain, and the prompt never leaves your server.
Verified Trustpilot reviews · AI, automation & growth agency
What does the n8n Ollama Chat Model node actually do?
Ollama Chat Model is a sub-node, meaning a node you attach to another node rather than one that sits in the main flow. It has no main input and never runs on its own. A root node such as an AI Agent or a chain asks it for a completion, the node forwards that request to your Ollama instance, and the generated text comes back through the port. Everything you tune here, model choice and sampling, memory and GPU behavior, applies to that one call.
Three jobs come up again and again. First, a private chat assistant: a chain sends a question to a local model and returns the answer, with Sampling Temperature kept low so support replies stay predictable. Second, an agent that uses tools: an AI Agent reasons with the local model and calls out to Gmail or an HTTP tool, which is where Context Length starts to matter because tool results pile up in the context window, the span of text the model can see at once. Third, classification at volume: a batch of records goes through the node with Output Format set to json, so the next node parses fields instead of scraping prose.
When is another node the better call? Ollama means self-hosting the model, a GPU or a patient CPU, and a base URL that n8n can reach. If none of that is on the table, a hosted chat model node like OpenAI or Anthropic plugs into the same port with a key and nothing to operate. The provider then bills its own API calls under its own terms; n8n adds nothing either way. The trade you are making is operational work against data that stays on your hardware.
Two limits are worth knowing before you build. Expressions behave differently in a sub-node: {{ $json.name }} always resolves to the first item, even when five items arrive, so a per-item value cannot be piped into the model setting. And the node reads its address from the Ollama credentials, which is why Docker setups break so often until the host address is right. Our n8n review covers where the platform fits beyond AI work.
How do you point n8n at your Ollama instance?
- 01
Serve Ollama on an address n8n can reach
Ollama listens on port
11434. If it runs in Docker, bind it to0.0.0.0inside the container, which the official images already do, and publish the port with the-pflag:docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama. If Ollama runs straight on the host while n8n sits in a container, bind it to0.0.0.0on the host instead. - 02
Create the Ollama credentials in n8n
In the Credentials menu, add Ollama credentials and set the base URL. Same machine, no containers:
http://localhost:11434. n8n in Docker on Linux: start the container with--add-host host.docker.internal:host-gatewayand usehttp://host.docker.internal:11434; Docker Desktop wires that up for you. Two separate containers: use the Ollama container name, for examplehttp://my-ollama:11434. - 03
Add an API key for a remote instance
The node supports Bearer token authentication, a scheme where the key travels in the request header, for Ollama instances sitting behind an authenticated proxy such as Open WebUI. Set both the remote URL and the API key in the same Ollama credentials. One caveat from the docs: Ollama does not support custom HTTP agents, so a setup behind an HTTP or HTTPS proxy may not work at all, whatever the
HTTP_PROXYvariables say.
Where does this node plug in?
n8n splits AI work between a root node, which receives the workflow items, and sub-nodes attached to its ports, one type per port. Ollama Chat Model is one of those sub-nodes, so it has one connection to make and no main input.
Output (what it plugs into)
- Model
ai_languageModel
01Model
The node exposes a single output, the ai_languageModel port. Drag it onto the Model slot of a root node and the two run as one cluster: items enter the root node, the root node calls the model, the answer comes back.
Key parameters
- Required: a sub-node never executes alone, so an unconnected Ollama Chat Model does nothing at all.
- Basic LLM Chain: prompt in, answer out, nothing else to wire.
- AI Agent: the root node to pick when the assistant calls tools and keeps a memory.
- Question and Answer Chain: questions answered from your own documents, while Text Classifier and Summarization Chain cover sorting and condensing.
Which parameter do you touch, and when?
The Ollama Chat Model node has 21 parameters. For each one: the node as you configure it in n8n, what the parameter changes, and our field notes.
Parameters index
- Model
- Enable Thinking
- Sampling Temperature
- Top K
- Top P
- Frequency Penalty
- Keep Alive
- Low VRAM Mode
- Main GPU ID
- Context Batch Size
- Context Length
- Number of GPUs
- Max Tokens to Generate
- Number of CPU Threads
- Penalize Newlines
- Presence Penalty
- Repetition Penalty
- Use Memory Locking
- Use Memory Mapping
- Load Vocabulary Only
- Output Format
Model
modelWhat you see in n8n
Notes & use cases
This dropdown names the model that generates the completion. It is the one setting you always fill, and it has to match a model you have already pulled onto the Ollama machine; the Ollama Models Library lists what is available to download.
Key parameters
- Model: required. The official node documentation lists Llama2, Llama2 13B, Llama2 70B and Llama2 Uncensored among the choices.
Enable Thinking
options.thinkWhat you see in n8n
Notes & use cases
Some models reason step by step before answering. With thinking mode on, which is the default, that reasoning is kept separate from the output. Turn it off and the model writes content directly. It only changes anything on models that support the feature.
Key parameters
- Enable Thinking: a toggle, on by default, that separates the model thinking process from what the workflow receives.
Sampling Temperature
options.temperatureWhat you see in n8n
Notes & use cases
Randomness in the generated text is what this number controls. Lower values make output more focused and deterministic. Higher values make it more diverse and random, which also raises the risk of the model inventing things.
Key parameters
- Sampling Temperature: a number; low for repeatable answers, high for varied ones.
Top K
options.topKWhat you see in n8n
Notes & use cases
At every step the model ranks candidate tokens, the word fragments it builds text from. Top K caps how many of the highest probability ones stay in the running. A higher value increases diversity but may reduce coherence. Set it to -1 to disable the cap entirely.
Key parameters
- Top K: a number limiting the highest probability vocabulary tokens considered at each step.
Top P
options.topPWhat you see in n8n
Notes & use cases
Rather than counting tokens, this one works on cumulative probability: the model picks from the smallest set of tokens whose combined probability passes the threshold. The documented effect is more human-like text with fewer repetitions.
Key parameters
- Top P: a number; a lower value ignores the less probable options.
Frequency Penalty
options.frequencyPenaltyWhat you see in n8n
Notes & use cases
Tokens that already appeared in the generated text get penalized, and this value sets how hard. Higher values discourage repetition. It scales with how often something has been said, so the more a phrase recurs, the stronger the push away from it.
Key parameters
- Frequency Penalty: a number adjusting the penalty for tokens already present in the output.
Keep Alive
options.keepAliveWhat you see in n8n
Notes & use cases
After a generation finishes, Ollama can hold the model in memory instead of unloading it. This field says for how long, written as a duration such as 1h30m for one hour and thirty minutes. Useful for models a workflow hits often.
Key parameters
- Keep Alive: a string duration in the
1h30mformat, controlling how long the loaded model stays in memory after use.
Low VRAM Mode
options.lowVramWhat you see in n8n
Notes & use cases
Tight on graphics memory? This switch reduces memory usage at the cost of slower generation. It is meant for GPUs with limited memory, and it is a real trade rather than a free optimization.
Key parameters
- Low VRAM Mode: a toggle that trades generation speed for lower memory usage.
Main GPU ID
options.mainGpuWhat you see in n8n
Notes & use cases
Machines with several graphics cards need to know which one carries the main computation. This field takes that GPU identifier. On a single-GPU box there is nothing to decide here, and the documentation says to change it only when you have multiple GPUs.
Key parameters
- Main GPU ID: a number naming the GPU used for the main computation.
Context Batch Size
options.numBatchWhat you see in n8n
Notes & use cases
Prompt processing happens in batches, and this sets their size. Larger batches may improve generation speed, but they increase memory usage. It is the throughput lever that has nothing to do with output quality.
Key parameters
- Context Batch Size: a number setting the batch size used for prompt processing.
Context Length
options.numCtxWhat you see in n8n
Notes & use cases
The context window is how much text the model keeps in view while generating the next token. This number caps it. Smaller values reduce memory usage; larger values give the model more to work with.
Key parameters
- Context Length: the maximum number of tokens used as context for generating the next token.
Number of GPUs
options.numGpuWhat you see in n8n
Notes & use cases
Parallel processing across cards is set here: the value is how many GPUs Ollama should use. Leave it at -1 and it auto-detects what the machine has, which is the sane default on a box you control.
Key parameters
- Number of GPUs: a number;
-1means auto-detection.
Max Tokens to Generate
options.numPredictWhat you see in n8n
Notes & use cases
Output length gets its ceiling from this field. Set it to -1 for no limit, though the documentation warns against large values, because they can lead to very long outputs and the run time that comes with them.
Key parameters
- Max Tokens to Generate: the maximum number of tokens produced;
-1removes the limit.
Number of CPU Threads
options.numThreadWhat you see in n8n
Notes & use cases
Processing on the CPU uses as many threads as this value allows, and 0 hands the count back to Ollama, which detects it. Worth touching when the machine does more than serve models.
Key parameters
- Number of CPU Threads: a number;
0triggers auto-detection.
Penalize Newlines
options.penalizeNewlineWhat you see in n8n
Notes & use cases
Line breaks are tokens too. Switch this on and the model becomes less likely to generate them, which encourages longer continuous sequences of text instead of short chopped-up lines.
Key parameters
- Penalize Newlines: a toggle making newline characters less likely in the output.
Presence Penalty
options.presencePenaltyWhat you see in n8n
Notes & use cases
Presence, not frequency, is the criterion here: tokens are penalized simply for having shown up in the text so far. Positive values push the model toward new material, encouraging diversity.
Key parameters
- Presence Penalty: a number; positive values penalize tokens that have already appeared.
Repetition Penalty
options.repeatPenaltyWhat you see in n8n
Notes & use cases
A model stuck in a loop, repeating the same clause over and over, is what this factor is for. Higher values discourage repetition more strongly. Set it to 1.0 and the repetition penalty is off.
Key parameters
- Repetition Penalty: a number adjusting the penalty factor for repeated tokens;
1.0disables it.
Use Memory Locking
options.useMLockWhat you see in n8n
Notes & use cases
Swapping, when the system moves memory pages to disk, slows a model down badly. Locking it in memory prevents that and can improve performance, but it requires enough free memory to hold the whole model.
Key parameters
- Use Memory Locking: a toggle that pins the model in memory to prevent swapping.
Use Memory Mapping
options.useMMapWhat you see in n8n
Notes & use cases
Loading the model file through memory mapping can reduce memory usage, though it may impact performance. The documentation recommends keeping it enabled, so this is a setting you disable deliberately rather than by default.
Key parameters
- Use Memory Mapping: a toggle for memory-mapped model loading, recommended on.
Load Vocabulary Only
options.vocabOnlyWhat you see in n8n
Notes & use cases
Only the model vocabulary gets loaded, without the weights. There is no real generation behind it, which is exactly the point: it makes tokenization quick to test.
Key parameters
- Load Vocabulary Only: a toggle that loads the vocabulary and skips the weights.
Output Format
options.formatWhat you see in n8n
Notes & use cases
Downstream nodes rarely want prose. This selector sets the format of the API response, so the answer arrives in a shape the rest of the workflow can handle.
Key parameters
- Output Format: two choices,
default(Default) andjson(JSON).
json so the next node reads a field directly, instead of a downstream step having to pull values out of a sentence.Need help automating Ollama Chat Model with n8n?
A person reads every message.
Questions people ask next
01Is the n8n Ollama Chat Model node included in n8n?
02What do you need for the Ollama Chat Model node to work?
03What are the limits of this node?
04What do you connect at minimum, and which node to start with?
05n8n or Make for running a local model?
Get our weekly integration tips.
No spam. Unsubscribe anytime.

