ComfyUI Node

Ollama Chat

Chat with a local LLM inside your ComfyUI graph — no API key, no cloud

By fairy-root·Created 2 years ago·Updated about a year ago· 18
Ollama Chat
    • STRING
    promptEnter your prompt here...
    ollama_modelNo Ollama Models Found
    Console_logtrue

    The name is a lie, in the best way. "Ollama Chat" doesn't call some hosted API and it doesn't need a key - it talks to the Ollama server already running on your own machine, and hands the answer back to your graph as a plain string. That one output is the whole point: it means you can ask a local LLM to rewrite, translate, or brainstorm your prompt inside the workflow, and have its reply flow straight into the text encoder instead of living in a browser tab you copy from.

    How it works

    It's a thin wrapper over Ollama's Python client. When the node loads, it asks your local Ollama server for the list of installed models (ollama.list()) and builds the dropdown from what it finds. When you hit Queue, it sends your prompt as a single user message to ollama.chat() with streaming on, stitches the chunks back together, and returns the finished text.

    That's the whole mechanism, and the limits follow from it. There's no system-prompt field, no chat history, no temperature or top-p control - it's a one-shot call. The node also marks itself as always-changed, so it re-runs on every execution instead of caching a reply. Streaming makes it feel live: with Console_log on you'll watch the reply type out in ComfyUI's terminal as it generates.

    The inputs that matter

    • prompt - your actual message. Multiline, defaults to "Enter your prompt here...".
    • ollama_model - the dropdown, auto-populated from your Ollama install. Note the filter: any model with "llava" in the name is excluded, so vision models won't show up here (that's the sibling Ollama Vision node's job).
    • Console_log - on by default; mirrors the streaming reply to the console.

    Output is a single STRING, which is what you wire into whatever takes text - a prompt-rewrite loop, a save node, or the conditioning side of your sampler.

    Why you'd reach for it

    LLM-assisted prompting has gone from a novelty to a default workflow: if your model's encoder reads instructions, having an LLM write those instructions is translating between two things that speak the same language. This node is the smallest thing that lets you do that locally - no API bill, no data leaving the box, and the whole enhancement loop lives in the graph where you can iterate it. The pack's own announcement thread (the author's first ComfyUI project, back in 2024) drew the most excited comment for exactly this trick: describe an image with the vision node, feed the description in here, and let the LLM turn it into a proper prompt. Image-to-text-to-image, minus the hallucination of a dedicated describer.

    Installing it

    Clone into custom_nodes, install the one dependency, restart:

    cd ComfyUI/custom_nodes
    git clone https://github.com/fairy-root/comfyui-ollama-llms.git
    pip install ollama
    

    You also need the Ollama app itself (it runs as a background service), and at least one model:

    ollama pull phi3
    

    ComfyUI Manager works too - search for "fairy-root" and it'll show up. Worth one caution: this whole LLM-in-ComfyUI niche got burned hard by the 2024 LLMVISION malware incident, so install from the official repo (or Manager's catalog) and don't grab mystery forks from workflow downloads.

    Where people get burned

    • "No Ollama Models Found" in the dropdown - the single most common failure. It means ComfyUI couldn't reach the Ollama server when the node loaded: Ollama isn't running, or it's running on a machine/port ComfyUI can't see. Fix that, not the node.
    • You pulled a new model and it's not in the list. The dropdown is populated at node load. Pull the model, then restart ComfyUI (or reload the graph) so it picks it up.
    • First run is slow. Ollama lazy-loads a model on first use, so the first chat can take a while; after that it stays warm.
    • It won't keep a conversation. Single-shot only. If you need multi-turn context, chat history, or tool calls, this is the wrong tool - bigger maintained packs do that. This one is deliberately minimal, and for "run a local model in the graph and hand its reply to the sampler" that minimalism is the feature.
    CategoryOllama

    Inputs (3)

    NameTypeDefaultDescription
    promptSTRINGEnter your prompt here...
    ollama_modeloptCOMBONo Ollama Models Found1 options: No Ollama Models Found
    Console_logoptBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    STRINGSTRING