ComfyUI Node

Nano Banana

Gemini 2.5 Flash Image as a ComfyUI node

By mikheys·Created about a year ago·Updated about a year ago· 2
Nano Banana
  • image_to_edit
  • reference_image_1
  • reference_image_2
  • reference_image_3
  • reference_image_4
  • reference_image_5
  • image
  • status
prompt
model
api_key
proxy
operationNone
qualityNone
aspect_ratioNone
character_consistencytrue
temperature-0.05
seed1251066653

The name sounds like something you'd download a checkpoint for. It isn't. Nano_Banana is a bridge node that lets a ComfyUI graph call Google's Gemini 2.5 Flash Image - the model Google now brands as Nano Banana - for context-aware image editing. No weights, no GPU inference, no custom_nodes model folder. It's an API call wearing a ComfyUI node's clothes, a fork of Visionatrix/ComfyUI-Gemini with a friendlier aspect-ratio and reference-image setup.

Why reach for it? Because if your goal is "same character, new pose" or "swap the texture from reference A onto image B", instruction editing is what the community actually recommends these days - generate once, then edit, and the model never re-invents the subject. Nano Banana is one of the strongest models at exactly that. The catch: it's a closed cloud model, aggressively safety-filtered, billed per image, and everything you feed it leaves your machine.

How it works

The node packs your prompt and every wired image into a single Gemini generateContent call using Google's google-genai SDK. Reference images and the edit image go in as inline image parts - up to five references plus one main image. The actual model call happens lazily in check_lazy_status, i.e. when the node downstream actually requests the image, so a prompt-only failure won't torch your graph.

Before calling, it assembles the final prompt from the widgets: operation prepends a canned instruction ("Apply the style from the reference images to the main image…"), and quality, aspect_ratio, and character_consistency get appended as text. Notable detail: temperature defaults to -0.05, which is below zero on purpose - the node only sends it to the API if it's >= 0, so the default means "let Google pick." There's also a blank-canvas mode: wire nothing in and set an aspect_ratio, and it mints a white image at that ratio so you can still generate from scratch.

The status output is where the honesty lives. On success it's Complete; on failure it's Error: … plus a request log. Either way you get an image out - a gray placeholder with the error text baked in - so downstream save/preview nodes never see a missing input.

The inputs that matter

  • prompt - the actual instruction, in plain narrative language. "Change the wall color to a rich red using the texture from the reference image" is exactly the intended style.
  • image_to_edit - the base image. The README's claim holds: the output keeps this image's aspect ratio.
  • reference_image_1reference_image_5 - style/pattern/texture references. This is what makes multi-reference editing work.
  • operation - generate, edit, style_transfer, or object_insertion, plus None. Each rewrites your prompt into the right kind of instruction; each also validates that the required images are wired, and errors early if not.
  • character_consistency - on by default; appends "Maintain character consistency and visual identity from the provided images." This is your face-stays-the-same lever.
  • api_key - if you don't set the GOOGLE_API_KEY environment variable, paste a key here. proxy is there too, setting HTTP(S)_PROXY for the call - handy if you're behind a corporate proxy or in a region where Google's API needs a detour.

Outputs: image (the edit, or the error placeholder) and status (the string above). Wire image into any save/preview node.

Installing it

No models to hunt down - this is the whole appeal. Via ComfyUI Manager, search "Nano Banana"; or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/mikheys/comfyui-gemini-mikheys

Restart ComfyUI. The only real dependency is google-genai>=1.32.0; the rest of the requirements (torch, Pillow, numpy) ship with ComfyUI anyway. You do need a Google API key from AI Studio - export it as GOOGLE_API_KEY before launching, or wire it into the node. One limitation: the model dropdown has a single entry, gemini-2.5-flash-image-preview; this version won't let you jump to Nano Banana Pro or 2.

Troubleshooting

  • "Error: API key not provided" - the #1 beginner wall. Set the env var or the api_key input.
  • "Prompt or image was blocked by safety filters" - this is Google's censorship at work, not a bug. Nano Banana is aggressively filtered on IP, celebrities, and sensitive content (a January 2026 policy tightened it further). The model refuses; your graph doesn't crash.
  • Rate limits - hitting free-tier quota surfaces as ResourceExhausted. The node retries those, but a paid key or a wait is the real fix.
  • It's a live API - your prompts, reference images, and outputs are sent to Google, logged, and billed per image. For a one-off edit that's fine; for an unattended batch pipeline, budget for it. That's the trade you accept for getting Nano Banana's editing inside ComfyUI at all.
CategoryGemini

Inputs (16)

NameTypeDefaultDescription
promptSTRING
modelCOMBO1 options: gemini-2.5-flash-image-preview
api_keyoptSTRING
proxyoptSTRING
image_to_editoptIMAGE
reference_image_1optIMAGE
reference_image_2optIMAGE
reference_image_3optIMAGE
reference_image_4optIMAGE
reference_image_5optIMAGE
operationoptCOMBONone5 options: None, generate, edit, style_transfer, object_insertion
qualityoptCOMBONone3 options: None, standard, high
aspect_ratiooptCOMBONone16 options: None, 1:1 ◻, 5:4 ▭, 4:3 ▭, 3:2 ▭, 16:9 ▭, +10
character_consistencyoptBOOLEANtrue
temperatureoptFLOAT-0.05-0.05–1
seedoptINT12510666530–2147483648

Outputs (2)

NameTypeDescription
imageIMAGE
statusSTRING