㊙️Gemini_Zho
Google Gemini in ComfyUI, without your key living in every workflow
- image
- text
This is the node people actually mean when they say "run Gemini in ComfyUI." ㊙️Gemini_Zho takes a prompt, calls Google's Gemini API, and hands you back text - which you can use for prompt engineering, image captioning, batch relabeling a dataset, or the whole "Gemini writes the prompt, SD draws the picture" pipeline. The emoji isn't decoration: the ㊙️ marks this as the implicit-key variant, the one that reads your API key from a local config file instead of baking it into the workflow.
The pack is by ZHO-ZHO-ZHO, one of the most prolific Chinese ComfyUI node developers - he's the same person behind ComfyUI-Zhipu, ComfyUI-Florence-2, and the rest of the "AI studio in a graph" packs. ComfyUI-Gemini is his take on connecting the node graph to a hosted LLM: you get a large model without needing the VRAM for it, and it's free (rate-limited) on the Google free tier. The catch is the key management, which this node is built to solve.
How it works
The "S" in the class name stands for secret. When ComfyUI loads the pack, Gemini_API_S_Zho pulls your key from custom_nodes/ComfyUI-Gemini/config.json. On first load the pack auto-creates that file with the placeholder "your key" - so step one is opening it and putting a real key in, from Google AI Studio. Note the README says "environment variable," but the shipped code actually reads config.json, not an env var. Don't go hunting for an env var that isn't there.
Under the hood it's a thin wrapper over google.generativeai: pick a model, call generate_content(prompt), return the text. The optional image input gets converted from a ComfyUI tensor to a PIL image and sent along as a second part, which is what makes the vision models work.
Inputs that matter
- model_name - your real choice:
gemini-pro(text only),gemini-pro-vision(needs an image), orgemini-1.5-pro-latest(accepts text with or without an image). Pick vision with no image connected and the node throws "gemini-pro-vision needs image." - prompt - the actual thing you're asking. Default is a philosophical "What is the meaning of life?" - you'll want to change it.
- stream - off by default. Streaming just means the response is assembled from chunks; for normal use leave it off.
The single text output is a STRING. Wire it into DisplayText_Zho to actually read it in the UI, or feed it straight into a CLIP text encoder as your prompt. For a full loop: Gemini describes/expands → you get a prompt → that drives your sampler.
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. requirements.txt is just google-generativeai>0.4.1 - the one real dependency (1.5 Pro needs the newer SDK). ComfyUI Manager also finds it if you search "ComfyUI-Gemini."
Common issues
- "API key is required" - the config key is still
"your key", or the file isn't reachable. Editconfig.jsonand restart. - Needs internet to Google - this is a hosted API, full stop. The author flat-out recommends running on Colab or Kaggle if your connection to Google's services is unreliable, and that advice exists because in some regions it is blocked.
- Rate limits - the free tier is aggressive: at launch, roughly 2 requests/minute and 1000/day on 1.5 Pro. Batch tagging jobs will hit this. Space out your queue.
- Old "Deadline of 60.0s" errors were fixed in V2.1 - keep
google-generativeaiupdated rather than pinning it.
Inputs (4)
| 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 | — |
| imageopt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |