Imagen Gemini
The paid API bridge that skips your GPU
- images
- guidance
This node is a very thin bridge: one widget-driven text-to-image node that sends your prompt to Google's Imagen 4 and Imagen 3 models over the Gemini API and hands you back a normal ComfyUI IMAGE tensor. No checkpoints to download, no VRAM to budget, no LoRA training to babysit - Google's cloud does all the diffusion and you pay per image. If you've ever wished you could drop Nano Banana's quality into a ComfyUI graph without leaving the canvas, this is the pack for that.
Be clear-eyed about what it isn't, though. It's a paid, closed API inside a tool that's otherwise your sanctuary from paid closed APIs. Imagen's draw - genuinely good text rendering, clean photorealism, 2K native output - comes wrapped in Google's safety filters and per-image pricing, and you get none of the control you're used to (no negative prompt, no seed, no image input). It's a utility, not a replacement for your local stack.
How it works
Peek at imagen_gemini.py and there's no mystery left. The node is a single requests.post to Google's legacy predict endpoint:
https://generativelanguage.googleapis.com/v1beta/models/{model}:predict?key={your_key}
It sends your prompt plus sampleCount, aspectRatio, sampleImageSize, and personGeneration as JSON, waits (up to 120 seconds), decodes the base64 images in the response, and stacks them into a tensor batch. No SDK, no streaming - just a direct HTTP call, which is why the pack has no real dependencies beyond requests, torch, Pillow, and numpy, all already in your ComfyUI environment. It's the old-style predict endpoint rather than the newer streaming generateContent API, so if Google ever retires it, this node needs a rewrite. That's the risk you accept with any thin wrapper.
One quirk before it surprises you: the second output, guidance, is not per-image advice. It's a static wall of official Imagen prompting tips baked into the source - shot types, lighting vocabulary, the "keep text under 25 characters" rule. Wire it to a ShowText node once if you want the cheatsheet on tap; it never changes based on your prompt.
The inputs that matter
Seven required fields, and a beginner really touches five of them.
- prompt - your positive prompt. That's all you get: Google's API for these models doesn't take negative prompts or system instructions, so everything has to go in the positive text. Keep it descriptive, not tag soup.
- model - pick from the six-model list. Default is
imagen-4.0-generate-001(the standard Imagen 4); there's an ultra, a fast, and the Imagen 3 stable/fast pair. Fast is a nice habit for iterating, standard for anything you'll actually keep. - gemini_api_key - paste a key from Google AI Studio, or leave it blank and set
GEMINI_API_KEYas an environment variable instead. The env var is the better move; you're not shipping your key inside every workflow. - aspect_ratio and resolution -
1:1,3:4,4:3,9:16,16:9, and a1K/2Knative size. - num_images - batch size, 1 to 4 images per request. Mind the bill; this is the input that multiplies cost.
The last one, person_generation, defaults to allow_adult. dont_allow blocks people entirely; allow_all is Google's loosest setting and - per the README - isn't allowed in EU, UK, CH, or MENA locations, so if you're over there you'll get an error back even if the request looks fine.
Installing it
Easiest route: ComfyUI Manager, search "ComfyUI-Imagen-Gemini", install, restart. Manual is the same two commands:
cd ComfyUI/custom_nodes
git clone https://github.com/comrender/ComfyUI-Imagen-Gemini
Then restart ComfyUI. The README mentions a pip install -r requirements.txt, but the repo ships no requirements file - its dependencies are all already present in a stock ComfyUI install, so skip that step. There are no model downloads at all; the whole thing runs on the API key.
The problems you'll actually hit
The errors here are honest about their cause because they come straight from the API. The common ones:
- "Please provide a valid Google Gemini API Key" - raised before any network call if the widget is empty and
GEMINI_API_KEYisn't set. Check the env var actually exported into the process that runs ComfyUI. - "No images returned" with a JSON dump - the API answered but produced nothing, which is usually a quota hit or a safety-filter refusal. Raise the filters (e.g.,
allow_adult→allow_allwhere legal) or check your AI Studio usage dashboard. - Silence for up to 120 seconds - the node's timeout.
2K+ultra+ 4 images can take a while; it's not hung, just slow. If it routinely times out at 2K, drop to 1K.
And budget reality: it's per-image pricing against Google's quotas, not your GPU's electricity. Generate dozens of images a day and the bills creep up fast - which is exactly why the open-source crowd reaches for this only for the jobs Imagen is uniquely good at (in-image text, polish shots) and runs the rest locally.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | A futuristic city with flying cars, cinematic lighting | — |
| model | COMBO | imagen-4.0-generate-001 | 6 options: imagen-4.0-ultra-generate-001, imagen-4.0-generate-001, imagen-4.0-fast-generate-001, imagen-3.0-generate-002, imagen-3.0-fast-generate-001, imagen-3.0-generate-001 |
| gemini_api_key | STRING | — | |
| aspect_ratio | COMBO | 1:1 | 5 options: 1:1, 3:4, 4:3, 9:16, 16:9 |
| resolution | COMBO | 1K | 2 options: 1K, 2K |
| num_images | INT | 11–4 | — |
| person_generation | COMBO | allow_adult | 3 options: allow_adult, dont_allow, allow_all |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| guidance | STRING | — |