ComfyUI Node
Better Gemini
Generate images or text with Google Gemini using the official `google-genai` Python SDK.
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)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Text prompt for image or text generation. | |
| model | COMBO | models/gemini-3.1-flash-lite-image | Gemini model name (populated via models.list; requires API key). |
| response_modalities | COMBO | IMAGE+TEXT | Choose IMAGE-only output, IMAGE+TEXT for multimodal responses, or TEXT for text-only generation. |
| api_keyopt | STRING | Optional. If empty, uses env var GOOGLE_API_KEY (or GEMINI_API_KEY). | |
| prompt_imagesopt | IMAGE | Optional images to include with the prompt (reference / edit). Batched IMAGE tensors send multiple images. | |
| aspect_ratioopt | COMBO | auto | If 'auto', the model chooses. Otherwise requests a specific aspect ratio. |
| resolutionopt | COMBO | auto | Requested output resolution (best-effort; may be ignored by the model). Logs a warning if the returned image size doesn't match. |
| widthopt | INT | 00–8192 | Optional override. Set > 0 to request a specific width (must set height too). |
| heightopt | INT | 00–8192 | Optional override. Set > 0 to request a specific height (must set width too). |
| temperatureopt | FLOAT | 0.900–2 | Sampling temperature (model-dependent). |
| top_popt | FLOAT | 0.950–1 | Nucleus sampling (model-dependent). |
| top_kopt | INT | 400–1000 | Top-K sampling (model-dependent). |
| max_output_tokensopt | INT | 81921–131072 | Max tokens for any text the model returns (model-dependent). |
| thinking_difficultyopt | COMBO | auto | Hint for how much 'thinking' budget to allow (model-dependent). |
| thinking_budgetopt | INT | 00–131072 | Optional override. Set > 0 to request an explicit thinking budget. |
| seedopt | INT | 00–18446744073709550000 | Best-effort seed for determinism (not guaranteed). Set 0 for 'unset'. Gemini requires int32; larger values are folded. |
| system_promptopt | STRING | Optional system prompt. If set, it will be prepended to your prompt. | |
| cache_outputsopt | BOOLEAN | false | Cache model outputs under .cache and reuse them for identical Gemini requests. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| STRING | STRING | — |