Nodes/ComfyUI-Gemini/✨Gemini_API_Chat_Zho
ComfyUI Node

✨Gemini_API_Chat_Zho

The chat node with your key in the widget — and one bug to know about

By ZHO-ZHO-ZHO·Created 3 years ago·Updated 2 years ago· 784
✨Gemini_API_Chat_Zho
  • image
  • response
promptWhat is the meaning of life?
model_name
api_key

Gemini_API_Chat_Zho is the explicit-key twin of the pack's chat family: a multi-turn chatbot node where you type your API key straight into a widget instead of stashing it in config.json. If you've ever wanted to hold a proper back-and-forth with Gemini inside a ComfyUI graph - run a message, get an answer, run another, and have it remember the thread - this is the node.

But here's the honest framing: this is the one node in the pack I'd steer you away from as a default, for two separate reasons. First, security - the api_key input sits in the node, and ComfyUI workflows get embedded in saved PNGs. Share one output image and you've shared your key. The README says this in plain terms: don't share workflows with these nodes in them. Second, there's a real bug in the shipped code.

The bug you'll hit with 1.5 Pro

The node advertises two models - gemini-pro and gemini-1.5-pro-latest - and an optional image input. But look at the shipped generate_chat function: it accepts prompt, model_name, and api_key, and then the 1.5 Pro code path checks if image == None... on a variable that was never passed in. Pick gemini-1.5-pro-latest and you get a NameError crash, not a model call. gemini-pro works fine - that branch never touches the phantom variable.

So the practical guidance: if you need this node, run it on gemini-pro. If you need 1.5 Pro with chat, use Gemini_15P_Chat_Advance_Zho instead - same system-instruction-and-chat feature set, and its code actually receives the image parameter it checks.

How it works and what it outputs

Under the hood it's model.start_chat(history=[]) held on the node, then chat.send_message(prompt) per run. Note the output named response is actually the formatted chat history - role lines and dashes, the whole transcript - not just the latest answer. Wire it to DisplayText_Zho and you watch the conversation grow.

Inputs and install

  • prompt - your message.
  • model_name - gemini-pro (works) or gemini-1.5-pro-latest (crashes; see above).
  • api_key - the key, right there in the widget.
  • image (optional) - wired to the same broken 1.5 Pro path in this node.
cd ComfyUI/custom_nodes
git clone https://github.com/ZHO-ZHO-ZHO/ComfyUI-Gemini.git
cd ComfyUI-Gemini
pip install -r requirements.txt

Then restart and find it under "Zho模块组/✨Gemini". Chat state lives on the node while ComfyUI runs - there's no reset widget, so a fresh conversation means a new node or a restart. And if you're not wedded to explicit keys, the ㊙️Gemini_Chat_Zho variant does the same thing with the key out of the workflow.

CategoryZho模块组/✨Gemini

Inputs (4)

NameTypeDefaultDescription
promptSTRINGWhat is the meaning of life?
model_nameCOMBO2 options: gemini-pro, gemini-1.5-pro-latest
api_keySTRING
imageoptIMAGE

Outputs (1)

NameTypeDescription
responseSTRING