Nodes/Better-Gemini/Better Gemini
ComfyUI Node

Better Gemini

Generate images or text with Google Gemini using the official `google-genai` Python SDK.

By ttulttul·Created 8 months ago·Updated 6 days ago· 0
Better Gemini
  • prompt_images
  • IMAGE
  • STRING
prompt
modelmodels/gemini-3.1-flash-lite-image
response_modalitiesIMAGE+TEXT
api_key
aspect_ratioauto
resolutionauto
width0
height0
temperature0.90
top_p0.95
top_k40
max_output_tokens8192
thinking_difficultyauto
thinking_budget0
seed0
system_prompt
cache_outputsfalse
Categoryapi node/image/BetterGemini

Inputs (18)

NameTypeDefaultDescription
promptSTRINGText prompt for image or text generation.
modelCOMBOmodels/gemini-3.1-flash-lite-imageGemini model name (populated via models.list; requires API key).
response_modalitiesCOMBOIMAGE+TEXTChoose IMAGE-only output, IMAGE+TEXT for multimodal responses, or TEXT for text-only generation.
api_keyoptSTRINGOptional. If empty, uses env var GOOGLE_API_KEY (or GEMINI_API_KEY).
prompt_imagesoptIMAGEOptional images to include with the prompt (reference / edit). Batched IMAGE tensors send multiple images.
aspect_ratiooptCOMBOautoIf 'auto', the model chooses. Otherwise requests a specific aspect ratio.
resolutionoptCOMBOautoRequested output resolution (best-effort; may be ignored by the model). Logs a warning if the returned image size doesn't match.
widthoptINT00–8192Optional override. Set > 0 to request a specific width (must set height too).
heightoptINT00–8192Optional override. Set > 0 to request a specific height (must set width too).
temperatureoptFLOAT0.900–2Sampling temperature (model-dependent).
top_poptFLOAT0.950–1Nucleus sampling (model-dependent).
top_koptINT400–1000Top-K sampling (model-dependent).
max_output_tokensoptINT81921–131072Max tokens for any text the model returns (model-dependent).
thinking_difficultyoptCOMBOautoHint for how much 'thinking' budget to allow (model-dependent).
thinking_budgetoptINT00–131072Optional override. Set > 0 to request an explicit thinking budget.
seedoptINT00–18446744073709550000Best-effort seed for determinism (not guaranteed). Set 0 for 'unset'. Gemini requires int32; larger values are folded.
system_promptoptSTRINGOptional system prompt. If set, it will be prepended to your prompt.
cache_outputsoptBOOLEANfalseCache model outputs under .cache and reuse them for identical Gemini requests.

Outputs (2)

NameTypeDescription
IMAGEIMAGE
STRINGSTRING