HT Gemini Image
Text-to-image straight from the Nano Banana API
- generated_image
- status
This node is a direct line to Google's Gemini image generation API, in a ComfyUI graph. The name is not a euphemism: it is a cloud call. You type a prompt, it returns a generated image as a normal IMAGE tensor, and you can wire that straight into the rest of your local pipeline. It's the bridge that lets you use a hosted model where a local one won't do - without leaving the graph or dropping the image into a separate app.
How it works
Under the hood it uses google-generativeai to hit the Gemini API with your prompt, size, and style, then decodes the base64 response back into a BHWC image tensor. The default model is gemini-2.0-flash-preview-image-generation - the original Gemini-native image model, from the API family Google later folded into the "Nano Banana" branding. The dropdown also offers gemini-1.5-flash, 1.5-pro, and 1.0-pro (those are text-oriented models that can return images in some setups, so results vary). The refresh_models toggle re-queries Google for the live model list instead of relying on the cached/default one - worth flipping when Google ships a new image model and you want it in the list without restarting.
The fields you'll actually set:
prompt- multiline, same as any prompt box.width/height- 512–2048, stepped by 8. 1024×1024 is the default and a reasonable place to start.style- a real shortcut:photography,photorealistic,digital art,cartoon,3d render,watercolor,oil painting,pencil sketch,pixel art,fantasy, ornone. It wraps your prompt with a style directive, so you don't have to hand-write "in the style of a watercolor painting" every time.
Outputs are generated_image (IMAGE) and status (STRING) - the status string carries the model's text response and any error, which is your first stop when things go wrong.
The key, the catch
Like every Gemini node, it needs an API key. The node looks in three places: the GOOGLE_API_KEY environment variable, Colab userdata if you're running there, and a GOOGLE.key file it searches for near your ComfyUI output directory. Set the env var in whatever launches ComfyUI:
export GOOGLE_API_KEY="your-key-here"
Then restart. Without a key it raises a clear "Google API key not found" error - the message tells you exactly what to set.
Installing and honest caveats
Standard pack install - Manager → "HommageTools for ComfyUI", or clone + pip install -r requirements.txt (which pulls in google-generativeai) + restart. No local model files, because there's no local model.
The things nobody mentions until the first surprise bill: it's a paid API and every run costs money, and it needs an internet connection. It's also a closed service, so you're trusting Google with every prompt and image you send - the opposite of the local-first ethos that's most of why people run ComfyUI in the first place. Use it where the gap is real (a prompt-in/prompt-out generative model with strong text rendering that nothing local matches yet), not where a local SDXL or Flux run would be just as good and free. And per the pack's alpha disclaimer, don't build a production pipeline on a node whose author explicitly reserves the right to change or break it without notice.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | — | |
| width | INT | 1024512–2048 | — |
| height | INT | 1024512–2048 | — |
| style | COMBO | none | 11 options: none, photography, photorealistic, digital art, cartoon, 3d render, +5 |
| model | COMBO | gemini-2.0-flash-preview-image-generation | 4 options: gemini-2.0-flash-preview-image-generation, gemini-1.5-flash, gemini-1.5-pro, gemini-1.0-pro |
| refresh_models | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| generated_image | IMAGE | — |
| status | STRING | — |