Nodes/ComfyUI_NanaBanana2/🍌 NB2 Text → Image
ComfyUI Node

🍌 NB2 Text → Image

Google's Nano Banana 2, inside ComfyUI (no GPU, just a GCP bill)

By tonykatarapro-web·Created 6 months ago·Updated 6 months ago· 3
🍌 NB2 Text → Image
    • image
    ◄promptA photorealistic portrait, soft studio lightingâ–ș
    ◄project_idâ–ș
    ◄locationus-central1â–ș
    ◄modelgemini-3.1-flash-image-previewâ–ș
    ◄aspect_ratio1:1â–ș
    ◄negative_promptâ–ș
    ◄access_tokenâ–ș
    ◄seed-1â–ș
    ◄use_search_groundingfalseâ–ș

    Nano Banana 2 - Google's Gemini 3.1 Flash Image model - is genuinely strong at photorealistic text-to-image, and this node drops it straight into a ComfyUI graph. The catch is in the pack's subtitle: it runs on Vertex AI, Google's cloud. No checkpoint to download, no VRAM to fill, no LoRA to train. You give it a prompt, a Google Cloud project, and it sends back an image - and a bill.

    That's the whole pitch. If you already run ComfyUI on a local GPU, this isn't a replacement for your local stack; it's a side channel for the days you want Google's instruction-following and photorealism without touching your own sampler. If you don't have a GPU, this is one of the few ways to get Nano Banana 2 quality inside the workflow you know instead of clicking around in ImageFX.

    How it works

    This is a thin wrapper in the good sense of the word. The node base64-encodes your prompt, POSTs it to the Vertex AI generateContent endpoint with a Bearer token, and decodes the base64 image that comes back into a ComfyUI IMAGE tensor. It uses the Python standard library plus the numpy/PIL/torch ComfyUI already ships - there's no requirements.txt at all, which tells you how little machinery is involved. Nothing runs on your machine except the HTTP call.

    The inputs that actually matter

    Only a few of them. The rest you'll touch once and forget.

    • prompt (multiline) - the image description. The default is "A photorealistic portrait, soft studio lighting," and honestly that's a fine starting point.
    • project_id - your Google Cloud project ID, the one with Vertex AI enabled and billing turned on. The node tries to default it from the GOOGLE_CLOUD_PROJECT env var; if it's empty you'll hit a project_id manquant error on your first run.
    • negative_prompt - here's the honest bit: Gemini doesn't have a real negative prompt. This node appends Do NOT include: 
 to your prompt text and hopes the model listens. It helps steer around obvious failure modes; it is not the negative prompt you know from Stable Diffusion, so don't expect surgical results.
    • model - default gemini-3.1-flash-image-preview (Nano Banana 2, fast and cheap). The other choice is gemini-3-pro-image-preview, aka Nano Banana Pro: 4K output and "thinking mode," at a noticeably higher price per image.
    • aspect_ratio - ten choices from 1:1 to 21:9. The output canvas follows this, so set it before you generate, not after.
    • use_search_grounding - lets the model search Google for current facts. Only worth it when your prompt depends on something recent; it's slower and costs more, so leave it off for art.

    Seed defaults to -1 (random). The single output, image, wires straight into Preview Image, Save Image, or any downstream node that wants an IMAGE.

    Installing it

    The whole pack, all three nodes, installs the same way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/tonykatarapro-web/ComfyUI_NanaBanana2
    

    Restart ComfyUI. Or use ComfyUI Manager, search "ComfyUI_NanaBanana2," and install from there. No pip packages, no model downloads.

    Getting the auth right (this is where people get burned)

    You need a Google Cloud account and a project with Vertex AI enabled. The node accepts a Bearer token three ways, in priority order: the access_token field on the node, the GOOGLE_CLOUD_ACCESS_TOKEN env var, or - if gcloud is installed - it calls gcloud auth print-access-token itself.

    export GOOGLE_CLOUD_ACCESS_TOKEN=$(gcloud auth print-access-token)
    

    The token dies after one hour. That's the #1 gotcha: it works, you walk away, you come back, and suddenly everything 401s. Regenerate with the command above and move on. Second gotcha: the pack's README insists location should be global for this model - if the default us-central1 returns a model-not-found error, switch to global.

    One more thing to know before you commit to this: it's Google's model with Google's content filters baked in. The pack doesn't expose Vertex's safetySettings, so you get the defaults, and those got stricter in January 2026. Every image also carries an invisible SynthID watermark. If your workflow depends on unfiltered output, this node is not your friend. If you just want a quick photorealistic portrait in your graph, it's great - as long as you remember it's a metered API, not a local model.

    CategoryNanaBanana2 / Vertex

    Inputs (9)

    NameTypeDefaultDescription
    promptSTRINGA photorealistic portrait, soft studio lighting—
    project_idSTRINGTon GCP Project ID
    locationCOMBOus-central18 options: global, us-central1, us-east1, us-west1, europe-west1, europe-west4, +2
    modelCOMBOgemini-3.1-flash-image-preview2 options: gemini-3.1-flash-image-preview, gemini-3-pro-image-preview
    aspect_ratioCOMBO1:110 options: 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, +4
    negative_promptSTRING—
    access_tokenoptSTRINGBearer token Vertex AI. Si vide : 1. GOOGLE_CLOUD_ACCESS_TOKEN env var 2. gcloud auth print-access-token
    seedoptINT-1-1–2147483647—
    use_search_groundingoptBOOLEANfalse—

    Outputs (1)

    NameTypeDescription
    imageIMAGE—