ComfyUI Node

Call Ollama

Query a Local Ollama Model Without an API Key or a Cloud Bill

By 5agado·Created 12 months ago·Updated 18 days ago· 1
Call Ollama
    • response
    model_namellama2
    prompt
    temperature0.6
    max_tokens2048
    thinkfalse
    image_path
    image_base64

    The name is the truth, which is refreshing. Call Ollama sends your prompt to a model running in a local Ollama server - no cloud API, no key, no per-token bill. People wire LLMs into ComfyUI all the time as prompt-enrichment backends: you describe the image loosely and the model turns it into a detailed prompt before it hits the sampler. This node is the version of that which keeps everything on your machine.

    The setup you need before it works

    Two prerequisites, and if you skip either you'll get a wall of connection errors:

    1. Ollama installed and running on the same machine (ollama serve - it listens on localhost:11434 by default).
    2. The model pulled. ollama pull llama2 or whatever you want to use. The model_name field defaults to llama2, which isn't pulled by default on fresh installs.

    Only then does the node matter. It calls ollama.chat() through the pack's ollama Python dependency, so it's a local HTTP call, not a ComfyUI-internal thing.

    Inputs and output

    • model_name (STRING, default llama2) - the Ollama model tag.
    • prompt (STRING) - what you're asking.
    • temperature (FLOAT, default 0.6, range 0–1) - creativity knob.
    • max_tokens (INT, default 2048) - response length cap.
    • Optional: image_path (STRING) or image_base64 (STRING) - for vision models (llava, Qwen2-VL and friends), one of these carries the image.
    • Output: response (STRING) - the model's reply, which you can pipe into a text encoder or a show-text node.

    The think-style models get handled with heavier context settings behind the scenes; the node's defaults (top_p, top_k, num_ctx, repeat_penalty) differ depending on whether you're talking to a reasoning model. You don't set those - they're baked in.

    Install

    This is the one Sagado node with a real runtime dependency beyond the basics. The pack's requirements.txt includes ollama, so:

    cd ComfyUI/custom_nodes
    git clone https://github.com/5agado/ComfyUI-Sagado-Nodes
    pip install -r ComfyUI-Sagado-Nodes/requirements.txt
    

    Restart, then install Ollama itself from ollama.com if you haven't. Or use ComfyUI Manager → "Sagado Nodes for ComfyUI" for the clone.

    Where people get burned

    The error message you'll meet is Error getting LLM response, and 90% of the time it's one of the two prerequisites above: Ollama isn't running, or the model name isn't pulled (ollama list to check). The other gotcha is the vision inputs - pass both image_path and image_base64 and you only need one; they're alternatives, not both-required. And remember VRAM: unlike a cloud API, this model lives on your GPU. It loads to generate your prompt, and a local Ollama run typically doesn't hold VRAM while the sampler runs, but a big model can still compete with your checkpoint for space. Keep the model small if you're on a tight card.

    CategorySagado-Nodes

    Inputs (7)

    NameTypeDefaultDescription
    model_nameSTRINGllama2
    promptSTRING
    temperatureFLOAT0.60–1
    max_tokensINT2048-1–32000
    thinkBOOLEANfalse
    image_pathoptSTRING
    image_base64optSTRING

    Outputs (1)

    NameTypeDescription
    responseSTRING