🤖 Ollama LLM
Your local LLM, inside the graph — no API key, no monthly bill
- response
- context
This is the node that gives the pack its name - an actual LLM living inside your ComfyUI graph, and the best part is the name is the honest part: it calls no API and needs no key. It talks to a local Ollama server on localhost:11434 and pipes the text straight into your workflow. That's the whole trick, and it's the one worth installing the pack for.
People use exactly this pattern all the time in the wild - a workflow where a local LLM auto-captions an image or writes the prompt for an image-to-video pass (the well-known LTX + Ollama captioning workflow is basically this). Ollama inside ComfyUI is a staple of the ecosystem for one reason: you get LLM prompt-engineering in the graph without a single dollar or a cloud account.
How it works
At import time the node hits Ollama's /api/tags and fills its model dropdown with whatever you've ollama pulled. Ollama not running? It silently falls back to a default list (llama3, deepseek-r1:7b) and carries on. On generate, it streams the completion from /api/generate and stitches the chunks together.
The two outputs are where it gets interesting:
response(STRING) - the model's reply, ready to feed aCLIPTextEncodeor a prompt-builder.context(STRING) - a JSON-encoded blob of the conversation's token context. Feed it back into thecontextinput on the next run and you get multi-turn memory for free. Chain two of these nodes together and you've got a chat loop.
Inputs that matter
prompt- your instruction. Multiline, and the bundledjs/ollama_widgets.jsgives it a resizable textarea that remembers its height.model- auto-populated from Ollama's installed models.hide_thoughts- the sleeper hit. DeepSeek-R1 (the default) emits its chain-of-thought inside<think>...</think>tags, and this strips them so your downstream prompt isn't polluted with reasoning. Leave it on unless you want the thinking visible.temperature,max_tokens,system_message,stop_sequences(comma-separated) - all as you'd expect.
Installing it
First, the prerequisite Ollama doesn't know ComfyUI exists:
# outside ComfyUI, once
curl -fsSL https://ollama.com/install.sh | sh
ollama pull deepseek-r1:7b # or llama3, qwen, whatever
Then the node itself - ComfyUI Manager → search comfyUI_LLM, or:
cd ComfyUI/custom_nodes
git clone https://github.com/XieJunchen/comfyUI_LLM
# restart ComfyUI
No model files land in ComfyUI's models/ - the models live in Ollama's own store, which catches people out when they go looking for GGUF weights in the usual folders.
Where people get burned
- Single-GPU VRAM deadlock. Ollama pins your GPU while it holds a model in memory, and ComfyUI is trying to use the same card - the classic fix is setting Ollama's
keep_aliveto 0 so it unloads after each request, or manually freeing VRAM. It's the most common complaint about the whole Ollama-in-ComfyUI idea, and it's real. This node doesn't manage that for you. - Re-execution churn. LLM nodes re-run on workflow tweaks, invalidating downstream cache in big graphs. Annoying, known, and not this node's fault.
- It writes a log to
~/Desktop/ollama_comfyui.logand deletes the old one on import. Harmless, just weird if you see a file appear on your Desktop. - Ollama down → you get "Ollama服务不可用" (service unavailable) as the response rather than a hard error. Read the console.
The one-liner: if you want a local model writing prompts inside ComfyUI, this does it with zero setup beyond installing Ollama - and it's the most genuinely useful node in a pack that's mostly utilities.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | 请用简洁的语言回答... | — |
| model | COMBO | deepseek-r1:7b | 2 options: llama3, deepseek-r1:7b |
| temperature | FLOAT | 0.70–2 | — |
| max_tokens | INT | 10241–4096 | — |
| hide_thoughts | BOOLEAN | false | — |
| contextopt | STRING | — | |
| system_messageopt | STRING | 你是有帮助的AI助手 | — |
| stop_sequencesopt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| response | STRING | — |
| context | STRING | — |