✨Gemini_API_Zho
The original Gemini node, with the key you must never share
- image
- text
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), orgemini-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_keywidget 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.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | What is the meaning of life? | — |
| model_name | COMBO | 3 options: gemini-pro, gemini-pro-vision, gemini-1.5-pro-latest | |
| stream | BOOLEAN | false | — |
| api_key | STRING | — | |
| imageopt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |