Nodes/ComfyUI-KikoTools/Gemini Prompt Engineer
ComfyUI Node

Gemini Prompt Engineer

Turn Any Image Back Into a Prompt, With Google's Gemini

By ComfyAssets·Created about a year ago·Updated 2 months ago· 19
Gemini Prompt Engineer
  • image
  • prompt
  • negative_prompt
prompt_typeflux
modelgemini-2.5-flash
api_key
custom_prompt
refresh_modelsfalse

See an image you love and want the prompt that produced it - or just an image whose style you want to describe? Gemini Prompt Engineer feeds the image to Google's Gemini and gets back a written prompt, formatted for whichever model family you're actually going to run: FLUX, SDXL, Danbooru-style tags, or video descriptions. It's prompt reverse-engineering as a node.

How it works

The flow is simple: you connect an image and the node sends it to the Gemini API with a system prompt that tells the model what to write. The formatting is the real feature. The prompt_type dropdown swaps in a different template from the pack's prompts.py:

  • flux - detailed artistic prose with quality markers, the sentence-style prompt FLUX's T5 encoder likes.
  • sdxl - a positive/negative pair with weight emphasis, formatted for the CLIP-encoder world where (word:1.3) still means something.
  • danbooru - underscore-separated booru tags for the anime/SDXL tag ecosystem.
  • video - motion and temporal descriptions for video generation.

That's the part that respects the actual prompting rules: FLUX wants sentences, SDXL wants weighted tags, and dumping one into the other is the classic "why does my output look wrong" story. The node routes each style to the right convention for you. You can also override the whole template with your own custom_prompt if you want the model analyzing something specific.

Inputs and outputs

  • image - the reference image.
  • prompt_type - flux / sdxl / danbooru / video.
  • model - default gemini-2.5-flash; the list also includes 2.5-pro, 2.0-flash, and the 1.5 pair. refresh_models re-fetches the current list from Google.
  • api_key (optional) - paste your key here, or set the GEMINI_API_KEY environment variable and leave it blank.

Outputs: prompt and negative_prompt (the negative is only populated for styles that use one, like SDXL).

Installing it

This is the one KikoTools node with a real extra dependency. Pack install first:

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

That installs google-generativeai (the only runtime dependency the pack declares, and it's only needed for this node). Then get a key from Google AI Studio - the free tier exists and is fine for this. Set it as an environment variable, or paste it into the api_key field. Restart ComfyUI and it's under ComfyAssets → Prompts.

Gotchas

No key, no dice: the node errors clearly if google-generativeai isn't installed or no key is found. Set the env var - it's easier than pasting the key into every workflow. The other gotcha is the model list: it's fetched from Google and cached, so if you don't see a brand-new model, hit refresh_models (or wait; the cache is there for offline use). And calibrate expectations: Gemini describes what's in the image, it doesn't recover the exact prompt that made it - you get a strong starting point, then you'll still tune. Wire the output into the pack's Display Text or a plain text node and iterate.

Category🫶 ComfyAssets/🧠 Prompts

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
prompt_typeCOMBOflux4 options: flux, sdxl, danbooru, video
modelCOMBOgemini-2.5-flash5 options: gemini-2.5-flash, gemini-2.5-pro, gemini-2.0-flash, gemini-1.5-flash, gemini-1.5-pro
api_keyoptSTRING
custom_promptoptSTRING
refresh_modelsoptBOOLEANfalse

Outputs (2)

NameTypeDescription
promptSTRING
negative_promptSTRING