Nodes/ComfyUI-Vivax-Nodes/Ollama Generate
ComfyUI Node

Ollama Generate

Talk to a Local LLM From Inside Your Graph

By vivax3794·Created 2 years ago·Updated 2 years ago· 3
Ollama Generate
  • messages
  • messages
  • response
modelmistral
seed
hosthttp://ollama:11434

Ollama Generate is the payoff node of this pack's two-node LLM section: it takes a chat history, sends it to a local Ollama server, and hands you the reply as a plain string. That string can go anywhere text can - a prompt encoder, a filename prefix, a wildcard processor, another LLM call. The whole thing stays local, costs nothing per call, and needs no API key.

People put Ollama inside ComfyUI for exactly this kind of plumbing: prompt enhancement before the sampler, character-consistency system prompts, even RPG-style wildcard substitution. The workflow genre is "LLM thinks, then ComfyUI renders." This node is the "LLM thinks" half.

How it works

It's a thin wrapper around Ollama's /api/chat endpoint. The node POSTs the message list to {host}/api/chat with stream off (so it waits for the full reply rather than a token stream), passes your seed through as an option, and asks the server to keep the model warm for 10 seconds after the call - enough to make consecutive generations snappy without pinning VRAM forever. It returns two things: the full message list with the assistant's reply appended, and the reply text by itself.

The inputs and outputs

  • messages (MESSAGE[]) - the chat history, built with the pack's Ollama Message nodes.
  • model (STRING, default mistral) - which model to call. It must already exist on your Ollama server (ollama pull mistral if not).
  • seed (INT) - passed to Ollama for reproducible generations.
  • host (STRING, default http://ollama:11434) - where Ollama lives. This default is a Docker service name, not localhost. That's the single most common gotcha in this pack.

Outputs:

  • messages (MESSAGE[]) - the input history plus the assistant reply, so you can chain another turn.
  • response (STRING) - the assistant's answer. Wire this into your text node of choice.

The node also displays the response in its own UI panel, which is handy for a quick sanity check.

Where people get burned

  • The host default. On a normal desktop install, change host to http://localhost:11434. Leave it as http://ollama:11434 - the name of the container from the author's Docker setup - and the request just fails to connect.
  • Model not found. The default model is mistral. If your Ollama server doesn't have it pulled, you get an error immediately. Run ollama list to see what you've got, then set the model input accordingly.
  • Ollama isn't running at all. This node is a client. No ollama serve, no reply. Check the server is up before debugging the node itself.
  • MESSAGE[] is a pack-local type. The chat history only plugs into this pack's own nodes (Ollama Message and Ollama Generate). You can't wire someone else's message list in without adapting it.

Install

Install with ComfyUI Manager (search ComfyUI-Vivax-Nodes) or clone:

cd ComfyUI/custom_nodes
git clone https://github.com/vivax3794/ComfyUI-Vivax-Nodes

then restart ComfyUI. The pack's only Python dependency is rich; the actual HTTP calls use requests, which ships with ComfyUI. You also need a running Ollama install and at least one pulled model - that's external to ComfyUI, not something the pack downloads for you. Single-author pack, small codebase; the usual skim-the-repo-before-installing advice applies.

Categoryvivax/ollama

Inputs (4)

NameTypeDefaultDescription
messagesMESSAGE[]
modelSTRINGmistral
seedINT
hostSTRINGhttp://ollama:11434

Outputs (2)

NameTypeDescription
messagesMESSAGE[]
responseSTRING