Nodes/ComfyUI-MoonNodes/♊ Gemini Persistent Chat
ComfyUI Node

♊ Gemini Persistent Chat

Talk to Gemini from inside your graph, with memory that survives

By m0rtus59·Created 3 months ago·Updated 9 days ago· 8
♊ Gemini Persistent Chat
  • image
  • advanced_settings
  • text
  • thoughts
  • full_history
api_key
model_name
system_instructionExpert prompt engineer.
user_prompt
seed0
enable_ai_processingtrue

This is the heart of MoonNodes' LLM side: a real, native connection to the Google Gemini API that behaves like a chat session instead of a one-shot text node. Type a message, get a reply, send another message - and the model still remembers what you said two turns ago. It's the node that turns "have an LLM help you write prompts" from a novelty into something you'll actually build workflows around.

Why it feels different

Most ComfyUI LLM nodes are stateless: one call in, one answer out, and the next run starts from zero. GeminiPersistentChat keys its conversation to the seed input, and as long as you keep the same seed, the conversation history stays alive in memory. Change the seed and you start a fresh conversation. That one trick - seed as conversation ID - is why the pack's chat workflow can do actual back-and-forth prompt engineering instead of single-shot Q&A.

It's also multimodal. The optional image input accepts an IMAGE tensor from anywhere in your graph, so you can feed Gemini the image you just generated and ask "what's wrong with the hands?" in the same workflow that made it. The node converts the tensor to a PIL image, and it dedupes by image hash so re-running doesn't spam the API with identical images.

The inputs that matter

  • api_key - your Google AI Studio key. There's no key file, no environment variable; you paste it into the widget. Don't share workflows that still contain a real key.
  • model_name - a dropdown built from the pack's models.txt file, which lives in the ComfyUI-MoonNodes folder. Edit that file (one model name per line, # for comments) to change what's on the menu.
  • system_instruction - defaults to "Expert prompt engineer." Set this to steer the model's role.
  • user_prompt - your message.
  • seed - the conversation ID. Keep it fixed for a persistent chat.
  • enable_ai_processing - the pause switch. Flip it off and the node returns your last response with a "⚠️ AI Processing is PAUSED" banner instead of calling the API. This is what the LLM Submit Input node drives.
  • advanced_settings (optional) - the bundle from Gemini Advanced Settings.

Three outputs, all strings: text (the actual reply), thoughts (the model's reasoning stream, if thinking is enabled - the node works hard to separate it from the answer, including handling a couple of SDK quirks where thoughts leak through as THOUGHT:-prefixed text or <think> tags), and full_history (the whole conversation formatted for display or saving).

Install

This is the one node in the pack with a real dependency - the Google Gemini SDK:

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

Restart ComfyUI. No model downloads; the models are Google's API-side. You do need an API key, and yes, this is a paid API.

Where people get stuck

Errors come back as text, not as node crashes: no key gives you "Missing API Key", a bad call gives you "Gemini API Error: ..." in the text output. Read the output string before assuming the node is broken. And remember the persistence caveat - the history lives in process memory, so restarting ComfyUI wipes the conversation even if the seed stays the same. "Persistent" here means "within a session," not "forever." Also: the model dropdown won't show new model names until the models.txt file is updated, and if you switch models mid-chat the node transparently rebuilds the session and migrates the history - nice, but don't be surprised when a model change feels like a reset in behavior.

CategoryMoonNodes

Inputs (8)

NameTypeDefaultDescription
api_keySTRING
model_nameCOMBO13 options: gemini-pro-latest, gemini-flash-latest, gemini-flash-lite-latest, gemini-3.7-flash, gemini-3.6-flash, gemini-3.5-flash-lite, +7
system_instructionSTRINGExpert prompt engineer.
user_promptSTRING
seedINT00–18446744073709550000
enable_ai_processingBOOLEANtrue
imageoptIMAGE
advanced_settingsoptGEMINI_SETTINGS

Outputs (3)

NameTypeDescription
textSTRING
thoughtsSTRING
full_historySTRING