Gemini_API_Image☀
Google's image model, called straight from your graph — no local GPU required
- image_1
- image_2
- image_3
- image_4
- image_5
- image_6
- image_7
- image_8
- image_9
- image_10
- image_11
- image_12
- image_13
- image_14
- image
- text
Every so often you want a generation that your local GPU just can't produce - a Gemini-class image model, running entirely in the cloud. Gemini_API_Image wraps Google's image generation API in a node, so it plugs into a ComfyUI graph like any other generator: prompt in, IMAGE tensor out. No checkpoint download, no VRAM pressure, no local model at all. If you've got a Gemini API key, this is the least-friction way to mix cloud generations into a local workflow.
The node's default model, gemini-3-pro-image-preview, is the "Nano Banana Pro" flagship the community talks about: 4K-native output, up to 14 reference images, and a thinking mode - which is exactly why the node exposes those inputs. Google's own branding calls it the image model to beat; the node just puts it in your graph.
How it works
The node uses the official google-genai Python library. It builds a request with your prompt, an aspect ratio, a resolution, and optionally up to 14 reference images (which act as image-to-image conditioning - you can feed it a person, a product shot, a style reference, and ask for variations). The request runs in a background thread so ComfyUI stays responsive, and it actually checks for your interrupt: cancel the Queue and the node returns a "Task cancelled" message instead of wasting your tokens. Responses come back with both an image and text, and the node returns both.
That interrupt handling is a genuinely thoughtful touch for an API node - most cloud nodes in this space just hang until the request finishes, and here a misclicked prompt doesn't cost you a full generation.
Inputs
- API_Key - required, from Google AI Studio.
- prompt - what you want generated.
- model_name - default
gemini-3-pro-image-preview; change it as new model versions land. - aspect_ratio - 10 presets from 1:1 to 21:9, default 5:4. There's also an optional aspect_ratio_text field that overrides the dropdown if you need something custom.
- resolution - 1K / 2K / 4K, default 2K.
- thinking_mode - toggles the model's thinking config where the API supports it.
- noise_seed - passed through when set; useful for reproducible runs.
- image_1 … image_14 - optional reference images, wired in like any IMAGE input.
Outputs: image (an IMAGE tensor you can preview, save, or feed onward) and text (the model's text reply).
Gotchas
- The key is the whole security model. It lives in the workflow; treat it like a password.
google-genaiinstall is fiddly. The pack depends on it, and the node's own error message calls out the classic failure: the baregooglepackage can shadowgoogle-genaiand break the import. If you hit that, the fix is:
pip uninstall -y google
pip install -U google-genai
- Cloud generation costs money and has content policies. This is not your uncensored local Z-Image. For anything your local box can do, it should.
- Empty responses are handled. If the API returns no image, you get a 1×1 placeholder tensor plus an error string in
textrather than a crash.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Hasasasa/ComfyUI_DashuaiTools
cd ComfyUI_DashuaiTools
pip install -r requirements.txt
then restart ComfyUI, or install via ComfyUI Manager. Note google-genai is in the pack's requirements, so Manager handles it.
Use it when you want a Gemini-quality result in a graph that otherwise runs locally - mix it with SaveImageWithName for deterministic output names and it slots right into a production pipeline.
Inputs (22)
| Name | Type | Default | Description |
|---|---|---|---|
| API_Key | STRING | <your_key> | — |
| prompt | STRING | — | |
| model_name | STRING | gemini-3-pro-image-preview | — |
| aspect_ratio | COMBO | 5:4 | 10 options: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, +4 |
| resolution | COMBO | 2K | 3 options: 1K, 2K, 4K |
| thinking_mode | BOOLEAN | false | — |
| noise_seed | INT | 00–18446744073709550000 | — |
| aspect_ratio_textopt | STRING | — | |
| image_1opt | IMAGE | — | |
| image_2opt | IMAGE | — | |
| image_3opt | IMAGE | — | |
| image_4opt | IMAGE | — | |
| image_5opt | IMAGE | — | |
| image_6opt | IMAGE | — | |
| image_7opt | IMAGE | — | |
| image_8opt | IMAGE | — | |
| image_9opt | IMAGE | — | |
| image_10opt | IMAGE | — | |
| image_11opt | IMAGE | — | |
| image_12opt | IMAGE | — | |
| image_13opt | IMAGE | — | |
| image_14opt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| text | STRING | — |