Gemini Image Gen Advanced
Fifty Gemini images in one run, from a dozen prompt slots
- image_1
- images
- API_responses
- api_request
- api_response
The batch button for Gemini image generation
GeminiImageEditor handles one prompt at a time. GeminiImageGenADV is what you reach for when "one prompt" isn't the job - you have ten product shots to make, or twenty style variations of the same character, and you'd rather set them all up and let the node chew through them than babysit a single-image call. It's the batch engine of the pack: each prompt/image pair fires an independent API call, and everything comes back as one combined IMAGE batch.
It's overkill for a single image - that's what the plain Image Editor is for. But the moment you're generating variations, this is the one you want.
How it works
The key is inputcount: set it to however many slots you need (1–100), and the node exposes input_prompt_1 through input_prompt_N, plus matching optional input_image_1 through input_image_N. Each slot is its own prompt + optional reference image, and each slot's call runs asynchronously in parallel - the source uses a thread pool (capped at 10 workers) with per-slot retries and exponential backoff. A progress bar updates as results land. Like the Image Editor, it pads references to 1024x1024 minimum and returns a black error image per failed slot instead of aborting the whole batch.
Inputs that matter
- inputcount - the number of slots. Start small; the dynamic inputs only appear once this is set.
- prompt_1 … input_prompt_N - each slot's generation prompt. The first is always required (
prompt_1), the rest appear as you raise inputcount. - input_image_1 … input_image_N - optional reference images per slot. Great for "same base, different style" workflows: one base image, eight style prompts.
- model - default
models/gemini-2.0-flash-preview-image-generation;imagen-3.0-generate-001is a solid alternative. - temperature - 0–2, default 1.0, same logic as the Image Editor.
- seed - keep it consistent across slots for controlled variation, or let it roll for maximum spread.
- retry_indefinitely - keep hammering a failed slot forever. Tempting, and the README warns it's a cost risk. Leave it off until you've confirmed the failure isn't a bad prompt.
Outputs: images (the full batch - wire to a Save Image node), API_responses, and the standard api_request / api_response debug strings.
Install
Same pack, same routine:
cd ComfyUI/custom_nodes
git clone https://github.com/jqy-yo/comfyui-gemini-nodes
cd comfyui-gemini-nodes
pip install -r requirements.txt
ComfyUI Manager works too ("ComfyUI Gemini Nodes"). Restart, paste your key into api_key or set GOOGLE_API_KEY (the node also reads GEMINI_API_KEY), and you're off.
Where people get burned
Cost is the trap. inputcount: 50 with retry_indefinitely: true and a prompt the model refuses to draw is a receipt you'll remember. Plan slots deliberately - the README's examples (five handbag colors, ten times of day, eight art styles) are exactly the right shape. Also remember each slot is billed as its own image generation, and Gemini's content filters apply per call, so one politically-adjacent prompt in a batch of twenty will fail that slot and return an error image while the other nineteen succeed. Check API_responses when a batch looks short. And if you're only generating a single image, the Image Editor is simpler - this node's parallel power only pays off with real batch sizes.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| inputcount | INT | 11–100 | — |
| api_key | STRING | — | |
| model | STRING | models/gemini-2.0-flash-preview-image-generation | — |
| temperature | FLOAT | 1.000–2 | — |
| max_retries | INT | 31–5 | — |
| prompt_1 | STRING | Describe image 1 | — |
| image_1opt | IMAGE | — | |
| seedopt | INT | 00–2147483647 | — |
| retry_indefinitelyopt | BOOLEAN | false | — |
| api_versionopt | COMBO | auto | 4 options: auto, v1, v1beta, v1alpha |
| aspect_ratioopt | COMBO | default | 11 options: default, 1:1, 2:3, 3:2, 3:4, 4:3, +5 |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| API_responses | STRING | — |
| api_request | STRING | — |
| api_response | STRING | — |