Nodes/ComfyUI_Gemini_Flash/Gemini Flash 002
ComfyUI Node

Gemini Flash 002

A vision-language model bolted onto your ComfyUI graph

By ShmuelRonen·Created 2 years ago·Updated about a year ago· 30
Gemini Flash 002
  • image
  • video
  • audio
  • generated_content
promptAnalyze the situation in details.
input_typetext
api_key
proxy
text_input
max_output_tokens1000
temperature0.4

Let's get the one thing that matters out of the way first: this node does not run anything on your GPU. Gemini Flash 002 is a wrapper around Google's gemini-1.5-flash API, so the "model" lives on Google's servers and every run costs API credits, not VRAM. If you came here hoping for a local vision model, you're in the wrong place - go grab a captioning node running a local Florence/Qwen model instead. But if you want a single node that can look at an image, watch frames of a video, listen to audio, and answer in natural language - all with zero model downloads - this is one of the simpler ways to bolt that onto a workflow.

What it actually does

It's a one-trick node, and the trick is multimodal analysis. Give it a prompt and an input_type, optionally wire in an image, a video (as a batch of frames), or an audio clip, and it returns a generated_content STRING with Gemini's answer. That string is the whole point: feed it into a text node, log it, or chain it into whatever you're building. The common real-world use is automated captioning or quality-checking - run a batch of renders through it and get a text critique per image before anything goes to a human.

How it works

The node hardcodes model_name = 'gemini-1.5-flash', then dispatches on input_type. The preprocessing is where the actual thought went in:

  • image - resized so the longest side is max 1024px before it's sent.
  • video - sampled to at most 10 frames spread across the clip, each resized to 256px, plus a built-in instruction to "pay attention to any changes or movements across frames."
  • audio - forced to mono, resampled to 16kHz, saved as a WAV, and sent as audio/wav.

That's the right instinct: the API's context is huge (1M tokens), but payload size and cost are the real limits, so shrinking media before upload keeps requests fast and cheap. It configures the SDK with transport='rest', which sidesteps the gRPC/protobuf dependency headaches that plague google-generativeai installs elsewhere. One quirk worth knowing: exceptions are caught and returned inside the output string as Error: ... instead of failing the graph, so a silent typo in a key looks like a valid run until you read the output.

Inputs that matter

Only a few are worth touching as a beginner:

  • prompt - the instruction. Default is Analyze the situation in details. (yes, the typo ships in the default). Make this specific for decent results.
  • input_type - text / image / video / audio. Switch it to match whatever you wired in.
  • api_key - from Google AI Studio. Set it once and it gets saved to config.json in the node folder.
  • proxy - only needed behind a corporate firewall; node input overrides the config file. Leave empty otherwise.

Then the optional stuff: max_output_tokens (default 1000, capped at 2048) and temperature (default 0.4) for output length and randomness.

Installing it

Two ways, same result. Via ComfyUI Manager, search "Gemini Flash" and install the pack. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/ShmuelRonen/ComfyUI_Gemini_Flash
cd ComfyUI_Gemini_Flash
pip install google-generativeai

Then restart ComfyUI. The one real dependency is google-generativeai (pillow and torchaudio come with ComfyUI's torch install, so the README's extra pip line is usually redundant). Refreshing contrast to the rest of the ecosystem: no model files to download, no VRAM to check, nothing to place in a models folder.

Troubleshooting

The failure modes are few and predictable:

  • "API key is required" - you skipped the key. Either type it into the node's api_key field or drop it into config.json (default key is the literal string your key).
  • Every output is Error: ... - check the key isn't wrong, your network isn't behind a proxy you forgot about, and the input actually matches input_type. Remember errors come back as text, not as a red node.
  • Video/audio giving odd results - you're at the mercy of the 10-frame / 256px sampling. Movement-heavy clips lose a lot; keep prompts simple.

The bigger caveat is timing. The README's first line points to a successor project, ComfyUI-Gemini_Flash_2.0_Exp, and this pack targets the older 1.5 Flash model line. It still works - Gemini 1.5 Flash isn't dead - but don't build a production pipeline on a wrapper whose author has already shipped the next version. Also note the pack has essentially no community footprint (zero impressions on comfy.icu), so you're on your own for help; the code is short, and reading Gemini_Flash_Node.py is genuinely easier than waiting on an issue thread.

CategoryGemini Flash 002

Inputs (10)

NameTypeDefaultDescription
promptSTRINGAnalyze the situation in details.
input_typeCOMBOtext4 options: text, image, video, audio
api_keySTRING
proxySTRING
text_inputoptSTRING
imageoptIMAGE
videooptIMAGE
audiooptAUDIO
max_output_tokensoptINT10001–2048
temperatureoptFLOAT0.40–1

Outputs (1)

NameTypeDescription
generated_contentSTRING