Nodes/ComfyUI-Nanobanana/ComfyUI-Nanobanana Nano Banana
ComfyUI Node

ComfyUI-Nanobanana Nano Banana

Google's Nano Banana, inside ComfyUI — no GPU required

By magicwang1111·Created 5 months ago·Updated 4 months ago· 0
ComfyUI-Nanobanana Nano Banana
  • images
  • image
  • text
  • response_json
prompt
seed42
aspect_ratioauto
response_modeIMAGE+TEXT
system_promptYou 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.
model_override
parallel_requests1

Let's get the name out of the way first. "Nano Banana" isn't this pack's invention - it's Google's official branding for Gemini 2.5 Flash Image, the consumer image model that popped up on the HuggingFace leaderboard as an anonymous codename and never got a better name. ComfyUI-Nanobanana is a thin client that lets you call that model straight from a normal ComfyUI node. It doesn't download weights, it doesn't touch your GPU, and it doesn't route through some sketchy third-party tokens - it POSTs to Google's own Gemini API and turns the response back into a standard IMAGE tensor you can wire into PreviewImage or SaveImage like anything else.

If that sounds like magic to people who've only ever run SDXL or Flux locally, the trade-off is the usual cloud one: you need a Google API key, and it costs money per image. Worth it when you want Nano Banana's text rendering and prompt adherence without the model file, or on a machine too weak for local generation.

How it works

The node builds a Gemini generateContent payload from your inputs, base64-encodes any reference images into inlineData parts, and sends it to POST /v1beta/models/gemini-2.5-flash-image:generateContent over async httpx. The response images come back as base64 too - the node decodes them into a torch IMAGE tensor and hands you the model's text as a bonus. Everything happens in memory; there's nothing to download beyond three lightweight pip packages.

This is the API-only form of Nano Banana, so a few things are baked in that you can't switch off: every image carries Google's invisible SynthID watermark, and the model's safety filters are aggressive - the community verdict on the ImageFX/Gemini stack: "powerful, unimaginative, massive hidden biasing." If the filter trips, the node raises an error and prints what the model said instead of returning an image.

The inputs that actually matter

Four required, and honestly only two you'll touch most of the time:

  • prompt - plain text, treated as a literal visual directive. This model is good with descriptive language; it's the default system prompt that does the heavy lifting.
  • seed - an int, default 42. Passed through as generationConfig.seed while send_seed is on (the default), so results are fairly reproducible.
  • aspect_ratio - auto plus the standard set: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9. Leave on auto and Google picks.
  • response_mode - IMAGE+TEXT (default) or IMAGE. Keep IMAGE+TEXT while you're debugging.

The optional inputs earn their keep: images takes a ComfyUI IMAGE batch as reference (up to 3 images on this node), and system_prompt is pre-filled with an "always produce an image, interpret everything visually" prompt - the kind of guardrail you'd want to keep. model_override is for relays that call the model something else, and parallel_requests (1–8) fires that many concurrent generations with incrementing seeds, stitched into one batch - handy for a quick grid.

Outputs are image, text, and response_json - the raw API response with base64 stripped out, a nice debug touch.

Installing it

The pack is young and small, so either route works:

cd ComfyUI/custom_nodes
git clone https://github.com/magicwang1111/ComfyUI-Nanobanana.git
cd ComfyUI-Nanobanana
python -m pip install -r requirements.txt

Restart ComfyUI and you'll find the three nodes under the ComfyUI-Nanobanana category, or grab the pack via ComfyUI Manager by searching "ComfyUI-Nanobanana". Dependencies are just httpx, pillow, and numpy - no model files, no VRAM.

The one thing that will bite you: an API key is mandatory, and it's configured outside the workflow. Copy config.example.json to config.local.json in the pack folder and fill in the key:

{
  "api_key": "your_token_here",
  "request_timeout": 60,
  "base_url": "https://generativelanguage.googleapis.com",
  "auth_mode": "x-goog-api-key",
  "send_seed": true
}

config.local.json is gitignored, so it won't leak if you fork the repo. Env vars (NANOBANANA_API_KEY, GEMINI_API_KEY) and a legacy config.ini still work as fallbacks, but the JSON file is the recommended path now - the old Client node that used to carry connection info in the workflow has been removed.

Common issues

  • 401/403 on every request - check the key, base_url, auth_mode, and that billing is actually enabled on the Google project. Gemini API credits from other Google surfaces don't always carry over; people have hit this.
  • 429 rate limits - Google throttles image generation hard. Wait it out or raise your quota; the node's error message says as much.
  • "Invalid value at generation_config.seed" - that's a relay complaining about a field it doesn't support. Set send_seed to false.
  • The filter ate your image - the model refuses and the node errors with the refusal text. That's Gemini, not the pack. Budget for re-prompting.

For a relay instead of Google's API, set base_url to the relay's Gemini-native endpoint and auth_mode to bearer - but that's a day-two problem. Get it working against Google first.

CategoryComfyUI-Nanobanana

Inputs (8)

NameTypeDefaultDescription
promptSTRING
seedINT420–18446744073709550000
aspect_ratioCOMBOauto11 options: auto, 1:1, 2:3, 3:2, 3:4, 4:3, +5
response_modeCOMBOIMAGE+TEXT2 options: IMAGE+TEXT, IMAGE
imagesoptIMAGE
system_promptoptSTRINGYou 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.
model_overrideoptSTRING
parallel_requestsoptINT11–8

Outputs (3)

NameTypeDescription
imageIMAGE
textSTRING
response_jsonSTRING