ComfyUI Extension: Better-Gemini
A better node for using Google Gemini models, supporting the latest API endpoints with a v3 ComfyUI node interface.
Custom Nodes (0)
README
ComfyUI Better Gemini
Custom ComfyUI node(s) for generating images with Google Gemini via the official google-genai Python SDK.
Install
- Clone into your ComfyUI
custom_nodesdirectory:cd /path/to/ComfyUI/custom_nodesgit clone https://github.com/<you>/ComfyUI-Better-Gemini.git
- Install Python deps (network required):
pip install -r ComfyUI-Better-Gemini/requirements.txt
- Set an API key (recommended):
export GOOGLE_API_KEY="..."(orGEMINI_API_KEY)
- Restart ComfyUI.
Nodes
Better Gemini(image)- Inputs: prompt, model (dropdown; populated via
models.list()), prompt_images (optional), aspect ratio, resolution / width+height, temperature, top_p/top_k, max tokens, thinking difficulty, seed. - Outputs:
IMAGE,STRING(any returned text / notes).
- Inputs: prompt, model (dropdown; populated via
Example Workflow

Notes
- The node imports
google-genailazily so ComfyUI can still boot even if dependencies aren’t installed yet; execution will raise a clear error until installed. - This extension uses ComfyUI’s V3 extension loader (
comfy_entrypoint). - The
modeldropdown is populated viaclient.models.list()(filtered to models supportinggenerateContent). It requires an API key viaGOOGLE_API_KEY/GEMINI_API_KEY; otherwise it falls back to a single default model and logs a warning. - Gemini requires
seedto fit in anint32; larger ComfyUI seeds are deterministically folded viaseed % 2**31. resolution/aspect_ratioare best-effort (model-dependent). For models that support it (e.g.gemini-3-pro-image-preview), the node sendsgenerationConfig.imageConfigwithimageSize/aspectRatio; it logs a warning if the returned size doesn’t match (no auto-resize).- If Gemini returns no images (blocked or a text-only model), the node returns a blank placeholder image and includes a note in the
STRINGoutput (and logs a warning).
Dev
- Run unit tests:
python -m unittest discover -s tests -p 'test_*.py' -v