Nodes/ComfyUI_Gemini3ProImagePreview/Nano Banana Pro (Gemini 3 Pro Image)
ComfyUI Node

Nano Banana Pro (Gemini 3 Pro Image)

Nano Banana Pro inside ComfyUI — 4K Gemini images without a consumer GPU

By Ametist3d·Created 6 months ago·Updated 6 months ago· 1
Nano Banana Pro (Gemini 3 Pro Image)
  • images
  • mask
  • chat_metadata
  • images
  • text
  • chat_metadata
prompt
modelgemini-3-pro-image-preview
seed0
aspect_ratioauto
resolution1K
response_modalitiesIMAGE+TEXT
temperature1.00
enable_google_searchfalse
search_modeweb
thinking_leveldefault
include_thoughtsfalse
person_generationdefault
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.

Nano Banana Pro (Gemini 3 Pro Image) is the headline node in Ametist3d's pack, and it does exactly what it says: pipes Google's flagship image model straight into your ComfyUI graph. One 4096×4096 4K render, no checkpoint, no VRAM, no controlnet pile - the diffusion happens on Google's servers and the result lands as a normal IMAGE tensor you can save, upscale, or feed into a LoRA training pipeline.

If you've seen people generating character sheets and LoRA datasets with Nano Banana, this is how they run it from inside ComfyUI. It's an API node: nothing is downloaded, and every generation costs money and needs a Gemini API key. It also speaks three models - gemini-3-pro-image-preview (Nano Banana Pro, the default), gemini-3.1-flash-image-preview (Nano Banana 2), and gemini-2.5-flash-image (Nano Banana) - and sanitizes settings per model so you can't send something the API will reject.

How it works

No local sampling here. The node builds a request with pydantic models and POSTs it to Gemini's generateContent endpoint over aiohttp: your prompt, base64-encoded input images (up to 14), optional mask, imageConfig for aspect ratio and resolution, a seed, and optional Google Search grounding tools. It then extracts the returned images back into tensors and - this is the nice part - enforces your chosen resolution locally, resizing the output to match the pixel budget even when the API returns input dimensions on an edit. Multi-turn refinement is handled by chat_metadata: wire the output back into the input and you keep editing the same image conversationally.

Inputs and outputs that matter

  • prompt - the whole game. For edits, this is where you describe the change.
  • model - 3 Pro Image by default; 3.1 Flash unlocks 0.5K, extended aspect ratios, thinking level, and image-search grounding.
  • aspect_ratio - auto matches your input image or falls back to 1:1. Unsupported ratios are sanitized per model.
  • resolution - pixel-area budget, 0.5K through 4K. Gotcha: 0.5K only works on 3.1 Flash (Pro silently bumps it to 1K), and 2K/4K only on Pro.
  • seed - set it for reproducibility; 0 is random. Google treats the seed as "best effort," not a guarantee.
  • images and mask - wire in a reference image for edit/refine, or a mask for inpainting (white areas get edited).
  • response_modalities - IMAGE+TEXT (default) returns the image and a text caption/explanation; IMAGE skips the prose.
  • system_prompt - comes prefilled with a "you must ALWAYS produce an image" instruction. Leave it alone unless you know why you're touching it.

Outputs: images (into Preview Image / Save / anything downstream), text (the model's written response), and chat_metadata (loop back into the input to keep refining).

Installing it

Shared with the pack's LLM node: Manager (search "Gemini3ProImagePreview") or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/Ametist3d/ComfyUI_Gemini3ProImagePreview
cd ComfyUI_Gemini3ProImagePreview
pip install -r requirements.txt

Restart after. Real runtime deps are just aiohttp plus Pillow/numpy/torch - the listed google-generativeai is never imported.

The API key gotcha

The README says setx GEMINI_API_KEY - ignore it, the code never reads the OS environment. It loads the key from ~/comfyui_google_api_key.env first, then a .env file in the node folder containing GEMINI_API_KEY=.... So:

echo 'GEMINI_API_KEY=AIza...' > ~/comfyui_google_api_key.env

Restart, and you're live. A missing key raises a clear ValueError naming both paths.

What will bite you

Pricing is the first wall: Nano Banana Pro runs roughly $0.039–$0.24 per image depending on resolution, and Google Search grounding adds more. Second is censorship - the knowledge base notes the January 2026 safety-policy tightening, and this API is aggressively filtered; content it flags comes back empty. Relatedly, if you get a solid-black output tensor, that's the node's placeholder for "API returned no images" - usually a safety block, not a bug. And expectations: reviewers call Pro powerful but "unimaginative" and prone to hidden bias, so treat it as a tool, not a replacement for your local stack.

Categoryapi node/image/Gemini

Inputs (16)

NameTypeDefaultDescription
promptSTRINGText prompt describing the image to generate or the edits to apply. Include any constraints, styles, or details the model should follow.
modelCOMBOgemini-3-pro-image-previewGemini model to use for image generation/editing.
seedINT00–2147483647When seed is fixed to a specific value, the model makes a best effort to provide the same response for repeated requests. Set to 0 for random seed. Max value: 2147483647.
aspect_ratioCOMBOautoOutput aspect ratio. 'auto' matches input image or defaults to 1:1. Note: aspect_ratio is applied when supported by the selected model.
resolutionCOMBO1KTarget output resolution. Note: 2K/4K (imageSize) is supported by gemini-3-pro-image-preview; for gemini-2.5-flash-image this setting is ignored.
response_modalitiesCOMBOIMAGE+TEXTChoose 'IMAGE' for image-only output, or 'IMAGE+TEXT' to return both the generated image and a text response.
temperatureFLOAT1.000–2Controls randomness in generation. Higher values = more creative.
enable_google_searchBOOLEANfalseEnable Google Search grounding (web).
search_modeCOMBOwebFor gemini-3.1-flash-image-preview you can also enable Image Search grounding.
thinking_levelCOMBOdefaultOnly applies to gemini-3.1-flash-image-preview. Default is minimal.
include_thoughtsBOOLEANfalseReturn thought parts in the response (we still filter thought images from outputs).
person_generationCOMBOdefaultOptional safety control for generating people (only if supported by the backend).
imagesoptIMAGEOptional reference image(s) for editing or style transfer. To include multiple images, use the Batch Images node.
maskoptMASKOptional mask for inpainting. White areas will be edited.
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.System instructions that guide the model's behavior.
chat_metadataoptGEMINI_CHAT_METADATAOptional conversation metadata from a previous generation. Connect to enable chat/refine mode for iterative editing.

Outputs (3)

NameTypeDescription
imagesIMAGE
textSTRING
chat_metadataGEMINI_CHAT_METADATA