Nodes/Leon's Utility and API Integration Nodes/πŸ€– Leon Official Nano Banana 🌐
ComfyUI Node

πŸ€– Leon Official Nano Banana 🌐

The Nano Banana node that's actually official

By l3ony2kΒ·Created about a year agoΒ·Updated 2 months agoΒ· 3
πŸ€– Leon Official Nano Banana 🌐
  • input_image
  • image_array
  • image
  • description
  • seed
β—„promptA beautiful painting of a nano banana dish in a fancy restaurantβ–Ί
β—„modelgemini-3.1-flash-image-previewβ–Ί
β—„api_keyYOUR_GEMINI_API_KEYβ–Ί
β—„seed0β–Ί
β—„aspect_ratio1:1β–Ί
β—„image_size1Kβ–Ί
β—„response_modalitiesIMAGE_ONLYβ–Ί
β—„custom_modelβ–Ί

If there's one node in this whole pack you'd actually fight someone for, it's this one. Nano Banana - Google's Gemini image model, the one the community nickname stuck to hard after it crushed the edit benchmarks in mid-2025 - is closed-weights and API-only, so the only way to get it into ComfyUI is through an API node. And this is the version that talks to Google directly with your own Gemini key, no aggregator in between.

The pack has two Nano Banana routes, and the difference matters. Leon_Nano_Banana_API_Node goes through HyprLab, a third-party aggregator, with a single shared key. This Leon_Official_Nano_Banana_Node calls generativelanguage.googleapis.com/v1beta natively with x-goog-api-key auth. Direct key, direct billing, no reseller margin, no "why does this model string 404" mysteries. It's also the version that shows what the model actually is: a text-and-image conversation, where the image model returns an image and can describe it.

How it works

The node builds a Gemini contents request - your prompt as a text part, plus any reference images as inlineData parts - and sends it to the generateContent endpoint. The generationConfig carries responseModalities (IMAGE only, or TEXT+IMAGE) and an imageConfig with your chosen aspectRatio and imageSize. The reply is parsed for both text parts (captions/descriptions) and the inlineData image, which gets converted into a ComfyUI RGBA tensor. Retry logic matches the pack's other nodes: exponential backoff, up to five attempts, and a hard stop on HTTP 400s so you don't burn retries on a bad request.

Inputs that matter

  • model - defaults to gemini-3.1-flash-image-preview, with gemini-3-pro-image-preview and gemini-2.5-flash-image in the dropdown. custom_model overrides any of them.
  • response_modalities - IMAGE_ONLY is the default and returns just the picture. Switch to TEXT_AND_IMAGE and the description output fills with the model's own write-up of the image. That's a genuinely handy free caption.
  • image_size - 1K/2K/4K. The tooltip nudges you about uppercase K for a reason: 4k won't parse like 4K does.
  • image_array - up to 14 reference images via the pack's Image Array Builder. This is where editing shines: stack a few shots of a subject and the model keeps identity far better than most open editors.

Outputs: image (tensor β†’ SaveImage), description (STRING, only populated in TEXT_AND_IMAGE mode), and seed.

Installing

Same pack, same routine - ComfyUI Manager (search Leon) or:

cd ComfyUI/custom_nodes/
git clone https://github.com/l3ony2k/comfyui-leon-nodes comfyui-leon-nodes
pip install -r requirements.txt

Restart, grab a Gemini API key from Google AI Studio, and drop it in. Nothing downloads, nothing local - this is pure cloud, and it costs per call.

Common issues

The 400s are the thing to learn: a wrong aspect_ratio (only the listed ones), a bogus custom_model, or a lowercase k in image_size all come back as a 400 that the node won't retry. The console prints the full Google error body, which is where the answer always is. And if you're coming from the HyprLab node with a nano-banana-2 model string in your head - stop. This node's enums are the actual Gemini model IDs, not the aggregator's nicknames. Paste the right key and keep IMAGE_ONLY on unless you actually want the description; the text mode costs more tokens for no visible image gain.

CategoryLeon_API

Inputs (10)

NameTypeDefaultDescription
promptSTRINGA beautiful painting of a nano banana dish in a fancy restaurantText prompt for image generation
modelCOMBOgemini-3.1-flash-image-previewNano Banana model variant
api_keySTRINGYOUR_GEMINI_API_KEYYour Google Gemini API key
seedINT00–18446744073709550000Random seed for reproducible results
aspect_ratiooptCOMBO1:1Aspect ratio of the output image
image_sizeoptCOMBO1KOutput resolution: 1K (default), 2K, or 4K. Must use uppercase K.
response_modalitiesoptCOMBOIMAGE_ONLYTEXT_AND_IMAGE returns descriptive text + image. IMAGE_ONLY returns image only.
input_imageoptIMAGEOptional reference image for editing
image_arrayoptIMAGE_ARRAYOptional array of reference images (up to 14). Connect Image Array Builder.
custom_modeloptSTRINGOverride model name with a custom string

Outputs (3)

NameTypeDescription
imageIMAGEβ€”
descriptionSTRINGβ€”
seedINTβ€”