Nodes/ComfyUI-Gemini/✨Gemini_API_Zho
ComfyUI Node

✨Gemini_API_Zho

The original Gemini node, with the key you must never share

By ZHO-ZHO-ZHO·Created 3 years ago·Updated 2 years ago· 789
✨Gemini_API_Zho
  • image
  • text
promptWhat is the meaning of life?
model_name
streamfalse
api_key

This is where the whole pack started. Gemini_API_Zho is the original one-shot node ZHO built back in December 2023 - the class name matches the repo for a reason - and it's the fullest of the three "basic" Gemini nodes: all three models, optional image input, streaming, and your API key typed directly into a widget. One prompt in, text out.

Compared to its ㊙️ twin (Gemini_Zho), the only real difference is key handling. Here you paste the key into the api_key input on the node itself. That's genuinely convenient for a quick test, but it's also the one thing you must not forget about: ComfyUI stores workflows inside output images. Put this node in a workflow, save an image, share it, and your key is in the metadata for anyone to find. The README's warning is unambiguous - don't share workflows containing these explicit-key nodes.

How it works

The mechanism is the pack's standard: google.generativeai picks whichever model you chose and calls generate_content. The optional image input converts a ComfyUI tensor to a PIL image on the fly and sends it as a second part, which is what enables the vision models. If you pick gemini-pro-vision without an image connected, the node errors out with "gemini-pro-vision needs image."

Inputs that matter

  • model_name - gemini-pro (text only), gemini-pro-vision (requires the image input), or gemini-1.5-pro-latest (works either way; the best all-rounder).
  • prompt - your request. Default is the pack's recurring "What is the meaning of life?"
  • api_key - your key, right there in the graph.
  • stream - off is fine for normal use.

The text output feeds DisplayText_Zho or goes straight into a prompt-to-image pipeline - the classic loop being "Gemini writes a rich prompt, your SD sampler draws it."

Install

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 ComfyUI; the only dependency is google-generativeai > 0.4.1.

Common issues

  • "API key is required" - the api_key widget is empty. This node has no fallback; a key must be in the widget.
  • Key leaking - the real hazard. If you've shared anything from this node, check and rotate the key at Google AI Studio.
  • Rate limits - free-tier 1.5 Pro is roughly 2 requests/minute, 1000/day at launch; batch work trips this fast.
  • Connectivity - it's a hosted call; no path to Google means failures even with a valid key (the author recommends Colab or Kaggle for flaky connections).

And the honest take: for anything beyond a quick test, use the ㊙️Gemini_Zho version instead. It does the same job with the key living in config.json, out of the workflow and out of your saved PNGs.

CategoryZho模块组/✨Gemini

Inputs (5)

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

Outputs (1)

NameTypeDescription
textSTRING