Nodes/ComfyUI API Toolkit/Gemini Vision Analysis
ComfyUI Node

Gemini Vision Analysis

Gemini vision analysis, up to four images at once

By IxMxAMAR·Created 5 months ago·Updated 2 months ago· 1
Gemini Vision Analysis
  • ref_image_1
  • ref_image_2
  • ref_image_3
  • ref_image_4
  • text
api_key
modelgemini-3.1-flash-lite-preview
custom_model
promptDescribe this image.
system_instruction
temperature0.10

Captioning in ComfyUI has a well-worn default: WD14 tagger for booru-style bases, JoyCaption for natural language, and they're both local and free. So where does a Gemini vision call fit? In the gap between "read the tags" and "understand the image." This node sends up to four images to a Gemini model with a question, and gets back a reasoned text answer - not tags, not a template caption, but an actual description that can compare, contrast, and notice things.

The killer use is comparison. Feed it a reference image and your generated image and ask "does the character match the reference?" or "what changed?" - that's a quality-control stage no local tagger gives you. Other real jobs: writing a natural-language caption for a LoRA dataset when you want richer prose than a tagger, describing a source frame to build a video prompt, or verifying consistency across a batch. The KB's llm-in-comfyui.md is honest that for dataset captioning, dedicated local tools are often the better default (free, offline, uncensored) - but for one-off understanding and comparison, this node is the easiest path.

How it works

It's a generate_content call with images attached. Up to four ref_image_N inputs get converted to JPEG parts, your prompt rides along as the question, and the response text comes back as a STRING. The default prompt is literally "Describe this image." - change it to whatever you're actually asking. A system_instruction sets the framing ("You are a strict quality inspector comparing render to reference"), and temperature defaults low (0.1) because analysis wants focus, not creativity.

Inputs and outputs that matter

  • prompt - your question. This is the whole node.
  • model - defaults to gemini-3.1-flash-lite-preview, the cheap and fast pick - sensible, because for vision you usually don't need the biggest model. 35 choices if you want more reasoning power.
  • ref_image_1 through ref_image_4 - the images. Only ref_image_1 is wired if you've got one; add more for comparisons. This is the input that makes the node more than a captioner.
  • system_instruction - how it should frame its answer.
  • temperature - 0.1 default; raise it if you want more interpretive answers.

One output: text (STRING) - wire it to a text display node, a prompt builder, or whatever consumes your analysis.

How to install it

Pack-level install:

cd ComfyUI/custom_nodes
git clone https://github.com/IxMxAMAR/ComfyUI-API-Toolkit
cd ComfyUI-API-Toolkit
pip install -r requirements.txt

or "API Toolkit" in ComfyUI Manager. Needs google-genai>=0.8.0 and a Gemini API key.

Common issues

The practical gotcha: vision answers are only as good as the question. Vague prompts ("is this good?") get vague answers; specific ones ("does the subject's jacket match the reference's color and fabric?") get useful QA. If you're using it for dataset captions, remember the format matters - natural-language prose is right for Flux-style bases and wrong for tag-trained anime bases, exactly as with the Prompt Refiner.

Cost-wise it's a paid per-call model, and the pack's API nodes always re-run on Queue - so a four-image comparison is one call, but re-Queuing re-bills it. And like every closed Google model, its analysis is filtered by policy: it may refuse to describe content it considers violating, which is one more reason the local captioners stay the default for anything sensitive.

CategoryAPI Toolkit/Gemini/Image

Inputs (10)

NameTypeDefaultDescription
api_keySTRINGGemini API key. Leave blank to use GEMINI_API_KEY env var.
modelCOMBOgemini-3.1-flash-lite-previewGemini model for vision analysis.
custom_modelSTRINGOverride with a custom model ID.
promptSTRINGDescribe this image.What to ask about the image(s).
system_instructionoptSTRINGSystem instruction to guide analysis.
temperatureoptFLOAT0.100–2Controls randomness. Lower = more focused analysis.
ref_image_1optIMAGEFirst image to analyze.
ref_image_2optIMAGESecond image to analyze.
ref_image_3optIMAGEThird image to analyze.
ref_image_4optIMAGEFourth image to analyze.

Outputs (1)

NameTypeDescription
textSTRING