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.
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 genaifrom google.genai import typesclient.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-imagegemini-3.1-flash-image-previewgemini-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 editinglanguage: UI label language,englishorchinesemodel: Preset Gemini image modelcustom_model: Overridesmodelwhen providedapi_key: Gemini API key entered directly in the nodeapi_key_env: Environment variable name used to read the API key
Generation Inputs
response_mode:MODEL_DEFAULT,TEXT_AND_IMAGE, orIMAGE_ONLYaspect_ratio: Output aspect ratio, ordefaultimage_size: Output resolution,default,1K,2K, or4Kcandidate_count: Number of image candidates to requestseed: Random seed, use-1to leave it unspecifiedperson_generation:default,DONT_ALLOW,ALLOW_ADULT, orALLOW_ALL
Network Inputs
enable_google_search: Enables the Gemini Google Search toolproxy_mode:environment,direct, ormanualproxy_url: Proxy URL used whenproxy_modeismanualtimeout_seconds: Request timeout for the SDK client
Reference Image Inputs
The node exposes up to 5 optional reference image inputs by default:
image_1image_2image_3image_4image_5
Limits
- The node exposes
5reference image ports by default gemini-2.5-flash-imageis limited to3reference 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:
api_keyapi_key_envGEMINI_API_KEYGOOGLE_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
- Gemini image generation docs: https://ai.google.dev/gemini-api/docs/image-generation
- Gemini quickstart: https://ai.google.dev/gemini-api/docs/quickstart
- Python SDK reference: https://googleapis.github.io/python-genai/