Gemini Image Generator
Nano Banana and Imagen 4 inside ComfyUI
- image1
- image2
- image3
- image4
- image5
- image
- response_text
This one actually generates pictures - which sets it apart from the pack's other Gemini node, GeminiAPI, that only returns text. You give it a prompt, it calls Google's image models, and it hands back an image straight into your ComfyUI graph. The draw is that these are strong closed-source models you otherwise can't run locally: gemini-2.5-flash-image (the model the internet calls "Nano Banana," which is excellent at conversational, reference-guided editing) and imagen-4.0-generate-001 (Google's high-fidelity Imagen). If you want a Google-quality generation or edit without leaving your workflow, this is the node.
What makes it different from a normal KSampler
Worth being clear-eyed: this is not your local diffusion model painting a latent. It's an API call. The image is generated on Google's servers and downloaded back, so it costs money against your Google account, needs a network connection, and is subject to Google's content filters - none of which apply to a local checkpoint. What you get in exchange is model quality that's hard to match locally and, on the Nano Banana model, genuinely good instruction-following edits. It slots into a graph like any image source, but under the hood it's closer to "fetch from an API" than "run a sampler."
How the reference images work
The image1–image5 inputs are the interesting part. Feed in reference images and the model uses them to guide generation - keep a character consistent across shots, transfer a style, or edit an existing picture by describing the change instead of masking it. That mask-free, "just tell it what to change" editing is exactly what the Nano Banana model is known for, and it's the reason you'd pick this over a plain text-to-image call.
The inputs and outputs that matter
prompt- your description. These are LLM-grade models, so plain-language instructions work better than a pile of tags.model-gemini-2.5-flash-image-preview(Nano Banana; fast, great at edits and reference use) orimagen-4.0-generate-001(Imagen 4; peak fidelity for pure text-to-image). Start with Nano Banana for editing, Imagen for a clean from-scratch render.aspect_ratio-1:1,3:4,4:3,9:16,16:9.image_size-1Kor2K.negative_prompt(optional) - things to avoid. How much these API models honor it varies; don't lean on it the way you would on SDXL.image1–image5(optional) - reference/edit inputs, above.
Outputs: image (into a Save Image or onward in your graph) and response_text (any text the model returned alongside - useful because these models sometimes explain what they did or refuse, and the text tells you why).
Installing it and the key
ComfyUI Manager: search ComfyUI-OllamaGemini, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/al-swaiti/ComfyUI-OllamaGemini
pip install -r requirements.txt
then restart. You need a Google key with image-generation access, from aistudio.google.com or Google Cloud, stored in the pack config as GEMINI_API_KEY. Note the community caveat: some Google keys require a billing profile attached before image models work even on free credit - if a fresh key errors, that's usually the reason.
Where people get burned
The refusal-and-blank-output combo is the classic one: these models enforce Google's content policy server-side, so a prompt that trips a filter comes back empty or with an explanation instead of a picture - check response_text before assuming the node broke. Second, model names in the preview tier churn fast; if gemini-2.5-flash-image-preview has been renamed on Google's side, the call fails even with a valid key, so verify the model exists on your account (the pack's List Available Models node helps). And the standing trust note for any API node: your key sits in a plaintext config that any installed custom node can read, so install from the real repo, keep it updated, and be ready to rotate.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | A cute cartoon animal in a forest landscape | — |
| model | COMBO | gemini-2.5-flash-image-preview | 2 options: gemini-2.5-flash-image-preview, imagen-4.0-generate-001 |
| aspect_ratio | COMBO | 1:1 | 5 options: 1:1, 3:4, 4:3, 9:16, 16:9 |
| image_size | COMBO | 1K | 2 options: 1K, 2K |
| file_prefix | STRING | gemini_image | — |
| negative_promptopt | STRING | — | |
| image1opt | IMAGE | — | |
| image2opt | IMAGE | — | |
| image3opt | IMAGE | — | |
| image4opt | IMAGE | — | |
| image5opt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| response_text | STRING | — |