Nodes/comfyui-ollama-nodes/Generate Text | Ollama Nodes
ComfyUI Node

Generate Text | Ollama Nodes

The Ollama node that reads your images — local, free, no API key

By slyt·Created 2 years ago·Updated 2 years ago· 5
Generate Text | Ollama Nodes
  • context
  • images
  • options
  • response
  • model
  • created_at
  • done
  • done_reason
  • context
  • total_duration
  • load_duration
  • prompt_eval_duration
  • eval_count
  • eval_duration
model_namellava:latest
promptDescribe the images
systemYou are an AI assitant that describes images in great detail, focusing on the lighting, mood, scene, details, subjects, hues, and colors
streamfalse
template
format
keep_alive0.00

This is the whole reason the pack exists. GenerateOllama sends a prompt to a local Ollama model and gets text back - and because it takes an IMAGE input, it can look at your images and describe them. That makes it the best captioning / image2prompt shortcut in the pack, and the one you'll actually keep in a workflow. The name undersells it: "generate text" is the mechanism, "describe this render so I can use it as training data" is the job.

Why you'd reach for it

Three big uses, in order of popularity:

  1. Captioning for training. Feed it a batch of images and get detailed descriptions you can paste into LoRA training captions. This is the workflow the pack's README screenshot shows - batch image in, text out.
  2. Vision feedback in a pipeline. Ask it what's in the frame - lighting, mood, subject - and route that text into a prompt template for the next stage.
  3. Prompt enrichment. A handful of nodes in the ecosystem (like the Ollama-based enhancer that ships in ComfyUI-BerniniStudio) do this: plain idea in, detailed prompt out. Here you just change the system prompt to "expand this into a detailed image prompt."

The nice part, which r/comfyui posters consistently point out: it's fully local. No API key, no monthly bill, and Ollama unloads the model from VRAM after each call so your KSampler gets the memory back. That's a real advantage over calling a hosted vision API mid-workflow.

How it works

It calls ollama.generate on the Ollama server running at 127.0.0.1:11434. If you feed an images input, the node converts the tensor batch to PNG bytes and hands them to the model - which only works with a vision model. The default llava:latest is the classic choice; MiniCPM-V via Ollama is a popular alternative if you want more detail. The node always re-executes (it ignores caching), which is what you want when the input image changes.

The inputs that matter

  • model_name - which Ollama model to use. Default llava:latest. Text-only models work fine too; just leave images unplugged.
  • prompt - what you ask. Multiline. Default "Describe the images".
  • system - the system prompt, multiline. The default is a decent detailed-description prompt (with a typo, "assitant", which you can ignore or fix). Tweak this to steer the style of your captions.
  • images (optional) - an IMAGE tensor. Plug any image output here.
  • format (optional) - set json to force structured JSON output, handy for feeding results into other nodes.
  • context (optional) - the list of token IDs from a previous response output. Wire context from the last call back into context for multi-turn chat.
  • options (optional) - a dictionary of Ollama generation options (temperature, num_predict, etc.), passed through to the server.
  • keep_alive (optional) - 0 (default) unloads the model right after generation to free VRAM; -1 keeps it loaded for faster repeats. On a tight-VRAM card, leave it at 0.

The response output is the text you want. The other ten outputs - model, created_at, done, done_reason, context, total_duration, load_duration, prompt_eval_duration, eval_count, eval_duration - are Ollama's metadata (durations in nanoseconds, eval_count in tokens). Ignore them until you're benchmarking.

Getting it running

Two prerequisites. First, the pack itself: ComfyUI Manager → search "comfyui-ollama-nodes" → Install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/slyt/comfyui-ollama-nodes
cd comfyui-ollama-nodes
pip install -r requirements.txt

Second - the one people forget - Ollama must be running on the machine ComfyUI runs on (install from ollama.com). The pack assumes a server at 127.0.0.1:11434. Then pull a vision model once:

ollama pull llava

Troubleshooting

  • "Connection refused" / nothing happens - Ollama isn't running or isn't on the same host as ComfyUI. If ComfyUI runs on a remote box, set OLLAMA_HOST and make sure the port is reachable.
  • Vision model ignores the image - you're using a text-only model like llama3. Vision needs llava, minicpm-v, or similar.
  • Node executes instantly with empty output - check the console log; the pack logs each generate call, and the error will be there. Stream mode also drives a progress bar (the README notes ShowText can't do true token-by-token streaming yet).

Worth the install? Yes. If you train LoRAs or want a self-contained local "explain this image" node in your graph, this is the pack's flagship and it does the job.

CategoryLLM/Ollama

Inputs (10)

NameTypeDefaultDescription
model_nameSTRINGllava:latest
promptSTRINGDescribe the images
systemSTRINGYou are an AI assitant that describes images in great detail, focusing on the lighting, mood, scene, details, subjects, hues, and colors
streamBOOLEANfalse
templateoptSTRING
formatoptSTRING
contextoptLIST
imagesoptIMAGE
optionsoptDICTIONARY[object Object]
keep_aliveoptFLOAT0.00

Outputs (11)

NameTypeDescription
responseSTRING
modelSTRING
created_atSTRING
doneBOOLEAN
done_reasonSTRING
contextLIST
total_durationFLOAT
load_durationFLOAT
prompt_eval_durationFLOAT
eval_countINT
eval_durationFLOAT