Nodes/ComfyUI-Manufnode/OllamaEnhancerNode
ComfyUI Node

OllamaEnhancerNode

Turn Ollama into your prompt writer — no API key, no cloud

By efortin·Created 12 months ago·Updated 3 months ago· 3
OllamaEnhancerNode
  • clip
  • positive
  • negative
user_prompt
ollama_urlhttp://ollama:11434
template_pathprompt.jinja
enhance_positivetrue
reuse_running_modeltrue
fallback_modelllama3.2:3b
fallback_force_cputrue
seed0

You type "a girl in a forest at sunset" and this node hands your sampler a polished paragraph plus a solid negative list - and it never touches the internet to do it. OllamaEnhancerNode is a small node from the efortin/ComfyUI-Ollama-Enhancer pack (registered as "ComfyUI-Manufnode") that runs your prompt through a local LLM, asks it to write better positive and negative prompts, and encodes both straight into CONDITIONING. No API key, no OpenAI bill, no leaking your prompts to a third party. If you already run Ollama for chat, this is the least-friction way to make it useful for image generation.

Where it fits - and where it won't. This is a CLIP-era tool. It takes a CLIP model in and emits CONDITIONING, so it's right at home feeding SDXL, Illustrious, Pony, or Flux.1. It will not help with the 2026 LLM-encoded models (Z-Image, Flux 2 Dev, Klein, Anima) - those don't encode through CLIP and don't have a negative prompt to fill. Keep it on the SDXL lineage and it earns its keep; the negative prompt is alive and well there, even as it's died on the newer stuff.

How it works

On every run, the node grabs your user_prompt, drops it into the bundled prompt.jinja template ("You are a prompt engineer for Stable Diffusion XL… return STRICT JSON"), and sends it to Ollama via the ollama Python client. It expects back JSON with two lists - positive_text and negative_text. Then:

  • Positive is the model's positive_text joined into a sentence, unless enhance_positive is false, in which case your raw prompt goes through untouched.
  • Negative is the model's negative_text unioned with a hardcoded ~30-term blocklist the author baked in (extra heads, extra limbs, watermark, lowres, blurry…).
  • Both get encoded through your clip input (encode_from_tokens with return_pooled) and come out the two outputs, positive and negative.

Here's the thing I like: it fails safe. If Ollama is down, the model returns non-JSON, or the fallback model isn't pulled, it doesn't crash your queue - it just encodes your raw prompt plus the built-in negatives and carries on. Worst case you get an unenhanced image instead of a red graph.

The inputs that matter

  • ollama_url - the one that will bite you. The default is http://ollama:11434, which is a Docker-Compose service name, not a desktop address. On a normal install, change it to http://localhost:11434 or the address of your Ollama server.
  • user_prompt - what you'd normally type into a CLIPTextEncode node.
  • enhance_positive - flip to false if the LLM keeps mangling your idea; it still builds the negative.
  • reuse_running_model - when true (the default), the node uses whatever model Ollama currently has loaded, whatever that is. Your fallback_model (llama3.2:3b by default) and fallback_force_cpu only kick in when nothing's running. Force CPU applies just to the fallback, not a reused model.

One honest quibble: the seed input is cosmetic. Reading the source, it's logged and never forwarded to Ollama's generation options, so don't expect reproducible expansions from it.

Installing

Grab it through ComfyUI Manager (search "Ollama Enhancer" or "Manufnode"), or the manual route:

cd ComfyUI/custom_nodes
git clone https://github.com/efortin/ComfyUI-Ollama-Enhancer
cd ComfyUI-Ollama-Enhancer
pip install -r requirements.txt

Then restart ComfyUI. It needs an Ollama server (with a model pulled - ollama pull llama3.2:3b if you want the fallback to work) and Python 3.11+. The only real dependency is the ollama client library.

Gotchas

The template's flavor text says "Stable Diffusion XL" even when you use it with Flux - it works, but the style cues lean SDXL/anime, so your output will too. Also, this runs synchronously and uncached: every queue run is another LLM inference. If you're iterating on a prompt, run it once, save the output text, and reuse it - don't pay for the same expansion forty times. And if the model drifts and adds subjects you never asked for, that's the classic enhancer failure; enhance_positive = false is your escape hatch.

CategoryOllama

Inputs (9)

NameTypeDefaultDescription
clipCLIP
user_promptSTRING
ollama_urlSTRINGhttp://ollama:11434
template_pathSTRINGprompt.jinja
enhance_positiveCOMBOtrue2 options: true, false
reuse_running_modelCOMBOtrue2 options: true, false
fallback_modelSTRINGllama3.2:3b
fallback_force_cpuCOMBOtrue2 options: true, false
seedINT00–4294967295

Outputs (2)

NameTypeDescription
positiveCONDITIONING
negativeCONDITIONING