Nodes/ComfyUI API Toolkit/Gemini Image Generation (Nano Banana)
ComfyUI Node

Gemini Image Generation (Nano Banana)

Gemini image generation, no weights required

By IxMxAMAR·Created 5 months ago·Updated 2 months ago· 1
Gemini Image Generation (Nano Banana)
  • ref_image_1
  • ref_image_2
  • ref_image_3
  • ref_image_4
  • image
api_key
modelgemini-3.1-flash-image-preview
custom_model
prompt
aspect_ratio16:9
image_size4K
system_instruction
thinking_levelNONE
temperature1.00
seed-1
candidate_count1
safety_settings_json

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), and system_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.
CategoryAPI Toolkit/Gemini/Image

Inputs (16)

NameTypeDefaultDescription
api_keySTRINGGemini API key. Leave blank to use GEMINI_API_KEY env var.
modelCOMBOgemini-3.1-flash-image-previewGemini image model. For Imagen models, use the dedicated Imagen Image Generation node instead.
custom_modelSTRINGOverride with a custom model ID.
promptSTRINGImage generation prompt. Use [Reference Image N] to refer to inputs.
aspect_ratioCOMBO16:9Output image aspect ratio.
image_sizeCOMBO4KOutput image resolution.
system_instructionoptSTRINGSystem instruction for the image generation model.
thinking_leveloptCOMBONONEHow much the model should reason before generating.
temperatureoptFLOAT1.000–2Controls randomness in generation.
seedoptINT-1-1–2147483647Random seed for reproducibility (-1 = random).
candidate_countoptINT11–4Number of image candidates to generate (returns first).
ref_image_1optIMAGEFirst reference image.
ref_image_2optIMAGESecond reference image.
ref_image_3optIMAGEThird reference image.
ref_image_4optIMAGEFourth reference image.
safety_settings_jsonoptSTRINGJSON safety settings from Safety Settings node.

Outputs (1)

NameTypeDescription
imageIMAGE