Nodes/comfyui-ollama-prompt-enhancer/Ollama Prompt Enhancer
ComfyUI Node

Ollama Prompt Enhancer

Your Rough Idea, Polished by a Local LLM — No API Key, No Cloud

By johnbonjohnsonn-creator·Created 4 months ago·Updated 4 months ago· 0
Ollama Prompt Enhancer
    • enhanced_prompt
    • original_prompt
    prompta beautiful landscape
    modelllama3.2:latest
    enhancement_instructionsEnhance this image generation prompt by adding vivid details, lighting, and artistic style. Keep it concise and focused on visual elements.
    temperature0.7
    ollama_urlhttp://localhost:11434
    max_tokens256

    The name is the whole pitch: type a rough idea, a local LLM running through Ollama rewrites it into a prompt your checkpoint can actually do something with. No API key to paste in, no cloud account, no per-call bill. If Ollama is already on your machine, this node is just a text box and a dropdown.

    This is the LLM-assisted prompting pattern that went from a browser-tab trick to a routine ComfyUI node. And it fits modern checkpoints better than it fits old ones: if your model's encoder is itself a language model reading an instruction (Flux, Z-Image, LTX), having a second, small LLM write that instruction is a translation between two things that speak the same language. You stop fighting the blank page; the LLM fills in the details. This node is the minimal version - one file, nothing fancy.

    How it works

    When the node loads, it asks Ollama's /api/tags endpoint for your installed models and builds the dropdown from the reply. Hit Queue and it POSTs a hand-assembled prompt to /api/generate (non-streaming, 60-second timeout): your enhancement_instructions, the original prompt, and Enhanced prompt: as the cue for the model to continue. It collapses the newlines, strips whitespace, and hands you the text.

    One thoughtful touch: after every call it tells Ollama to unload the model from VRAM (keep_alive: 0). That's why this pack is pitched at LTX-style talking-head workflows - an 8 GB LLM squats in the same card your video model needs, and this node politely kicks it out after each run. The cost: the next call reloads it, so you pay a little latency per generation.

    The inputs that matter

    • prompt - your rough idea, multiline. The blank page.
    • model - a dropdown of the models you've pulled into Ollama; falls back to llama3.2:latest if it can't reach the server.
    • enhancement_instructions - the actual instructions you give the LLM. This is the knob you'll tune, not temperature. The default ("add vivid details, lighting, and artistic style...") is fine, but you'll get better results steering it toward your base model: camera-and-lens language for photo models, comma-separated tags for anime ones.
    • ollama_url - defaults to http://localhost:11434; point it at another machine if your Ollama server isn't local.
    • max_tokens (optional) - how long the rewrite may run, 256 by default, up to 4096.

    Outputs and where they go

    Two STRING outputs: enhanced_prompt and original_prompt (your input echoed back). Wire enhanced_prompt into any CLIP Text Encode or text field. One confusion to clear up: the node is filed under "conditioning" in the UI, but it outputs plain strings - it feeds text inputs, not a conditioning slot directly.

    Installing it

    Two ways, both quick. In ComfyUI Manager: Install Custom Nodes → search "Ollama Prompt Enhancer" → install → restart. Or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/johnbonjohnsonn-creator/comfyui-ollama-prompt-enhancer
    

    Restart ComfyUI and you're done - the node only imports requests, which ComfyUI already bundles, so there's no pip step and no model download inside ComfyUI. The real dependency is Ollama itself: install it from ollama.com, leave it running, and pull a model:

    ollama pull llama3.2    # 3B, light enough to share the card
    

    The dropdown is read when the node is created, so pull new models before adding it - or re-add it after.

    Where people get burned

    • It fails silently. On any error - Ollama down, wrong model name, timeout - the node returns your original prompt unchanged instead of raising. It looks like it "did nothing." Check the ComfyUI console for lines starting [Ollama].
    • Dirty output. There are no decoding guardrails here - no hard stop tokens, no regex cleaner beyond collapsing newlines. A chatty model can dump "Here is your enhanced prompt:" preamble straight into your conditioning. If the first result looks polluted, switch to a more obedient small model or tighten your instructions.
    • Subject drift. An enhancer adds detail; left unconstrained, it adds detail you never asked for. The fix the community converged on is narrowing the job - one tight instruction line, and eyeball the output before queueing a big batch.

    Honest note: this is a small, obscure pack - a single source file, essentially no community footprint. That's not a knock; it makes it easy to skim. The one rule from the wider ecosystem worth keeping: LLM nodes are arbitrary Python that reach the network by design, so glance at the source before you trust one with real workflows. At this size, that's two minutes.

    Categoryconditioning

    Inputs (6)

    NameTypeDefaultDescription
    promptSTRINGa beautiful landscape
    modelCOMBOllama3.2:latest1 options: llama3.2:latest
    enhancement_instructionsSTRINGEnhance this image generation prompt by adding vivid details, lighting, and artistic style. Keep it concise and focused on visual elements.
    temperatureFLOAT0.70–2
    ollama_urlSTRINGhttp://localhost:11434
    max_tokensoptINT2561–4096

    Outputs (2)

    NameTypeDescription
    enhanced_promptSTRING
    original_promptSTRING