Gemini Prompt Engineer
Turn Any Image Back Into a Prompt, With Google's Gemini
- image
- prompt
- negative_prompt
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_modelsre-fetches the current list from Google. - api_key (optional) - paste your key here, or set the
GEMINI_API_KEYenvironment 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.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| prompt_type | COMBO | flux | 4 options: flux, sdxl, danbooru, video |
| model | COMBO | gemini-2.5-flash | 5 options: gemini-2.5-flash, gemini-2.5-pro, gemini-2.0-flash, gemini-1.5-flash, gemini-1.5-pro |
| api_keyopt | STRING | — | |
| custom_promptopt | STRING | — | |
| refresh_modelsopt | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |
| negative_prompt | STRING | — |