Nodes/ComfyUI-OllamaPromptsGeneratorTlant/Ollama Prompts Generator Tlant
ComfyUI Node

Ollama Prompts Generator Tlant

Your Free Local Prompt Rewriter (No API Key, No Extra GPU)

By Tlant·Created 2 years ago·Updated 5 months ago· 2
Ollama Prompts Generator Tlant
    • STRING
    positive_text
    reference_text
    negative_text
    prompt_templateAs a professional art critic, describe the image based on the descriptions provided in the following three reference paragraphs. The first reference paragraph: {positive_text} The second reference paragraph: {reference_text} The third reference paragraph: {negative_text} Create a coherent and realistic scene in a single paragraph. Include: Describe placement Main subject details Artistic style and theme Setting and narrative contribution Lighting characteristics Color palette and emotional tone Camera angle and focus The elements described in the first reference paragraph must be included in the output paragraph, and if there is a conflict between the first reference paragraph and the second reference paragraph, the first reference paragraph takes precedence. The description in the third reference paragraph contains negative elements and should not appear in the output paragraph. If no description for the third reference paragraph is provided, it can be ignored. Merge image concepts if there is more than one. Always blend the concepts, never talk about splits or parallel. Do not split or divide scenes, or talk about them differently - merge everything to one scene and one scene only. Blend all elements into unified reality. Use image generation prompt language. No preamble, questions, or commentary.
    custom_modelllama3.1:8b
    ollama_urlhttp://localhost:11434/api/generate

    This is the node the whole pack is named after, and the one that finally makes sense of the word "Ollama" in the repo URL. You feed it three chunks of text - the stuff that must be in the image, some reference context, and the stuff that must not be there - and it hands back one clean prompt paragraph written by a local LLM. No API key, no cloud account, no second GPU. If your machine can already run a diffusion model, it can almost certainly run llama3.1:8b alongside it for the few seconds the prompt takes.

    How it works

    The node takes three text inputs - positive_text, reference_text, negative_text - and drops them into prompt_template, which uses {positive_text}, {reference_text}, and {negative_text} as placeholders. The default template is a surprisingly well-thought-out art-critic instruction: the first paragraph wins on conflicts, the negative paragraph must not appear anywhere in the output, and everything gets merged into a single coherent scene rather than described as parallel halves.

    Then it sends a plain HTTP POST to Ollama's generate endpoint (http://localhost:11434/api/generate by default) with the model name and your formatted prompt. Note it's the raw /api/generate endpoint, not the chat API, and it sets stream: false - you get the whole answer at once. The output is a single STRING, which wires straight into a CLIP Text Encode positive input.

    Inputs that matter

    • positive_text - the elements that absolutely have to show up. This is the one that wins on conflicts, so it's your primary prompt.
    • reference_text - enrichment and context; the template treats it as the "second reference."
    • negative_text - things to exclude. If it's empty, the template ignores it.
    • custom_model (default llama3.1:8b) and ollama_url - the model string must match one you've pulled, and the URL is the endpoint, not the Ollama homepage.
    • prompt_template - worth editing once you outgrow the default.

    Install and first run

    Install the pack via ComfyUI Manager (search "Ollama Prompts Generator Tlant") or clone it:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Tlant/ComfyUI-OllamaPromptsGeneratorTlant
    

    Then restart ComfyUI. Dependencies are just requests and aiohttp, which Manager pulls automatically. The real prerequisite lives outside ComfyUI: install Ollama, pull a model, and leave the server running.

    ollama pull llama3.1:8b
    ollama list
    

    Where people get burned

    • "Model not found" errors. The custom_model string has to match what ollama list shows. Change the default and forget to pull, and you'll get a 404-ish error back from the API.
    • Ollama not running. Connection refused on port 11434 is the classic first-run wall. Start Ollama, then re-run.
    • It hangs on a busy box. Unlike the pack's other Ollama node, this one doesn't set a request timeout, so a slow model on a loaded machine can take a while to answer. That's local-LLM life - the answer comes back eventually.
    • VRAM anxiety. People ask whether running Ollama inside ComfyUI steals VRAM from the sampler. In practice the model loads, writes your prompt, and unloads before the KSampler runs, so the image generation itself isn't fighting for memory.

    The community has been doing exactly this for a while - a bare idea in, an enriched prompt out, before the sampler touches anything. This node just makes it a one-click graph. For a free, offline prompt rewriter, it's the one you'd actually reach for.

    Categoryprompts

    Inputs (6)

    NameTypeDefaultDescription
    positive_textSTRING
    reference_textSTRING
    negative_textSTRING
    prompt_templateSTRINGAs a professional art critic, describe the image based on the descriptions provided in the following three reference paragraphs. The first reference paragraph: {positive_text} The second reference paragraph: {reference_text} The third reference paragraph: {negative_text} Create a coherent and realistic scene in a single paragraph. Include: Describe placement Main subject details Artistic style and theme Setting and narrative contribution Lighting characteristics Color palette and emotional tone Camera angle and focus The elements described in the first reference paragraph must be included in the output paragraph, and if there is a conflict between the first reference paragraph and the second reference paragraph, the first reference paragraph takes precedence. The description in the third reference paragraph contains negative elements and should not appear in the output paragraph. If no description for the third reference paragraph is provided, it can be ignored. Merge image concepts if there is more than one. Always blend the concepts, never talk about splits or parallel. Do not split or divide scenes, or talk about them differently - merge everything to one scene and one scene only. Blend all elements into unified reality. Use image generation prompt language. No preamble, questions, or commentary.
    custom_modeloptSTRINGllama3.1:8b
    ollama_urloptSTRINGhttp://localhost:11434/api/generate

    Outputs (1)

    NameTypeDescription
    STRINGSTRING