Gemini Image Generation (Nano Banana)
Gemini image generation, no weights required
- ref_image_1
- ref_image_2
- ref_image_3
- ref_image_4
- image
Nano Banana is the community's nickname for Google's Gemini image models - the closed family you cannot download, only call. This node is how that family lands inside a ComfyUI graph: give it a prompt, it hits the Gemini API, and drops a real IMAGE output onto your canvas as if a local sampler made it. It's the node you reach for when you want Gemini's text rendering and prompt adherence and are willing to pay per image for it.
The model list is the current trio: gemini-3.1-flash-image-preview (default - this is Nano Banana 2's line), gemini-3-pro-image-preview (Nano Banana Pro, the 4K flagship), and gemini-2.5-flash-image (the original Nano Banana). custom_model overrides with anything Google ships that the dropdown doesn't know yet.
The inputs that do the real work:
prompt- plain English image prompt. With reference images attached, use[Reference Image 1],[Reference Image 2], etc. inside the prompt to tell the model how to use them.aspect_ratio- 11 options from 1:1 through 16:9 and 21:9 (plus AUTO). Default 16:9.image_size- AUTO, 1K, 2K, or 4K. Default is 4K, which is the Pro model's party trick and also where your bill climbs fastest.ref_image_1..4- up to four reference IMAGE inputs for style transfer, character consistency, or subject reference.thinking_level- NONE/LOW/NORMAL/HIGH. How much the model reasons before generating. This is the "Nano Banana understands your prompt" knob; HIGH costs more and buys better prompt compliance on hard requests.temperature,seed(−1 = random),candidate_count(generate up to 4, keep the first),safety_settings_json(feed from the pack's Safety Settings node), andsystem_instruction.
One output: image.
Where it fits
This is the API-node tradeoff in one node. The model is genuinely strong - best-in-class at rendering text in images, which is where local checkpoints still stumble - but it's closed, metered, and your prompt and reference images leave the machine and pass through Google's aggressive moderation. No local checkpoint can do the text-rendering, so for signage, packaging, and any image with words, this is often the right call. For anything a hosted filter would refuse, stay local; the node can't bypass what Google refuses at the source. It slots beautifully into a hybrid workflow - Gemini for the text-heavy hero shot, a local model for everything else.
Installing it
Part of the ComfyUI API Toolkit pack. Manager: search "API Toolkit". Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/IxMxAMAR/ComfyUI-API-Toolkit
cd ComfyUI-API-Toolkit
pip install -r requirements.txt
Restart. Needs google-genai>=0.8.0; without it the Gemini service disables itself at startup.
Gotchas
- 4K at default on every queue is how you blow a budget. Draft at 1K or 2K, commit at 4K.
- The pack re-runs API nodes each queue (IS_CHANGED), so every run is a fresh paid call - remember to lock the seed when you've got a keeper and want to reproduce it.
- Censorship follows the model, not the node. Famous people, IP, and anything on Google's filter list simply won't generate.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | Gemini API key. Leave blank to use GEMINI_API_KEY env var. | |
| model | COMBO | gemini-3.1-flash-image-preview | Gemini image model. For Imagen models, use the dedicated Imagen Image Generation node instead. |
| custom_model | STRING | Override with a custom model ID. | |
| prompt | STRING | Image generation prompt. Use [Reference Image N] to refer to inputs. | |
| aspect_ratio | COMBO | 16:9 | Output image aspect ratio. |
| image_size | COMBO | 4K | Output image resolution. |
| system_instructionopt | STRING | System instruction for the image generation model. | |
| thinking_levelopt | COMBO | NONE | How much the model should reason before generating. |
| temperatureopt | FLOAT | 1.000–2 | Controls randomness in generation. |
| seedopt | INT | -1-1–2147483647 | Random seed for reproducibility (-1 = random). |
| candidate_countopt | INT | 11–4 | Number of image candidates to generate (returns first). |
| ref_image_1opt | IMAGE | First reference image. | |
| ref_image_2opt | IMAGE | Second reference image. | |
| ref_image_3opt | IMAGE | Third reference image. | |
| ref_image_4opt | IMAGE | Fourth reference image. | |
| safety_settings_jsonopt | STRING | JSON safety settings from Safety Settings node. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |