Nodes/SDXL Auto Prompter/APNext OllamaNode
ComfyUI Node

APNext OllamaNode

Local, free prompt expansion with no API key

By dagthomas·Created 3 years ago·Updated 13 days ago· 283
APNext OllamaNode
    • STRING
    input_text
    happy_talktrue
    compressfalse
    compression_level
    posterfalse
    custom_base_prompt
    custom_modelllama3.1:8b
    ollama_urlhttp://localhost:11434/api/generate
    custom_title
    override

    This is the one to use if you don't want to pay a cloud provider or hand your prompts to OpenAI. OllamaNode (APNext OllamaNode) does the same job as the GPT, Grok and Groq text nodes - takes a scrap of input_text and expands it into a full image prompt - except it runs the LLM on your machine through Ollama. No API key, no per-call cost, nothing leaves your box. dagthomas has offered a local Ollama path since the early days of this pack precisely because the cloud vision nodes get "semi-expensive" and not everyone wants that bill.

    The catch, and it's the whole catch: Ollama has to actually be running. This node is a thin client that POSTs to an Ollama server. If you haven't installed Ollama and pulled a model, the node has nothing to talk to.

    How it works

    You install Ollama separately, pull a model (ollama pull llama3.1:8b), and it serves an HTTP API on localhost:11434. This node sends your text plus a prompt-writer system message to that server and returns whatever the local model generates. Your GPU (or CPU) does the work, so speed and quality depend entirely on the model you pulled and the hardware you have.

    The inputs that matter:

    • input_text - your rough idea.
    • custom_model (default llama3.1:8b) - the Ollama model tag to use. Whatever you set here must already be pulled in Ollama; the node won't download it for you. mistral, qwen2.5, gemma2, anything you've got.
    • ollama_url (default http://localhost:11434/api/generate) - where the Ollama server lives. Change it if Ollama runs on another machine or port.

    The shared style switches are here too: happy_talk (tone), compress + compression_level (trim the output), poster (poster formatting). Optional custom_base_prompt / override replace the built-in system prompt. One STRING output into your text encode.

    Installing it

    The node itself: ComfyUI Manager, search comfyui_dagthomas, install, restart - or clone it:

    cd ComfyUI/custom_nodes
    git clone https://github.com/dagthomas/comfyui_dagthomas
    cd comfyui_dagthomas
    pip install -r requirements.txt
    

    That's only half the job. You also need Ollama installed and running, with at least one model pulled:

    ollama pull llama3.1:8b
    

    Unlike the cloud nodes, this one needs no environment variable and no key - just a reachable Ollama server.

    Common issues

    "Connection refused" / node hangs. Ollama isn't running, or it's on a different address. Start Ollama, confirm curl http://localhost:11434/api/tags returns your models, and make sure ollama_url matches. This is the number-one problem with this node, full stop.

    "Model not found." The custom_model tag has to be one you've already ollama pulled. A typo or an un-pulled model errors - pull it first, then queue.

    Running on a cloud/managed ComfyUI? Then localhost:11434 points at the server's localhost, not yours - there's usually no Ollama there. This node really wants a local install where you control the machine. On a serverless host, the cloud API nodes (or a local vision model like MiniCPM/Phi that loads onto the GPU directly) are the better fit.

    Quality feels weak. An 8B model writes a flatter prompt than GPT-4o. If your rig can handle it, pull a bigger model; if it can't, lean on compress to at least keep the output tight and usable.

    Categorycomfyui_dagthomas

    Inputs (10)

    NameTypeDefaultDescription
    input_textSTRING
    happy_talkBOOLEANtrue
    compressBOOLEANfalse
    compression_levelCOMBO3 options: soft, medium, hard
    posterBOOLEANfalse
    custom_base_promptoptSTRING
    custom_modeloptSTRINGllama3.1:8b
    ollama_urloptSTRINGhttp://localhost:11434/api/generate
    custom_titleoptSTRING
    overrideoptSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING