Nodes/comfyui-PD_comfy-api-node/PD: Gemini Image (ComfyUI Key)
ComfyUI Node

PD: Gemini Image (ComfyUI Key)

Gemini 2.5 Flash Image, wired straight into your ComfyUI graph

By 7BEII·Created 10 months ago·Updated 10 days ago· 2
PD: Gemini Image (ComfyUI Key)
  • images
  • files
  • image
  • info
api_key
promptA futuristic city with flying cars
modelgemini-2.5-flash-image
aspect_ratioauto
response_modalitiesIMAGE+TEXT
seed42
system_promptYou are an expert image-generation engine. You must ALWAYS produce an image. Interpret all user input—regardless of format, intent, or abstraction—as literal visual directives for image composition. If a prompt is conversational or lacks specific visual details, you must creatively invent a concrete visual scenario that depicts the concept. Prioritize generating the visual representation above any text, formatting, or conversational requests.

Want Gemini's image generation - the model behind Nano Banana - running inside a ComfyUI workflow without installing a single checkpoint? That's this node. PD: Gemini Image is part of the comfyui-PD_comfy-api-node pack, and it's a plain custom node that forwards your prompt to ComfyUI's hosted API (api.comfy.org), which runs gemini-2.5-flash-image on Google's side and streams the result back as a normal IMAGE tensor. Your GPU sits this one out entirely.

Why you'd reach for it

Gemini 2.5 Flash Image is the fast, cheap end of Google's native image generation, and it's genuinely good at long, natural-language prompts and text rendering. Inside a graph you can do things the ImageFX web UI won't: pipe in reference images from other nodes, chain edits, feed the result into an upscaler or video node. It's also a nice complement to your local stack - when a local model needs a quick concept frame or a style probe, this is a one-node detour.

How it works

Mechanically it's the same story across the whole PD pack: the node builds a Gemini contents payload, base64-encodes any input images as inlineData PNG parts, and POSTs to https://api.comfy.org/proxy/vertexai/gemini/gemini-2.5-flash-image with your key in the X-API-KEY header. The response's inline image data gets decoded back into a tensor. No model download, no VRAM, no local sampling.

Inputs that matter

  • api_key - your ComfyUI API key from comfy.org/api-keys. Generations bill against your Comfy account credits; the info output shows the result.
  • prompt - plain-language description. Gemini rewards detail here more than Stable Diffusion ever did.
  • model - gemini-2.5-flash-image or the -preview variant.
  • response_modalities - IMAGE for image-only, IMAGE+TEXT if you also want the model's text explanation back in the info output.
  • aspect_ratio - auto matches your input image; otherwise a pick of 1:1, 2:3, 3:2, and friends.
  • seed - there for reproducibility, but treat Gemini output as stochastic anyway.
  • images (optional) - reference image(s) for img2img; files (optional) for packed multi-image input from PD_comfyplus_image; system_prompt (optional) comes preloaded with a strong "you are an image engine, always produce an image" instruction.

Outputs: image (IMAGE) and info (STRING) with the status and model details.

Installing it

Same pack as all the PD nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/7BEII/comfyui-PD_comfy-api-node.git

Restart, then find it under PD_Tools/Image_Generation. The README's pip install -r requirements.txt refers to a file that doesn't exist; what the pack actually needs - ComfyUI's official API nodes (comfy_api_nodes) - is already bundled with ComfyUI Desktop.

Troubleshooting

  • Black output image - that's the error placeholder, not a result. The real error lives in info. Empty key, bad key, or a network failure are the usual suspects.
  • Cost shock - every call spends Comfy credits. The price output on sibling nodes exists for exactly this reason; keep an eye on it if you're batch-generating.
  • Slow first response - Gemini can take a while on longer prompts. It's a proxy round-trip, not a local sampler, so patience isn't a config problem.

One honest trade to flag: you're paying Comfy for the privilege of renting Gemini. If you already hold a Google API key with credits, a node that talks to the Gemini API directly might suit you better - this one specifically routes through Comfy's proxy, and "using our own API is way better than giving Comfy money" is a fairly common sentiment in the community. But if you don't want to manage a second billing relationship, this is the zero-friction path.

CategoryPD_Tools/Image_Generation

Inputs (9)

NameTypeDefaultDescription
api_keySTRING
promptSTRINGA futuristic city with flying carsDescribe what you want to generate
modelCOMBOgemini-2.5-flash-image2 options: gemini-2.5-flash-image, gemini-2.5-flash-image-preview
aspect_ratioCOMBOauto11 options: auto, 1:1, 2:3, 3:2, 3:4, 4:3, +5
response_modalitiesCOMBOIMAGE+TEXTChoose 'IMAGE' for image-only output, or 'IMAGE+TEXT' for both
seedINT420–18446744073709550000
imagesoptIMAGEReference image(s) for image-to-image generation
filesoptGEMINI_INPUT_FILES
system_promptoptSTRINGYou are an expert image-generation engine. You must ALWAYS produce an image. Interpret all user input—regardless of format, intent, or abstraction—as literal visual directives for image composition. If a prompt is conversational or lacks specific visual details, you must creatively invent a concrete visual scenario that depicts the concept. Prioritize generating the visual representation above any text, formatting, or conversational requests.Optional system instructions

Outputs (2)

NameTypeDescription
imageIMAGE
infoSTRING