Banana Gemini Gen
Google's Nano Banana, wired straight into ComfyUI
- image1
- image2
- image3
- image4
- image5
- image6
- image7
- image8
- image9
- image10
- image11
- image12
- image13
- image14
- image
- revised_prompt
- image_url
This node is what happens when you want Gemini's image model - the one the internet insists on calling Nano Banana - inside a ComfyUI workflow without running a single pixel on your own GPU. It's a direct REST wrapper around Google's generateContent API: feed it reference images and a prompt, get back an image tensor. No model download, no VRAM cost, no checkpoint drama. The price is that every call is a paid API hit, every image ships with an invisible SynthID watermark, and Google's safety filters are welded on whether you like them or not.
If you're used to local generation, that last part is the real adjustment. Nano Banana is technically brilliant and famously "unimaginative" - the community consensus in the KB's closed-source-models essay is that it's powerful but heavily filtered, with strict rules on celebrities and IP. It's a tool for product shots, scene restaging, character consistency, and multi-image fusion, not for pushing boundaries.
How it works
Despite the README's pip install google-generativeai, the shipped code never touches the SDK - it builds a generateContent request and POSTs it to https://generativelanguage.googleapis.com/v1beta/models/<model>:generateContent with the API key as a query param. Each of your up to 14 input images gets base64-encoded as a PNG and prefixed with a little [这是图片1] text marker so the model can reference "image 2" in your prompt.
Here's the subtle part: the seed input isn't a diffusion seed. The node appends a hidden [variation-12345] token to your prompt, seeded from that value, and Google keys output diversity off it. Same seed → same marker → same-ish result; seed 0 → random every run. That's exactly what the seed's tooltip says: changing this value forces regeneration. It's a hack, but it works.
Generation config is fixed: temperature 0.4, max output 8192 tokens, one candidate. aspect_ratio and resolution get folded into the image config - with a gotcha the author's own code comment admits: resolution is sent to both models, but only gemini-3-pro-image-preview honors it. On 2.5 Flash Image, the resolution dropdown may quietly do nothing.
Inputs and outputs that matter
- model -
gemini-2.5-flash-imageorgemini-3-pro-image-preview(the default; 4K native output, up to 14 reference images) - prompt - multiline, describes what you want. Defaults to "Combine the features of all input images into a single new image."
- aspect_ratio - Automatic, 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
- resolution - 1K / 2K / 4K
- seed - change it to force new content
- image1…image14 - the reference images; wire as many as you like
Optional api_key and base_url override config.json from the node itself. base_url is how you point it at a proxy relay or the paid third-party endpoint the README advertises (there's a Chinese relay service pushing this pack at a fraction of Google's price).
Outputs: image (tensor), revised_prompt (whatever text the model returned, "N/A" if none), image_url (a data: URL of the first generated image).
Install
ComfyUI Manager → search "Comfyui-banana2", or:
cd ComfyUI/custom_nodes
git clone https://github.com/penposs/Comfyui-banana2
Then restart. No model files, no heavy deps - the code only uses requests + PIL + torch, all of which ComfyUI already has, so the README's pip install google-generativeai pillow numpy torch is vestigial. For the key: copy config.json.example to config.json and drop in a key from Google AI Studio (the README claims a $300 free credit after binding a Visa/Mastercard - that's Google's promo, check current terms), or just type the key into the node.
Gotchas
- Silent fallback. If the API returns no image, the node passes your first input image straight through so the workflow keeps running. Great for batches, terrible for debugging - a "successful" run can be a no-op.
- Timeouts. 120s at 1K/2K, 360s at 4K, two retries. Big 4K generations against a slow relay will time out; drop to 2K.
- Cost. Nano Banana Pro runs roughly $0.039–0.24 per image depending on resolution. This is not the node for iterating on random seeds for fun.
- The API key error - "Google AI API Key 未在节点输入或 'config.json' 中设置" means the key wasn't found on the node or in config.json. And if config.json itself is missing, you get a FileNotFoundError telling you to rename the example file.
One last thing: this pack is small and its README leads in Chinese - built for the Chinese ComfyUI community, Bilibili tutorial and paid relay included. Expect a compact node that does one job directly, not a big community.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | gemini-3-pro-image-preview | 2 options: gemini-2.5-flash-image, gemini-3-pro-image-preview |
| prompt | STRING | Combine the features of all input images into a single new image. | — |
| aspect_ratio | COMBO | Automatic | 11 options: Automatic, 1:1, 2:3, 3:2, 3:4, 4:3, +5 |
| resolution | COMBO | 1K | 3 options: 1K, 2K, 4K |
| seed | INT | 00–18446744073709550000 | 随机种子,改变此值会强制重新生成内容 |
| api_keyopt | STRING | — | |
| base_urlopt | STRING | — | |
| image1opt | IMAGE | — | |
| image2opt | IMAGE | — | |
| image3opt | IMAGE | — | |
| image4opt | IMAGE | — | |
| image5opt | IMAGE | — | |
| image6opt | IMAGE | — | |
| image7opt | IMAGE | — | |
| image8opt | IMAGE | — | |
| image9opt | IMAGE | — | |
| image10opt | IMAGE | — | |
| image11opt | IMAGE | — | |
| image12opt | IMAGE | — | |
| image13opt | IMAGE | — | |
| image14opt | IMAGE | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| revised_prompt | STRING | — |
| image_url | STRING | — |