Nodes/SDXL Auto Prompter/APNext Gemini Text Only
ComfyUI Node

APNext Gemini Text Only

Text-to-prompt with Gemini and reusable templates

By dagthomas·Created 3 years ago·Updated 16 days ago· 285
APNext Gemini Text Only
    • output
    • clip_l
    custom_prompt
    additive_prompt
    dynamic_promptfalse
    tagohwx man
    sexmale
    words100
    pronounshim, his
    gemini_model
    seed-1
    randomize_each_runtrue

    This is the no-image Gemini node: pure text in, prompt out. It's for when you don't have a reference picture, just an idea or a template you want Gemini to expand into a full image prompt. Think of it as the cheap, fast prompt-writer of dagthomas's LLM lineup - Gemini Flash is quick and inexpensive, and pointing it at a well-written template gives you consistent, structured prompts without a chat tab.

    Having an LLM write your prompt is the modern default, not a gimmick - on 2026 models whose text encoder is itself an LLM (Flux 2, Z-Image, Qwen), you're translating your idea into an instruction the image model reads natively. GeminiTextOnly is the lightweight way to do that in-graph, and its dynamic-template support makes it especially handy for churning out LoRA-caption-style prompts at volume.

    How it works

    It fills any dynamic tokens into your prompt and sends it to Gemini, returning the generated text. There's no image input - everything comes from custom_prompt (plus additive_prompt). Turn on dynamic_prompt and ##TAG##, ##SEX##, ##WORDS##, ##PRONOUNS## get substituted from the matching inputs, so one template produces consistent captions across many subjects. seed and randomize_each_run give you fresh variations per run.

    The inputs and outputs that matter

    • custom_prompt - your instruction or template. The whole node runs on this; pair it with CustomPromptLoader to pull a saved one.
    • additive_prompt - extra text appended to the instruction.
    • gemini_model - the dropdown (2.5 Pro down to Flash-Lite). Flash is the cheap, fast default.
    • dynamic_prompt + tag / sex / words / pronouns - template substitution for repeatable captions.
    • seed + randomize_each_run - batch variety.

    Two outputs: output (the generated text) and clip_l (a trimmed variant sized for a CLIP-L text slot).

    How to install it

    ComfyUI Manager: search comfyui_dagthomas, install, restart. Manual:

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

    then restart. Needs google-generativeai (in requirements.txt) and a GEMINI_API_KEY set in the environment before launching ComfyUI.

    Where people get burned

    • Key set after launch, or missing. Export GEMINI_API_KEY before you start ComfyUI. Read at startup, nowhere else.
    • Hosted ComfyUI blocks it. Outbound API calls aren't available on most serverless instances; this is a local-install node.
    • Empty template, empty value. With no custom_prompt there's nothing for Gemini to expand. Start from a CustomPromptLoader template if you're unsure.
    • Watch the length. Gemini will write a lot if you let it; the KB's attention-cap point (models drift past ~75–100 effective tokens) applies. Ask for concise output in the template, or you're feeding the encoder an essay.
    • Model name drift. The dropdown can list a variant your key can't call; that errors at runtime. Edit data/gemini_models.json to match your access.
    Categorycomfyui_dagthomas

    Inputs (10)

    NameTypeDefaultDescription
    custom_promptSTRING
    additive_promptSTRING
    dynamic_promptBOOLEANfalse
    tagSTRINGohwx man
    sexSTRINGmale
    wordsSTRING100
    pronounsSTRINGhim, his
    gemini_modelCOMBO5 options: gemini-2.5-pro, gemini-flash-latest, gemini-2.5-flash, gemini-flash-lite-latest, gemini-2.5-flash-lite
    seedINT-1-1–18446744073709550000
    randomize_each_runBOOLEANtrue

    Outputs (2)

    NameTypeDescription
    outputSTRING
    clip_lSTRING