Nodes/ComfyUI-YogurtNodes/Gemini Generate Image
ComfyUI Node

Gemini Generate Image

Google's image model, piped straight into your ComfyUI graph

By yogurt7771·Created 2 years ago·Updated 4 days ago· 1
Gemini Generate Image
  • image
  • image1
  • image2
  • image3
  • image4
  • history
  • image
  • images
  • num_images
  • text
  • history
  • thought
api_key
vertexfalse
model_namegemini-3-pro-image-preview
system_prompt
prompt
temperature1.00
top_p0.00
top_k0
max_output_tokens32768
retry_count1
disable_safety_settingsfalse
disable_system_promptfalse
safety_levelBLOCK_NONE
thinking_budget0
chat_template<-system-> {{system_instruction}} <-/system-> <-user-> {{prompt}} <-/user->
proxy_url
seed-1
aspect_ratioauto
image_size2k
thinking_levelOFF
base_url
timeout0
extra{}

Gemini Generate Image is the pack's flagship cloud node: it calls Google's Gemini API through the official google-genai SDK and hands the result back as a normal ComfyUI IMAGE tensor - plus the model's text output, a thought trace, and the generated images as a list. One node, and you've got Google's image generation inside a local graph, no GPU required.

That last part is the whole pitch. Local sampling needs a serious GPU; Gemini runs in Google's cloud, so a laptop with a weak iGPU can still produce images. It's not a replacement for local diffusion - you're paying per image, subject to API quotas, and at the mercy of Google's safety and availability - but for "I need an image and I have no VRAM," it beats staring at your own hardware. The node also accepts up to five input images (image plus image1image4), so it doubles as an image editor: send in a photo and prompt a change.

How it works

The node collects any connected input images, converts them to PIL, and sends a generation request to Gemini via the google-genai client. The default model_name is gemini-3-pro-image-preview - note that's the shipped default string, and image models rotate frequently, so if the call fails with a model error, check which image-capable models your key can actually access and set model_name accordingly. Results come back as a [N,H,W,C] tensor batch, with the response text and (if the model provides it) reasoning in the thought output.

Inputs that matter

  • api_key - or the shared key file / GEMINI_API_KEY env var.
  • vertex - flip on to route through Google Cloud Vertex AI instead of the consumer API.
  • prompt - the image description; system_prompt for overall style guidance.
  • aspect_ratio - auto, 1:1, 9:16, 16:9, 3:4, 4:3, 3:2, 2:3, 5:4, 4:5, 21:9.
  • image_size - 1k, 2k, or 4k (default 2k). Bigger is sharper and pricier.
  • seed - -1 for random, else fixed for reproducibility.
  • thinking_budget / thinking_level - reasoning controls; 0 disables thinking, -1 leaves it unlimited, and thinking_level (OFF/AUTO/LOW/HIGH) is ignored unless the budget is 0.
  • disable_safety_settings and safety_level - Google filters content by default; safety_level defaults to BLOCK_NONE and you can disable the settings entirely. Know your provider's ToS before leaning on these.
  • base_url, proxy_url, timeout - endpoint override, proxy support, and timeout (0 = none).

Outputs

  • image - first generated image as IMAGE; images - the full list; num_images - count.
  • text - model response text; thought - reasoning trace if the model thinks.
  • history - conversation history for chaining further calls.

Install & key setup

Part of ComfyUI-YogurtNodes; the Gemini nodes need google-genai, which the pack's requirements install:

cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes
pip install -r requirements.txt

Restart ComfyUI; the node is under "Yogurt Nodes" → LLM. Keys resolve in this order: the api_key field → api_key.json in custom_nodes/ComfyUI-YogurtNodes/yogurt_nodes/llm/ ({"gemini": "YOUR_KEY"}) → the GEMINI_API_KEY env var. Get a key from Google AI Studio.

Common issues

  • "Model not found" - the default gemini-3-pro-image-preview string may not match what your key can access. Set model_name to a currently available image model.
  • "Auth failed" - check the three key sources in priority order.
  • "Images are smaller/blockier than I hoped" - bump image_size to 4k; watch the cost.
  • "Content filtered" - check safety_level / disable_safety_settings and your prompt wording.

This is the node I'd actually reach for among the pack's cloud options if I had to pick one - Gemini's image models are strong and the node surfaces the interesting extras (aspect ratios, thinking, editing) without burying them. Just keep a close eye on your API bill.

CategoryYogurtNodes/LLM

Inputs (29)

NameTypeDefaultDescription
api_keySTRINGAPI key for accessing Gemini API
vertexBOOLEANfalseUse Vertex AI for Gemini API
model_nameSTRINGgemini-3-pro-image-previewGemini model name
system_promptSTRINGSystem-level prompt that affects the overall conversation style
promptSTRINGMain prompt content input by the user
temperatureFLOAT1.000–10Sampling temperature, higher values produce more random outputs
top_pFLOAT0.000–1Sampling probability threshold, controls output diversity
top_kINT00–2147483647Number of highest probability tokens to consider during sampling
max_output_tokensINT327680–2147483647Maximum number of tokens in the generated text
retry_countINT1Number of retries when request fails
disable_safety_settingsBOOLEANfalseWhether to disable safety settings, if true, the safety settings will not be set
disable_system_promptBOOLEANfalseWhether to disable the system prompt, if true, the system prompt will sent as a user prompt
safety_levelCOMBOBLOCK_NONESafety level for the generated text
thinking_budgetINT0Thinking budget for the model, if set to -1, the model will not limit thinking budget, if set to 0, the model will disable thinking
chat_templateSTRING<-system-> {{system_instruction}} <-/system-> <-user-> {{prompt}} <-/user->Content template for the generated text
proxy_urlSTRING代理URL,格式: protocol://user:pass@addr:port,支持http,https,socks5,socks5h
seedINT-1-1–2147483647随机种子,设置为-1时随机种子
aspect_ratioCOMBOautoAspect ratio for the generated image
image_sizeCOMBO2kImage size for the generated image
thinking_levelCOMBOOFFThinking level for the model, if thinking budget is not 0, this parameter will be ignored
base_urlSTRINGBase URL for Gemini API
timeoutINT00–2147483647Timeout for the request in seconds, 0 means no timeout
imageoptIMAGE
image1optIMAGE
image2optIMAGE
image3optIMAGE
image4optIMAGE
historyoptHISTORY
extraoptSTRING{}Extra parameters for the request, in JSON format

Outputs (6)

NameTypeDescription
imageIMAGE
imagesIMAGE
num_imagesINT
textSTRING
historyHISTORY
thoughtSTRING