ComfyUI Node

Ollama Generator

Local LLM or vision through Ollama, with thinking kept separate

By gpdev-Pilcothink·Created 11 months ago·Updated 3 months ago· 2
Ollama Generator
  • connection
  • image
  • text
  • thinking
seed0
temperature0.70
top_p0.90
top_k0
repeat_penalty0.00
keep_alive
max_tokens512
enable_thinkingtrue
is_thinkingtrue
system_prompt
prompt

OllamaGenerator is the workhorse of the pack's Ollama side: it takes an OLLAMA_CONNECTION from the connective node, sends a prompt to your local Ollama server, and returns the model's answer. Wire an image in too, and it becomes a vision-capable generator - Ollama's multimodal models accept base64 images, and this node converts your ComfyUI image tensor for you. One node, text or vision, entirely local.

This is the node most people actually end up using from this pack, because it's the flexible one. The models are whatever you pulled into Ollama - that can be a beefy Qwen or Llama that runs circles around the pack's tiny bundled SLM - and the whole thing integrates with a single HTTP call to your existing Ollama install. In practice the r/comfyui crowd uses Ollama-style nodes exactly this way: prompt enhancement, captioning, and image-question workflows, all without a cloud key.

How it works

On run, it POSTs to /api/generate on your Ollama server with the connection's model, your prompt, and a sampling options block. The response is streamed, and the node collects two streams separately: thinking tokens (the reasoning some models emit) and response tokens (the actual answer). Those come back as two separate outputs, which is the nice part - your downstream nodes get clean text, not a <think> blob they have to parse. There's even a fallback that splits <think>...</think> out of the answer text for models that report thinking inside the response instead.

The inputs that matter

  • connection - from "Ollama Connective." Required, force-input.
  • prompt (optional) and system_prompt (optional) - wire these from String Text or RAG nodes.
  • image (optional) - an IMAGE tensor; only the first frame is sent, base64-encoded as PNG.
  • temperature (0.7), top_p (0.9), top_k (0), repeat_penalty (0) - sampling knobs; zero means the option is simply not sent.
  • max_tokens - 512 default, up to 8192.
  • keep_alive - optional; pass a number (seconds) or a duration string to control how long the model stays warm.
  • enable_thinking and is_thinking - both default true. is_thinking gates whether the think flag is sent at all; enable_thinking is its value. Flip them if your model doesn't support reasoning and the request misbehaves.

Outputs: text (the answer) and thinking (the reasoning, if any) - both STRING.

Install

Ships in comfyui_pilcothink_VisionSLM:

cd ComfyUI/custom_nodes
git clone https://github.com/gpdev-Pilcothink/comfyui_pilcothink_VisionSLM

Restart, or install via ComfyUI Manager (search comfyui_pilcothink_VisionSLM). You also need Ollama itself running (ollama serve) with at least one model pulled (ollama pull qwen3:4b).

Gotchas

The usual suspects: Ollama not running, or the model not pulled - the error message names it either way. There's also a "prompt and image are both empty" guard that fires if you left both blank, which is the node's way of saying you have to ask something. The pack's requirements don't list requests explicitly, but it's a ComfyUI dependency anyway; if you ever see the "Python 'requests' package is missing" error, pip install requests in your venv.

Also worth knowing: the thinking split only works as well as the model cooperates. For models that stream a thinking field it's clean; for others the fallback regex is doing the work, and a model that formats its reasoning weirdly can leak reasoning into your text output. Keep an eye on the first run.

CategoryPilcothink/Ollama

Inputs (13)

NameTypeDefaultDescription
seedINT00–999999
connectionOLLAMA_CONNECTION
temperatureFLOAT0.700–2
top_pFLOAT0.900–1
top_kINT00–10000
repeat_penaltyFLOAT0.000–5
keep_aliveSTRING
max_tokensINT5121–8192
enable_thinkingBOOLEANtrue
is_thinkingBOOLEANtrue
system_promptoptSTRING
promptoptSTRING
imageoptIMAGE

Outputs (2)

NameTypeDescription
textSTRING
thinkingSTRING