Nodes/ComfyUI_Nano_Banana/Nano Banana 2 Multi-Turn Chat
ComfyUI Node

Nano Banana 2 Multi-Turn Chat

Keep editing the same image, turn after turn

By ru4ls·Created 12 months ago·Updated 6 months ago· 60
Nano Banana 2 Multi-Turn Chat
  • image_1
  • image_2
  • image_3
  • image_4
  • image_5
  • image_6
  • image_7
  • image_8
  • image_9
  • image_10
  • image_11
  • image_12
  • image_13
  • image_14
  • image
  • response_text
  • metadata
  • chat_history
model_namegemini-3.1-flash-image-preview
promptCreate an image of a clear perfume bottle sitting on a vanity.
reset_chatfalse
use_searchfalse
use_image_searchfalse
aspect_ratio1:1
image_size2K
temperature1.0

You know the loop. Generate an image, look at it, want a tiny change, but the AIO node has already forgotten everything you did. NanoBanana2MultiTurnChat exists to kill that loop: it keeps the conversation - and the last image it made - alive in memory, so you can tell it "change the background to a sunset beach," then "add water droplets," then "close up on the bottle," and each run builds on the last.

It's part of the ru4ls/ComfyUI_Nano_Banana pack, and it's the chat version of the pack's Nano Banana 2 side, running the fast gemini-3.1-flash-image-preview model. Everything's still cloud-side - paid API calls, no local model - but for iterative editing the conversational interface is genuinely the right tool, because the model gets the previous image back as a reference rather than you manually re-feeding generations.

How it works

The trick is state, and it lives inside the node instance. When you run it, the node remembers the last image it generated (last_image_data) and a full conversation_history list. On the next run it injects that previous image back into the request alongside your new prompt, so the model is literally editing what it just made. Flip reset_chat to True and both get wiped for a fresh start.

That in-memory design has one practical consequence you should internalize: duplicate the node and you get a blank history. Copy the node to "reset" it visually and it won't remember anything the original did. Same after a ComfyUI restart. There's no persistence to disk - if you want to keep a thread going, keep using the same node instance, and use reset_chat when you want out.

The inputs that matter

  • prompt - each run is a new instruction in the ongoing thread.
  • reset_chat - the kill switch. Toggle to True once to wipe history and start over.
  • use_search / use_image_search - web and image grounding; the image variant needs use_search on. Both default off here.
  • image_1 through image_14 - reference images for the start of a conversation (up to 10 objects + 4 characters, per the model's design). After the first turn, the node's own output becomes the reference.
  • aspect_ratio - all 15 options including the extreme 1:4, 1:8, 4:1, 8:1 and Auto.
  • image_size - 512px through 4K; the cheap 512px drafts are a great fit for rapid multi-turn exploration.

Outputs: image (the latest result), response_text (the model's words, which matter when it refuses or explains), metadata (finish reason + safety ratings), and chat_history (the full thread as a string). Wire image into PreviewImage or SaveImage.

Installing

It's a node in the ComfyUI_Nano_Banana pack - the install is identical to the other three nodes in this pack. ComfyUI Manager: search "ComfyUI_Nano_Banana". Or manual:

cd ComfyUI/custom_nodes
git clone https://github.com/ru4ls/ComfyUI_Nano_Banana.git
pip install -r ComfyUI_Nano_Banana/requirements.txt
pip install google-genai --upgrade   # required for Nano Banana 2 nodes

Then drop a GOOGLE_API_KEY (Gemini API) or PROJECT_ID + LOCATION (Vertex AI) into the pack's .env - copy .env.api.template or .env.vertexai.template to get started. The pack auto-detects which you've configured.

Gotchas

  • Every turn is a paid API call. A five-turn edit chain is five generations on your bill. Keep the first passes at 512px/1K and only spend on 4K for the final.
  • History is volatile. It's node-instance memory, not saved state. Restart ComfyUI, or duplicate the node, and the thread is gone.
  • Search toggles default off - if the model isn't grounded, that's why.
  • Same family filters as the rest of Nano Banana. Google's safety filtering is aggressive here; the model will refuse a whole class of edits without drama.
  • Old google-genai breaks this node - the SDK must be current or the NB2 request tooling errors out.

If you want the same conversational flow but with the highest-quality Pro model instead of the fast one, the pack's older NanoBananaMultiTurnChat node does exactly that. This one's the speed pick.

CategoryRu4ls/NanoBanana

Inputs (22)

NameTypeDefaultDescription
model_nameCOMBOgemini-3.1-flash-image-preview1 options: gemini-3.1-flash-image-preview
promptSTRINGCreate an image of a clear perfume bottle sitting on a vanity.
reset_chatBOOLEANfalse
use_searchBOOLEANfalse
use_image_searchBOOLEANfalse
aspect_ratioCOMBO1:115 options: 1:1, 1:4, 1:8, 2:3, 3:2, 3:4, +9
image_sizeCOMBO2K4 options: 512px, 1K, 2K, 4K
temperatureFLOAT1.00–2
image_1optIMAGE
image_2optIMAGE
image_3optIMAGE
image_4optIMAGE
image_5optIMAGE
image_6optIMAGE
image_7optIMAGE
image_8optIMAGE
image_9optIMAGE
image_10optIMAGE
image_11optIMAGE
image_12optIMAGE
image_13optIMAGE
image_14optIMAGE

Outputs (4)

NameTypeDescription
imageIMAGE
response_textSTRING
metadataSTRING
chat_historySTRING