- Home
- Resources
- Integrations
- Ollama Model
n8n Ollama Model nodeConfigure Ollama Model in n8n.
The n8n Ollama Model node is how a workflow talks to a language model running on your own machine. It is a sub-node, meaning it has no main input and never runs on its own, so you attach it to the Model port of a root node. One picker, 21 parameters, and the text never leaves your network.
Verified Trustpilot reviews · AI, automation & growth agency
What does the n8n Ollama Model node actually do?
The node hands a prompt to an Ollama instance you host and returns the completion to whichever root node asked for it. It does not sit in the main flow of a workflow. In n8n's AI nodes, a root node receives the workflow items and sub-nodes attach to its ports, one type of sub-node per port. This one occupies the ai_languageModel port, and it stays idle until a root node calls it.
The first scenario is the private assistant. A Basic LLM Chain takes a question, the Ollama Model node answers it with a model you pulled onto your own server, and the reply goes back into the workflow. Nothing is sent to a hosted provider, which is the whole point when the prompt carries customer data or an internal document. Post the answer to Slack and the loop is closed.
The second one is verification. A dedicated checking model reads a claim and the source text, and says whether the claim holds. Two Ollama Model nodes can sit in the same workflow on two different chains, each with its own value in Model, one generating and one checking. Sampling Temperature low on the checker keeps its verdict stable.
The third is on-premises retrieval. Documents get split, embedded and stored in a vector store, and a summarization chain or a question-answer chain uses this node to write the final answer from the retrieved passages. Feed the pipeline from Google Sheets or an inbox and the whole chain, from source to answer, runs behind your own firewall.
When should you pick something else? The official node documentation is explicit: this node lacks tools support, so it will not work with the AI Agent node, and you should connect it to a Basic LLM Chain instead. An agent that has to call tools, or an AI Agent Tool nested inside another agent, needs a chat model that supports them, which is where the OpenAI or Anthropic nodes come in. Those providers bill their own API calls; n8n adds nothing on top.
Two limits are worth knowing before you build. Expressions behave differently in a sub-node: where a normal node resolves {{ $json.field }} once per item, here the expression always resolves to the first item, so a list of five prompts will not fan out from this node. And Ollama does not support custom HTTP agents in its configuration, which makes it awkward to run behind a custom proxy even with the usual environment variables set. Both are quirks of the sub-node model rather than bugs, and both are easier to design around than to debug later.
What do you need to connect it?
- 01
Run Ollama and pull a model
Ollama has to be reachable from n8n before the node shows anything useful. Install it on the host or start the official container, publishing the port:
docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama. Port11434is the default Ollama listens on. Then download at least one model from the Ollama Models Library, because the Model picker in the node offers what your instance can serve. - 02
Create the Ollama credential in n8n
Open the Credentials menu in n8n and add an Ollama credential. The important field is the base URL, the address n8n calls:
http://localhost:11434when both pieces sit on the same machine. If your Ollama instance is remote and sits behind an authenticated proxy such as Open WebUI, the node supports Bearer token authentication, so fill in both the remote URL and the API key. The credential is created once and reused across every workflow. - 03
Attach the node to a root node
Add the Ollama Model node to the canvas and drag its connector onto the Model port of a root node, a Basic LLM Chain to start with. A port is simply the labelled socket under a root node where one type of sub-node plugs in. Select your credential and pick a value in Model. Leave everything else alone on the first run; the node has no main input, so no wire comes into it from the left.
Where does this sub-node plug in?
n8n's AI nodes work as a cluster: one root node holds the logic and receives the workflow items, and sub-nodes like this one extend it through its ports. A sub-node never executes on its own, so the only question that matters is which socket it belongs in.
Output (what it plugs into)
- Model
ai_languageModel
01Model
This node exposes a single output of type ai_languageModel, and it goes on the Model port of a root node. That connection is what makes the node run at all.
Key parameters
- Required : the node has no main input and never executes alone, so an unconnected Ollama Model node is dead weight on the canvas.
- Basic LLM Chain and Question and Answer Chain are the two easiest root nodes to start with, since both take a prompt and return text.
- Summarization Chain and Information Extractor accept the same port when the job is condensing a document or pulling fields out of it.
What can you tune on the n8n Ollama Model node?
The Ollama 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
Nothing runs until this dropdown has a value. It names the model that will generate the completion, and the choice decides everything downstream: quality, speed, and how much memory the machine gives up while the model is loaded.
Key parameters
- Model : the model which will generate the completion. The official node documentation lists Llama2, Llama2 13B, Llama2 70B and Llama2 Uncensored; to download models, visit the Ollama Models Library.
Enable Thinking
options.thinkWhat you see in n8n
Notes & use cases
Reasoning models keep a scratchpad before they answer. This switch decides whether that scratchpad stays separate from the result, and it only means anything on models that support the mode.
Key parameters
- Enable Thinking : whether to enable (default) thinking mode for supported models. Enabled, the model's thinking process is separated from the output; disabled, the model outputs content directly.
Sampling Temperature
options.temperatureWhat you see in n8n
Notes & use cases
Randomness has a dial, and this is it. The same prompt run twice can come back worded differently, and how far apart those two answers land is exactly what this number controls.
Key parameters
- Sampling Temperature : controls the randomness of the generated text. Lower values make the output more focused and deterministic, while higher values make it more diverse and random.
Top K
options.topKWhat you see in n8n
Notes & use cases
At each step the model ranks its whole vocabulary, then picks from the top of that ranking. A token is a fragment of text, roughly a word or part of one. This option sets how deep into the ranking the sampler is allowed to look.
Key parameters
- Top K : limits the number of highest probability vocabulary tokens to consider at each step. A higher value increases diversity but may reduce coherence. Set to
-1to disable.
Top P
options.topPWhat you see in n8n
Notes & use cases
Instead of counting candidates, this one counts probability. It keeps adding tokens to the pool until their combined probability crosses the threshold you set, then stops.
Key parameters
- Top P : chooses from the smallest possible set of tokens whose cumulative probability exceeds the probability top_p. Helps generate more human-like text by reducing repetitions.
Frequency Penalty
options.frequencyPenaltyWhat you see in n8n
Notes & use cases
Repetition creeps in when the same token keeps winning the ranking. This penalty leans against tokens in proportion to how often they have already been used in the answer being written.
Key parameters
- Frequency Penalty : adjusts the penalty for tokens that have already appeared in the generated text. Higher values discourage repetition.
Keep Alive
options.keepAliveWhat you see in n8n
Notes & use cases
Loading a local model into memory costs real seconds. This field says how long Ollama should hold it there once the call is done, so the next run starts warm instead of paying that cost again.
Key parameters
- Keep Alive : specifies the duration to keep the loaded model in memory after use. Useful for frequently used models. Format:
1h30mfor one hour and thirty minutes.
Low VRAM Mode
options.lowVramWhat you see in n8n
Notes & use cases
Small graphics cards choke on large models. Switching this on trades speed for room, which is often the difference between a chain that runs and one that fails on the machine you actually have.
Key parameters
- Low VRAM Mode : whether to activate low VRAM mode, which reduces memory usage at the cost of slower generation speed. Useful for GPUs with limited memory.
Main GPU ID
options.mainGpuWhat you see in n8n
Notes & use cases
A machine with several graphics cards has to be told which one leads the computation. Left alone, this field is a non-event; on a multi-card server it decides where the load lands.
Key parameters
- Main GPU ID : specifies the ID of the GPU to use for the main computation. Only change this if you have multiple GPUs.
Context Batch Size
options.numBatchWhat you see in n8n
Notes & use cases
Before generating anything, the model has to read the prompt, and it reads it in batches. Widening the batch moves that reading phase along faster, at a cost you pay in memory.
Key parameters
- Context Batch Size : sets the batch size for prompt processing. Larger batch sizes may improve generation speed but increase memory usage.
Context Length
options.numCtxWhat you see in n8n
Notes & use cases
Context is a budget. Everything the model is allowed to look at while writing the next token, the prompt and what it has produced so far, has to fit inside this number.
Key parameters
- Context Length : the maximum number of tokens to use as context for generating the next token. Smaller values reduce memory usage, while larger values provide more context to the model.
Number of GPUs
options.numGpuWhat you see in n8n
Notes & use cases
Spreading the work over several cards is something you ask for explicitly here. The field counts the cards, where Main GPU ID names the one in charge.
Key parameters
- Number of GPUs : specifies the number of GPUs to use for parallel processing. Set to
-1for auto-detection.
Max Tokens to Generate
options.numPredictWhat you see in n8n
Notes & use cases
Answers can run away. This ceiling stops the model mid-flight, which protects both the execution time of the workflow and whatever node is waiting downstream for a field of reasonable size.
Key parameters
- Max Tokens to Generate : the maximum number of tokens to generate. Set to
-1for no limit. Be cautious with a large value, as it can lead to very long outputs.
Number of CPU Threads
options.numThreadWhat you see in n8n
Notes & use cases
Part of the work always lands on the processor, and on a machine without a usable graphics card all of it does. This field decides how many threads Ollama is allowed to claim.
Key parameters
- Number of CPU Threads : specifies the number of CPU threads to use for processing. Set to
0for auto-detection.
Penalize Newlines
options.penalizeNewlineWhat you see in n8n
Notes & use cases
Line breaks are tokens too, and a model that reaches for them often produces answers chopped into fragments. This switch pushes it the other way.
Key parameters
- Penalize Newlines : whether the model will be less likely to generate newline characters, encouraging longer continuous sequences of text.
Presence Penalty
options.presencePenaltyWhat you see in n8n
Notes & use cases
Presence and frequency sound alike but count differently. This one cares only that a token has shown up at all, not how many times, and it nudges the model toward vocabulary it has not touched yet.
Key parameters
- Presence Penalty : adjusts the penalty for tokens based on their presence in the generated text so far. Positive values penalize tokens that have already appeared, encouraging diversity.
Repetition Penalty
options.repeatPenaltyWhat you see in n8n
Notes & use cases
A third repetition control sits beside the other two, and this is the blunt one: a single factor applied to tokens that come back around.
Key parameters
- Repetition Penalty : adjusts the penalty factor for repeated tokens. Higher values more strongly discourage repetition. Set to
1.0to disable repetition penalty.
Use Memory Locking
options.useMLockWhat you see in n8n
Notes & use cases
An operating system under pressure will swap a loaded model out to disk, and the next call crawls. Locking pins it in place so that cannot happen.
Key parameters
- Use Memory Locking : whether to lock the model in memory to prevent swapping. This can improve performance but requires sufficient available memory.
Use Memory Mapping
options.useMMapWhat you see in n8n
Notes & use cases
How the weights get read off disk is itself a choice. Memory mapping lets the system page them in as needed instead of pulling everything into RAM first.
Key parameters
- Use Memory Mapping : whether to use memory mapping for loading the model. This can reduce memory usage but may impact performance. Recommended to keep enabled.
Load Vocabulary Only
options.vocabOnlyWhat you see in n8n
Notes & use cases
Sometimes the weights are beside the point. Loading only the vocabulary skips them entirely, which is fast and produces no real completion.
Key parameters
- Load Vocabulary Only : whether to only load the model vocabulary without the weights. Useful for quickly testing tokenization.
Output Format
options.formatWhat you see in n8n
Notes & use cases
The shape of the API response is selectable, which matters when the next node expects structured data rather than prose it has to parse.
Key parameters
- Output Format : specifies the format of the API response, either
default(Default) orjson(JSON).
json when an information extraction chain feeds its result into a node that writes named fields, and keep default for anything a human will read.Need help automating Ollama Model with n8n?
A person reads every message.
Questions about the Ollama Model node
01Is the n8n Ollama Model node included with n8n?
02What credentials does it need?
03What are the limits of this node?
04What should you connect it to, and where do you start?
05n8n or Make for a local model?
Get our weekly integration tips.
No spam. Unsubscribe anytime.