comfy-gemini Introduction
comfy-gemini adds two custom nodes to ComfyUI that use the Google Gemini API to help you write prompts for image generation. One node turns an image into a descriptive prompt; the other expands a prompt you have already written.
These nodes can help when you have a visual reference but cannot quite describe it, or when a short idea needs more detail before you send it to a text-to-image node. They produce text prompts, not finished images, so you can review and edit their suggestions before using them in the rest of your workflow.
How comfy-gemini Works
Think of Gemini as a writing assistant within your ComfyUI workflow:
- You give a node either an image or a text prompt.
- You provide a Gemini API key and choose a model.
- You can adjust the instructions that tell Gemini what kind of description to write.
- The node returns text that you can connect to another node or refine yourself.
For example, you could give Gemini Image To Prompt an illustration and ask for a description suitable for recreating it. Or you could give Gemini Enhance Prompt the phrase “a lantern-lit garden at night” and ask it to develop the subject, scene, and style.
The instructions you provide guide the response; they do not guarantee an exact description or a particular generated image. Check the resulting prompt for details you want to keep, change, or remove.
comfy-gemini Features
Gemini Image To Prompt (Gemini/Image)
This node examines an image and writes a descriptive prompt based on what it sees.
| Input or output | What it does |
|---|---|
image | The image you want Gemini to describe. |
model | The Gemini vision model used to analyze the image. |
api_key | Your Google AI API key. |
prompt_template | Optional instructions for how to describe the image. The default focuses on a detailed description for regenerating an illustration. |
prompt | The text description produced by the node. |
Example workflow: Connect an image source, such as a LoadImage node, to image. Set the model and API key, then connect the resulting prompt to a text-to-image node that accepts text input.
You can change prompt_template to steer what the description emphasizes. For instance, instructions that focus on composition may be more useful when you want to preserve where subjects appear in the frame, while instructions focused on style may help you explore a reference image’s visual character. Review the output before treating it as an accurate account of every detail in the image.
Gemini Enhance Prompt (Gemini/Text)
This node takes a prompt you have written and asks Gemini to make it more detailed.
| Input or output | What it does |
|---|---|
prompt | The starting text you want to develop. |
api_key | Your Google AI API key. |
model | The Gemini text model used to expand the prompt. |
system_prompt | Optional instructions for the enhancement. The default focuses on scene, subject, style, and technical details. |
enhanced_prompt | The expanded text produced by the node. |
Example workflow: Connect text from a Primitive node or another prompt source to prompt. Set the model and API key, then pass enhanced_prompt to a node that uses text to generate an image.
Use system_prompt to guide the kind of expansion you need. You might ask for more detail about the setting while keeping your original subject, or ask for stronger attention to visual style. A longer prompt is not automatically a better one: remove additions that change your intended idea.
API Key Options
You can enter your Gemini API key in the node or set the GEMINI_API_KEY environment variable. The environment-variable option is generally more secure than placing the key directly in a workflow. Take care before sharing a workflow that contains a key entered into a node.
comfy-gemini Models
Both nodes accept a model name as text. The original documentation gives these examples:
gemini-2.0-pro-latestis an example vision-model name for Gemini Image To Prompt, which needs to analyze an image.gemini-2.5-pro-latestis an example text-model name for Gemini Enhance Prompt, which works from an existing prompt.
These are examples, not a complete list of supported models. The provided documentation does not compare model quality, speed, or availability. Choose a model suited to the node’s task, and check the current Gemini API model documentation for model names and capabilities before using one.
Troubleshooting comfy-gemini
The node does not produce a prompt.
- Check that your Google AI API key has been supplied in the node or through
GEMINI_API_KEY. - Check that the model name is entered correctly and is appropriate for the task: image analysis for Gemini Image To Prompt, or text processing for Gemini Enhance Prompt.
- Confirm that the image or starting prompt is connected to the relevant input.
- Read any error shown by ComfyUI or the node; it may identify which input or API request needs attention.
The image description misses something important.
- Check that the intended image is connected to
image. - Make the
prompt_templatemore specific about what matters to you, such as the subject, composition, or style. - Review and edit the returned prompt before using it to generate an image.
The enhanced prompt changes my idea too much.
- Add clearer instructions to
system_promptabout which parts of your original prompt to preserve. - Run the node again and compare its output with your starting prompt.
- Remove details that do not fit your intended image.
I want to share my workflow. Is my API key included?
If you typed the key directly into a node, check the workflow before sharing it. Using the GEMINI_API_KEY environment variable is generally the more secure option described in the original documentation.
Frequently Asked Questions
Does comfy-gemini generate images?
No. Its two documented nodes generate text: a prompt from an image or an enhanced version of an existing prompt. You can use that text with other ComfyUI nodes for image generation.
Do I have to use the default prompt instructions?
No. prompt_template and system_prompt are optional inputs you can customize to suit your artistic goal.
Which node should I choose?
Use Gemini Image To Prompt when your starting point is a reference image. Use Gemini Enhance Prompt when your starting point is a written idea.
Learn More about comfy-gemini
- ComfyUI documentation explains the workflow concepts behind connecting nodes and passing images or text between them.
- Gemini API documentation provides information about the API used by these nodes, including model documentation.
The supplied extension documentation does not identify an official comfy-gemini tutorial, community forum, version history, or verified repository link.
