Extensions/comfyui-nano-banana-custom-node
ComfyUI Extension

comfyui-nano-banana-custom-node

Gemini image generation for ComfyUI using Google's official Python SDK with support for text-to-image and reference-image workflows.

By Leee62·Created 4 months ago·Updated 4 months ago· 1
Leee62/comfyui-nano-banana-custom-node
Nodes
On cloudLocal install
Stars1
Updated4 months ago
Readme

ComfyUI Nano Banana

Gemini image generation for ComfyUI, built on Google's official Python SDK: google-genai.

中文文档

Overview

This custom node adds a Gemini Nano Banana Image node to ComfyUI.

It uses the official Gemini SDK flow instead of handwritten REST requests:

  • from google import genai
  • from google.genai import types
  • client.models.generate_content(...)

Features

  • Supports gemini-2.5-flash-image
  • Supports gemini-3.1-flash-image-preview
  • Supports gemini-3-pro-image-preview
  • Supports text-to-image and reference-image workflows
  • Supports response mode, aspect ratio, resolution, candidate count, seed, and people-generation control
  • Supports per-node UI labels in English and Chinese
  • Supports optional proxy control, timeout settings, and Google Search tool enablement
  • Supports overriding the preset model with custom_model

Installation

Clone or copy this repository into your ComfyUI custom nodes directory:

ComfyUI/custom_nodes/ComfyUI-NanoBanana

Install the Gemini SDK in the same Python environment used by ComfyUI:

pip install -q -U google-genai

If your ComfyUI installation uses its own virtual environment, install the dependency there.

Restart ComfyUI after installation. Restarting is also required after frontend changes so the language-switch extension can load.

Node

  • Node name: Gemini Nano Banana Image
  • Category: Google AI/Gemini

Supported Models

  • gemini-2.5-flash-image
  • gemini-3.1-flash-image-preview
  • gemini-3-pro-image-preview

If Google releases newer model names, you can enter them manually through custom_model.

Inputs

Core Inputs

  • prompt: Prompt text for image generation or editing
  • language: UI label language, english or chinese
  • model: Preset Gemini image model
  • custom_model: Overrides model when provided
  • api_key: Gemini API key entered directly in the node
  • api_key_env: Environment variable name used to read the API key

Generation Inputs

  • response_mode: MODEL_DEFAULT, TEXT_AND_IMAGE, or IMAGE_ONLY
  • aspect_ratio: Output aspect ratio, or default
  • image_size: Output resolution, default, 1K, 2K, or 4K
  • candidate_count: Number of image candidates to request
  • seed: Random seed, use -1 to leave it unspecified
  • person_generation: default, DONT_ALLOW, ALLOW_ADULT, or ALLOW_ALL

Network Inputs

  • enable_google_search: Enables the Gemini Google Search tool
  • proxy_mode: environment, direct, or manual
  • proxy_url: Proxy URL used when proxy_mode is manual
  • timeout_seconds: Request timeout for the SDK client

Reference Image Inputs

The node exposes up to 5 optional reference image inputs by default:

  • image_1
  • image_2
  • image_3
  • image_4
  • image_5

Limits

  • The node exposes 5 reference image ports by default
  • gemini-2.5-flash-image is limited to 3 reference images on this node
  • Other supported models currently use the node default limit of 5
  • If Gemini returns images with mixed sizes, only the first size group is kept and a note is appended to the text output

API Key Resolution Order

The node resolves the API key in this order:

  1. api_key
  2. api_key_env
  3. GEMINI_API_KEY
  4. GOOGLE_API_KEY

Usage

Text to Image

Connect no reference images and provide only prompt.

Image to Image / Editing

Connect one or more reference images and describe the intended change in prompt.

Multi-Image Composition

Connect multiple reference images and describe how Gemini should merge or preserve them.

Notes

  • Model availability and image-generation capabilities can change over time; follow the official Gemini documentation first
  • The SDK may honor environment proxy settings unless you explicitly disable them with proxy_mode

References