ComfyUI Node

Ask Gemini

A VLM in your graph with zero VRAM

By Visionatrix·Created 2 years ago·Updated 7 days ago· 39
Ask Gemini
  • image_1
  • image_2
  • image_3
  • text
promptWhy number 42 is important?
safety_settings
response_type
model
api_key
proxy
system_instruction
error_fallback_value
seed44368516
temperature-0.05
num_predict0

You want a vision-language model in your workflow - something that actually reads an image and answers a question about it - but you don't want to download a 40 GB local VLM, fight with GGUF quants, or burn VRAM your sampler needs. Ask Gemini is the shortcut: it takes a prompt plus up to three images, sends them to Google's API, and hands you back a plain text string. No local model, no GPU load, just an API key and an internet connection. It's a full multimodal model crammed into one node.

How it actually works

Under the hood this is a thin, well-maintained wrapper around google-generativeai. Your images get converted to PIL frames and sent as multimodal content to GenerativeModel.generate_content() - the same call you'd write in plain Python. A few implementation details are worth knowing because they tell you how opinionated the node is:

  • It forces transport="rest", dodging the gRPC install and auth headaches that used to plague the Google SDK.
  • The API key comes from the GOOGLE_API_KEY environment variable, or the api_key input if you'd rather hardcode it into the node.
  • The model dropdown is where the real choice lives: gemma-3-12b-it and gemma-3-27b-it (Google's open models, served here on the API), the pinned gemini-2.0-flash-lite-001 and gemini-2.0-flash-001, and the current gemini-2.5-flash and gemini-2.5-pro. The -001 suffixes are dated snapshots - Google's way of freezing a version. For 95% of jobs, gemini-2.5-flash is the one: fast, cheap, and smart enough for captioning and image Q&A.

The inputs that matter

You'll set most of these once and forget them:

  • prompt - your question or instruction. The default ("Why number 42 is important?") is a leftover; replace it with whatever you actually want to ask about the image.
  • image_1 / image_2 / image_3 - the images to send. Each input accepts a batch too, and every frame gets sent individually - feed a video sequence in and caption it all in one pass.
  • response_type - text or json. Picking json sets the response MIME type, so you can get structured output back and pipe it into a parser node for automation.
  • system_instruction - a system prompt, e.g. "You are a captioner. Describe only what is visible." This is where you shape the output.
  • safety_settings - BLOCK_NONE, BLOCK_ONLY_HIGH, or BLOCK_MEDIUM_AND_ABOVE.
  • temperature and num_predict - note the defaults: a negative temperature means "use the model's default," and 0 for num_predict means "no limit." They're lazy inputs, so they only trigger the call when you actually connect something.

The single output is text - a STRING that you wire into Show Text, a text-to-file node, or downstream processing.

Installing it

ComfyUI Manager is the easy path: search "ComfyUI-Gemini", install, restart. Or do it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/Visionatrix/ComfyUI-Gemini

Then restart ComfyUI. The only real dependency is google-generativeai>=0.8.5 - no model downloads, no weights, no VRAM. Then grab an API key from Google AI Studio (or GCP) and either drop it in the api_key input or set GOOGLE_API_KEY as an environment variable.

Where people get burned

  • The free tier has daily caps. Hit your limit and you'll get rate-limit errors mid-workflow. That's exactly why error_fallback_value exists - set it to a non-empty string and the node returns it instead of dying when the API hiccups. Careful though: if the fallback is an empty string or unset, the node re-raises the exception instead of passing silently.
  • The seed input is cosmetic. It's in the UI, but the current code never forwards it to the API, so don't plan on reproducible runs.
  • Regional blocks are real. Gemini's API isn't available everywhere, which is why the proxy input exists (the README links to the VixFlows docs explaining when you need one). If you're somewhere Google is blocked and you're getting connection errors, that's your lever.
  • Safety filtering only goes so far. BLOCK_NONE disables the content filter as much as the API allows, but Gemini's stack is aggressively censored at the model level too. Don't design a workflow around NSFW output and expect it to work - it will quietly refuse. Great for the above-board captioning and Q&A stuff, useless for the other stuff.
  • "It asks for my API key" - you didn't set one. This is the single most common complaint, and it's always the same fix: create the key and set it in the node or the env var.

Where does this shine? Natural-language captioning for LLM-encoder models like Flux and Qwen-Image. Captioning advice usually leans on local VLMs like JoyCaption, but for a quick pass - or when you want actual sentences instead of Danbooru tags - pointing Ask Gemini at a batch of images beats spinning up another local model. It's not a replacement for a fine-tuned captioner; it's the "I just need to know what's in this image" node, and it's very good at being that.

CategoryGemini

Inputs (14)

NameTypeDefaultDescription
promptSTRINGWhy number 42 is important?
safety_settingsCOMBO3 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE
response_typeCOMBO2 options: text, json
modelCOMBO6 options: gemma-3-12b-it, gemma-3-27b-it, gemini-2.0-flash-lite-001, gemini-2.0-flash-001, gemini-2.5-flash, gemini-2.5-pro
api_keyoptSTRING
proxyoptSTRING
image_1optIMAGE
image_2optIMAGE
image_3optIMAGE
system_instructionoptSTRING
error_fallback_valueoptSTRING
seedoptINT443685160–2147483648
temperatureoptFLOAT-0.05-0.05–1
num_predictoptINT00–1048576

Outputs (1)

NameTypeDescription
textSTRING