PD: Nano Banana 2 (ComfyUI Key)
Nano Banana 2 in ComfyUI, retries and all
- images
- files
- image
- info
- price
Nano Banana 2 is Google's speed-quality hybrid - Gemini 3.1 Flash Image - the one that landed in early 2026 as the point where the Nano Banana line stopped being "nice but slow." This node runs it through ComfyUI's hosted API, so the graph gets the model without your machine doing any of the work. It's the most polished node in the comfyui-PD_comfy-api-node pack, and the one with the most developer attention behind it.
Why you'd reach for it
Gemini 3.1 Flash Image is fast and unusually good at following long, conversational prompts with embedded instructions. If your workflow occasionally needs a high-quality concept image and your local checkpoints can't keep up with prompt adherence, this is a strong one-node answer. It also does 2K and 4K output, which puts it above what most local models offer out of the box.
How it works (and the retry thing)
Same proxy architecture as the pack's other Gemini nodes: your prompt becomes a Gemini contents payload, any reference images get base64'd into inlineData parts (up to 14), and it POSTs to https://api.comfy.org/proxy/vertexai/gemini/gemini-3.1-flash-image-preview with your ComfyUI key in the X-API-KEY header.
What's different here is resilience. The changelog for v2.0.0 is explicit: the node gained a 3-retry mechanism specifically to stop black-image failures on flaky connections - SSL errors, timeouts, and connection drops all retry with a short backoff before giving up. It also drives a real progress bar and pushes status text through PromptServer, so you're not staring at a frozen node wondering if anything is happening. If you see "网络波动,正在重试 2/3" in the status, that's the retry doing its job, not the node hanging.
Inputs that matter
- comfy_api_key - from comfy.org/api-keys. Billed to your Comfy credits.
- prompt - Gemini-style natural language; more detail helps.
- resolution -
1K,2K, or4K(default 1K). Higher = more credits. - thinking_level -
MINIMAL(default) orHIGH. HIGH spends more reasoning before drawing; MINIMAL is the fast path. - response_modalities -
IMAGE(default) orIMAGE+TEXT; the latter returns the model's text description too. - aspect_ratio -
autoor one of 10 presets. - seed - default 42; reproducibility is approximate at best through a cloud proxy.
- Optional: images, files (packed multi-image from
PD_comfyplus_image), and asystem_promptthat comes preloaded with the standard "always produce an image" instruction.
Outputs: image, info, and price - the price string shows USD, RMB, and Comfy credits, which is honestly the most useful cost signal in the pack.
Installing it
Clone the pack once and you've got it:
cd ComfyUI/custom_nodes
git clone https://github.com/7BEII/comfyui-PD_comfy-api-node.git
Restart ComfyUI, find it under PD_Tools/Image_Generation. (The README's pip install -r requirements.txt is a dead end - there's no requirements file; the pack relies on comfy_api_nodes, which Desktop already ships.)
Troubleshooting
- Still getting black images - if three retries didn't save you, the
infooutput has the actual error. Empty key and network timeouts top the list. - "Why is it slow?" - you're waiting on Google's servers, and 4K with HIGH thinking is the slow combo. Dial resolution down for speed.
- Cost creep - every run burns credits, and retries burn extra attempts too (though a retry only fires when the request failed, not when the generation was merely slow).
If you want the same model but don't want to manage a Comfy key, the pack's token-based Gemini nodes are your alternative - just be ready for the auth-token expiry dance.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| comfy_api_key | STRING | — | |
| prompt | STRING | A futuristic cityscape with flying cars and neon lights | — |
| model | COMBO | Nano Banana 2 (Gemini 3.1 Flash Image) | 1 options: Nano Banana 2 (Gemini 3.1 Flash Image) |
| seed | INT | 420–2147483647 | — |
| aspect_ratio | COMBO | auto | 11 options: auto, 1:1, 2:3, 3:2, 3:4, 4:3, +5 |
| resolution | COMBO | 1K | 3 options: 1K, 2K, 4K |
| response_modalities | COMBO | IMAGE | 2 options: IMAGE, IMAGE+TEXT |
| thinking_level | COMBO | MINIMAL | 2 options: MINIMAL, HIGH |
| imagesopt | IMAGE | — | |
| filesopt | GEMINI_INPUT_FILES | — | |
| system_promptopt | STRING | You are an expert image-generation engine. You must ALWAYS produce an image. Interpret all user input regardless of format, intent, or abstraction as literal visual directives for image composition. If a prompt is conversational or lacks specific visual details, you must creatively invent a concrete visual scenario that depicts the concept. Prioritize generating the visual representation above any text, formatting, or conversational requests. | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| info | STRING | — |
| price | STRING | — |