Nodes/Comfy Gemini/Gemini Enhance Prompt
ComfyUI Node

Gemini Enhance Prompt

Send a Rough Prompt to Gemini, Get a Detailed One Back

By Abdelrahman-habib·Created about a year ago·Updated about a year ago· 0
Gemini Enhance Prompt
    • enhanced_prompt
    prompt
    model
    api_key
    system_prompt/ You are a prompt enhancer assistant. Your task is to take a given text prompt and enhance it to be more detailed, vivid, and effective for text-to-image generation. Expand on the original concept, adding descriptive elements related to: - Scene details (setting, environment, background elements) - Subject details (appearance, clothing, expression for characters; specific features for objects/animals) - Actions or poses (make them more dynamic or specific) - Style and mood (elaborate or refine the artistic style, atmosphere) - Colors, lighting, and composition (add specific details about light source, color palette, camera angle, framing) Maintain the core idea of the original prompt but make it richer and more imaginative. The enhanced prompt should be suitable for generating a high-quality image. The enhanced prompt must be natural, vivid, and no longer than 700 characters. Output only the enhanced prompt.

    You type "cyberpunk alley, rain, neon" and GeminiEnhancePrompt hands your sampler a paragraph about wet asphalt reflections, a glowing ramen sign, and a lone figure in a long coat. That's the whole job. It's a prompt enhancer that runs on Google's servers instead of your GPU - one of two nodes in the small comfy-gemini pack (the other, GeminiImageToPrompt, does the reverse and reads an image).

    This fits a very real slot in the graph. The 2026 ComfyUI stack reads prompts like instructions, not tag bags (prompt-engineering.md), and prompt enhancement is now a routine upstream step - literally prompt enhancer shows up 250+ times a year in the community (llm-in-comfyui.md). The interesting nodes run an uncensored local 8B model for free. This one is the API alternative: frontier-chat quality, per-call cost, and Google's content filter attached. For SFW stuff where you want Gemini-grade wording, it does the job with zero VRAM.

    How it works

    The node is a thin HTTP client, not a model. It takes your prompt, tacks on a system_prompt (the instruction telling Gemini to expand on scene, subject, style, lighting, and "output only the enhanced prompt, no longer than 700 characters"), and calls generate_content on whatever model you pick. The text comes back and flows out the enhanced_prompt (STRING) output - straight into a CLIP Text Encode, or a PreviewText/ShowText node if you want to read it before committing.

    The inputs that matter

    Four inputs, and you really only touch two:

    • prompt - the rough text you want expanded. Multiline, no default required.
    • model - a dropdown, and it's hardcoded. The source only offers gemini-1.5-pro-latest and gemini-2.0-flash-exp. Note the README name-drops gemini-2.5-pro-latest - that's not in the actual list. The -exp model is the sensible pick (2.0 Flash has a history in this community as the uncensored-and-cheap captioner), but "exp" means Google can retire it whenever.
    • api_key - masked field. Leave it blank and the node reads the GEMINI_API_KEY environment variable, which is the better habit.
    • system_prompt - the enhancer's instructions, editable if you want tag-style output or a different length cap.

    Installing it

    ComfyUI Manager (search comfy-gemini), or the manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/abdelrahman-habib/comfy-gemini
    cd comfy-gemini
    pip install -r requirements.txt
    

    Then restart ComfyUI. No model downloads - everything happens on Google's servers - but requirements.txt pulls google-genai, which drags in google-auth and httpx. Grab a free API key from aistudio.google.com and you're live.

    Where people get burned

    The silent fallback is the trap. The enhance method wraps everything in a try/except that returns your original prompt unchanged on any failure - missing key, wrong model, dead network, quota. So the workflow "runs," produces an image, and you have no idea the enhancement never happened. If output looks un-enhanced, open the ComfyUI console and look for Error calling Gemini API in Enhance Prompt. It's the #1 confusion and it's by design, not a bug.

    The dropdown rots. Both models are API-side names, not files, and Google has deprecated 1.5 Pro. If you start hitting model-not-found errors, there's no fix in the UI - the choices are baked into the code. You may be better off in the other direction: a local GGUF/Qwen LLM node for enhancement is free, offline, and uncensored, and for most workflows that's the better default (llm-in-comfyui.md walks through it).

    Treat it like the credential holder it is. This is a small, one-commit pack with a tiny install base, in the exact category that shipped the LLMVISION malware once (external-api-nodes.md). The reassurance here is concrete: the whole thing is about a hundred lines of readable Python that only calls Google's client. Skim it before your first run, and remember your prompts and key are leaving your machine to a service that logs and filters them.

    One workflow note: the default template produces flowing natural language, which suits LLM-encoded bases like Flux and Z-Image. If your model is Illustrious or Pony - a tag-tuned anime lineage - you'll want to rewrite the system prompt to emit comma-separated tags, or the prose will fight the encoder.

    It's not the most powerful prompt tool on the registry, but for a one-node job - "make this rough idea sound like a real prompt" - it's honest, small, and does exactly what it says. Just remember it's silent when it fails.

    CategoryGemini/Text

    Inputs (4)

    NameTypeDefaultDescription
    promptSTRING
    modelCOMBO2 options: gemini-1.5-pro-latest, gemini-2.0-flash-exp
    api_keyoptSTRING
    system_promptoptSTRING/ You are a prompt enhancer assistant. Your task is to take a given text prompt and enhance it to be more detailed, vivid, and effective for text-to-image generation. Expand on the original concept, adding descriptive elements related to: - Scene details (setting, environment, background elements) - Subject details (appearance, clothing, expression for characters; specific features for objects/animals) - Actions or poses (make them more dynamic or specific) - Style and mood (elaborate or refine the artistic style, atmosphere) - Colors, lighting, and composition (add specific details about light source, color palette, camera angle, framing) Maintain the core idea of the original prompt but make it richer and more imaginative. The enhanced prompt should be suitable for generating a high-quality image. The enhanced prompt must be natural, vivid, and no longer than 700 characters. Output only the enhanced prompt.

    Outputs (1)

    NameTypeDescription
    enhanced_promptSTRING