Nodes/ComfyUI FSL Nodes/FSL Gemini Chat (Unified SDK)
ComfyUI Node

FSL Gemini Chat (Unified SDK)

FSL Gemini Chat — the 'creative director' that decides image vs video for you

By fredlef·Created about a year ago·Updated 9 months ago· 13
FSL Gemini Chat (Unified SDK)
  • image_input
  • LATEST_REPLY
  • IMAGE_PROMPT
  • VIDEO_PROMPT
  • CONVERSATION_HISTORY
api_key
promptHello, Gemini.
session_idchat_01
model_namegemini-1.5-flash
reset_chatfalse
enhance_hooktrue
debug_modelsfalse

The whole Gemini & Veo half of Fred LeFevre's FSL pack is built around this node. FSLGeminiChat is the "Creative Director": a chat agent with memory that doubles as a prompt-engineering router. You talk to it, and it decides - via a hidden text hook - whether your request means "make an image," "make a video," or "just answer me." The idea is you stop hand-crafting prompts and let the model write the technical prompt for the generator downstream.

How it works

The node keeps a per-session_id conversation in memory (CHAT_SESSIONS), so it behaves like a chatbot with context, not a stateless API call. When enhance_hook is on, the system instruction gives Gemini a dual role: chat normally, but if you ask for a static image it emits a block starting with IMG_HOOK:, and if you ask for video or animation it emits VID_HOOK:. If you're just chatting, it emits neither.

The node then parses those hooks into separate outputs. That split is the clever bit - it prevents the double-generation problem where a workflow would trigger both the image generator and the Veo generator for one request. The IMAGE_PROMPT output only fills when the reply contains an image hook; VIDEO_PROMPT only fills for video. Wire them to the respective generators, and only one ever gets a non-empty prompt.

There's also vision: connect an image to the optional image_input and it's sent alongside your text, which is how the "animate this person" image-to-video workflows get the model to describe the subject.

The outputs

  • LATEST_REPLY - the clean chat text (hooks stripped out).
  • IMAGE_PROMPT - the technical prompt to feed FSLGeminiImageGenerator or FSLGeminiGenerateImage.
  • VIDEO_PROMPT - the prompt to feed FSLVeoGenerator.
  • CONVERSATION_HISTORY - a formatted text log of the session, handy for display.

Inputs worth setting

  • session_id - your chat's memory bucket. Different IDs = separate conversations.
  • reset_chat - flip to true to wipe that session's memory (it clears it, so remember to flip back).
  • enhance_hook - Agent Mode on by default. Turn it off for "Raw Mode," where Gemini only adds hooks when told to generate.
  • model_name - defaults to gemini-1.5-flash, cheap and fast; gemini-3-pro-preview is in the list if you want the smart one.
  • debug_models - prints hook detection to the console. Leave on while you're building the workflow.

Install & key

Same as the rest of the pack: Manager → "ComfyUI FSL Nodes", or clone into custom_nodes and pip install google-genai. No local models - this is a cloud node, and it needs a Gemini API key (widget or GEMINI_API_KEY/GOOGLE_API_KEY env var).

Where people get burned

The common failure is an empty IMAGE_PROMPT/VIDEO_PROMPT and you can't figure out why. That's the gatekeeper working as designed: if Gemini decided you were just chatting, the hooks never fire and the outputs stay empty - the downstream generators then "sleep" (return blank/None, zero cost). If you expected a hook and didn't get one, rephrase the request as an explicit command ("create an image of…"). And if you're getting "Gemini API Error" text in LATEST_REPLY, that's a caught exception flowing through the STRING output - check the key first, then your billing, and look at the console for the real message.

CategoryFSL Nodes

Inputs (8)

NameTypeDefaultDescription
api_keySTRING
promptSTRINGHello, Gemini.
session_idSTRINGchat_01
model_nameCOMBOgemini-1.5-flash4 options: gemini-1.5-flash, gemini-1.5-pro, gemini-2.0-flash-exp, gemini-3-pro-preview
reset_chatBOOLEANfalse
enhance_hookBOOLEANtrue
debug_modelsBOOLEANfalse
image_inputoptIMAGE

Outputs (4)

NameTypeDescription
LATEST_REPLYSTRING
IMAGE_PROMPTSTRING
VIDEO_PROMPTSTRING
CONVERSATION_HISTORYSTRING