Resources · n8n integration

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

Why automate

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.

Connect

How do you point n8n at your Ollama instance?

  1. 01

    Serve Ollama on an address n8n can reach

    Ollama listens on port 11434. If it runs in Docker, bind it to 0.0.0.0 inside the container, which the official images already do, and publish the port with the -p flag: 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 to 0.0.0.0 on the host instead.

  2. 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-gateway and use http://host.docker.internal:11434; Docker Desktop wires that up for you. Two separate containers: use the Ollama container name, for example http://my-ollama:11434.

  3. 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_PROXY variables say.

Connections

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)

  • Modelai_languageModel
01ModelThe 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.

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.
Use cases
a support workflow starts on a Basic LLM Chain, then swaps that root node for an AI Agent Tool once the assistant needs to act.
Parameters

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.

01

Model

model

What 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.
Use cases
a first local assistant starts on a small model to check the plumbing, then moves up a size once the answers are the weak point rather than the wiring.
02

Enable Thinking

options.think

What 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.
Use cases
a node that feeds a Slack message wants the answer alone, so leaving thinking enabled keeps the reasoning out of the text people read.
03

Sampling Temperature

options.temperature

What 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.
Use cases
two nodes, two settings. The one that rewrites a product blurb for Google Sheets can run warm, while the one deciding a ticket category runs cold so the same input keeps landing in the same bucket.
04

Top K

options.topK

What 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.
Use cases
answers that drift off topic halfway through often tighten up when this comes down, before anyone touches the prompt.
05

Top P

options.topP

What 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.
Use cases
for a chat assistant that sounds stiff and repeats phrasings, adjusting here usually beats raising temperature, because the wording loosens without the facts wandering.
06

Frequency Penalty

options.frequencyPenalty

What 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.
Use cases
long summaries that keep circling back to the same sentence usually calm down once this is nudged up.
07

Keep Alive

options.keepAlive

What 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 1h30m format, controlling how long the loaded model stays in memory after use.
Use cases
a workflow triggered every few minutes pays the model loading cost on every run unless this window covers the gap between executions.
08

Low VRAM Mode

options.lowVram

What 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.
Use cases
a model that refuses to load on a modest consumer GPU may come up with this on, which is worth trying before dropping to a smaller model.
09

Main GPU ID

options.mainGpu

What 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.
Use cases
a shared server where one card is already busy with another service, so the n8n workflow is pointed at the free one.
10

Context Batch Size

options.numBatch

What 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.
Use cases
a nightly run that pushes long documents through the model can be sped up here, as long as the machine has memory headroom to spare.
11

Context Length

options.numCtx

What 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.
Use cases
an agent conversation that suddenly forgets what was said earlier is often hitting this ceiling, since chat history and tool results share the same budget.
12

Number of GPUs

options.numGpu

What 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; -1 means auto-detection.
Use cases
a multi-card server shared with other jobs, where the workflow is capped to a subset instead of grabbing everything available.
13

Max Tokens to Generate

options.numPredict

What 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; -1 removes the limit.
Use cases
a node that writes a short summary into a database column is capped here, so no single item can produce a wall of text downstream.
14

Number of CPU Threads

options.numThread

What 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; 0 triggers auto-detection.
Use cases
n8n and Ollama on the same server, where capping threads keeps the generation from starving the workflow engine during long runs.
15

Penalize Newlines

options.penalizeNewline

What 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.
Use cases
a node producing a paragraph for an email body, where a bullet-riddled answer would need cleaning up before it can be sent.
16

Presence Penalty

options.presencePenalty

What 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.
Use cases
brainstorming a list of angles for a campaign, where the model otherwise keeps returning variations on its first idea.
17

Repetition Penalty

options.repeatPenalty

What 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.0 disables it.
Use cases
a smaller local model that degrades into loops on long generations, where raising this is faster than swapping the model out.
18

Use Memory Locking

options.useMLock

What 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 cases
a dedicated model server with memory to spare, where response times matter more than leaving room for other processes.
19

Use Memory Mapping

options.useMMap

What 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.
Use cases
a constrained host running several models, where the memory saved at load time is what lets them coexist at all.
20

Load Vocabulary Only

options.vocabOnly

What 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.
Use cases
checking how a model splits your text before committing a long batch job to it, without waiting on a full model load.
21

Output Format

options.format

What 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) and json (JSON).
Use cases
a classification workflow switches to json so the next node reads a field directly, instead of a downstream step having to pull values out of a sentence.
Need help

Need help automating Ollama Chat Model with n8n?

A person reads every message.

FAQ

Questions people ask next

01Is the n8n Ollama Chat Model node included in n8n?
Yes. It ships in the n8n AI package, @n8n/n8n-nodes-langchain, which comes with n8n itself. There is nothing to install and no extra cost on the n8n side, on n8n Cloud as well as on a self-hosted instance under the Community Edition and its Sustainable Use license. Because the models run on your own Ollama server, there is no model provider billing your API calls either. What you pay instead is hardware and operations: a machine with enough memory, a GPU or the patience to run on CPU, and a base URL that n8n can reach.
02What do you need for the Ollama Chat Model node to work?
An Ollama instance and a set of Ollama credentials in n8n. The credentials hold the base URL, which is where most of the setup effort goes: port 11434 by default, localhost when everything sits on one machine without containers, host.docker.internal when n8n runs in Docker, or the Ollama container name when both run in separate containers. For a remote instance behind an authenticated proxy such as Open WebUI, add an API key alongside the URL and the node authenticates with a Bearer token. Credentials are created once and reused across every workflow.
03What are the limits of this node?
It is a sub-node, so it has no main input and never runs on its own; it needs a root node connected to the Model port. Expressions behave differently there: given five input items, an expression always resolves to the first one, so per-item values cannot be injected. Ollama itself does not support custom HTTP agents, which makes custom HTTP or HTTPS proxies unreliable regardless of the HTTP_PROXY variables. And the node is at version 1, so an older workflow may show fewer of the 21 parameters described here.
04What do you connect at minimum, and which node to start with?
One connection is enough: drag the output onto the Model port of a root node. To start, Basic LLM Chain is the simplest pairing, since it sends a prompt and returns an answer with nothing else to configure. Move to AI Agent once the assistant needs to call tools or keep a memory. On the node itself, the Model parameter is the only required one; the rest are options that behave sensibly left untouched. Set Model, connect the port, run the workflow once, then tune.
05n8n or Make for running a local model?
Make is a hosted automation platform with no self-hosting option, billed per operation. That matters here more than usual: a local model is a self-hosting decision in the first place, and a hosted platform has to reach your machine from the outside. n8n can run on the same network as Ollama, which keeps prompts and responses inside your infrastructure. Make is the easier choice when nobody wants to maintain a server and the visual builder is what the team knows. Pick on hosting, data control and cost model, not on feature lists.
Hack'celeration Lab

Get our weekly integration tips.

No spam. Unsubscribe anytime.