Nodes/ComfyUI-NanoBanana2/NanoBanana - Image Generation (Nano Banana)
ComfyUI Node

NanoBanana - Image Generation (Nano Banana)

Google's Nano Banana, without the browser tab

By IxMxAMAR·Created 6 months ago·Updated about a month ago· 4
NanoBanana - Image Generation (Nano Banana)
  • ref_image_1
  • ref_image_2
  • ref_image_3
  • ref_image_4
  • network
  • 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

This is the node most people download the NanoBanana2 pack for. It drops Google's Gemini image models - Nano Banana, Nano Banana 2, and Nano Banana Pro - straight into your ComfyUI graph, no browser tab, no ImageFX, no local GPU. Everything runs on Google's servers via the Gemini API, so the whole "which checkpoint, which VRAM" question goes away. In exchange you pay per image and you live inside Google's content filters and watermark policy. That's the trade you're signing up for.

The name is a gift. "Nano Banana" started as an anonymous codename on a HuggingFace leaderboard, Google's execs started posting banana emojis, and the name stuck as official branding. This pack (which shares the name) is by IxMxAMAR and ships 29 nodes that wrap basically the entire Gemini SDK. But the ImageGen node is the heart of it.

How it works

Under the hood it's a single generate_content_stream call with response_modalities set to IMAGE + TEXT. Your reference images get encoded as JPEGs (95 quality), each one labeled --- [Reference Image N] --- so the prompt can point at them by number, and the streamed response is decoded back into a ComfyUI image tensor. Nothing runs locally except the encode/decode - your prompt and images travel to Google and a finished image comes back.

One detail worth knowing: set candidate_count above 1 and you get all of them back as a batched IMAGE tensor you can wire straight into Preview Image or Save Image. Earlier versions charged you for four candidates and quietly handed you one; the current release returns the whole lot. If a safety refusal happens, the error tells you which category tripped it and quotes the model's own explanation, so you're not guessing.

The inputs that matter

  • prompt - your image description. Use [Reference Image N] to refer to wired-in reference images (up to 4 of them).
  • aspect_ratio - 1:1 through 21:9, plus AUTO. Defaults to 16:9.
  • image_size - AUTO, 1K, 2K, or 4K. Nano Banana Pro's 4K native output is a big chunk of why people pay for it.
  • candidate_count - how many variants you want (1–4).
  • seed - -1 for random, or a fixed number to reproduce a run. Note every node in this pack re-executes on every run even with identical inputs - it's deliberate, so don't expect caching to save your seed.
  • thinking_level - defaults to NONE (thinking is opt-in because it costs more). The Pro model can reason about the prompt before generating if you bump this.

The single output, image, is a standard IMAGE tensor, so it feeds anything else in the graph. There's also safety_settings_json (from the pack's Safety Settings node) and a network input if you need to route through a proxy.

Installing it

Install once, get all 29 nodes. ComfyUI Manager: search NanoBanana2 and install. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/IxMxAMAR/ComfyUI-NanoBanana2
pip install google-genai

Then restart ComfyUI and grab a key from aistudio.google.com ("Get API Key"). Paste it into the node, or set GEMINI_API_KEY as an environment variable and leave the field blank - it picks that up automatically, even strips stray quotes from your .env file. No model files to download; the only dependency is the google-genai SDK.

Where people get burned

The two real gotchas are regional availability and the filters. Nano Banana access isn't the same on every account and in every region - if your key can't see the model, your call 400s. The pack's List Available Models node tells you what your key actually has, and the Network Route node exists precisely for the US-egress problem. And if a prompt trips the image safety policy, that's a refusal, not a bug - rephrase, don't re-run. Model names are previews and rotate; if Google drops something new, the custom_model override field accepts it before the dropdown catches up.

CategoryNanoBanana2/Image

Inputs (17)

NameTypeDefaultDescription
api_keySTRINGNanoBanana - API key. Leave blank to use GEMINI_API_KEY env var.
modelCOMBOgemini-3.1-flash-image-previewNanoBanana - 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. All are returned as a batch — wire into Preview Image or save the lot.
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.
networkoptNB_NETWORKOptional. Wire a NanoBanana - Network Route node here to route this request through that proxy (e.g. US egress).

Outputs (1)

NameTypeDescription
imageIMAGE