Gemini 3.1
A Gemini 3.1 chat node for ComfyUI, because your workflow needed a brain
- generated_output
Not every node in a video pack makes pixels. This one makes decisions. GeminiNode31 is a text-generation node that runs Gemini 3.1 on Vertex AI and hands the result back as a plain string - which means you can use it as a prompt rewriter, a captioner, an image classifier, or a workflow brain that takes what your other nodes produced and turns it into a better prompt for the next step. The output type is STRING, and in ComfyUI, strings drive everything.
What it does and how
It's a direct wrapper around the Gemini 3.1 API. You give it a prompt, pick a model from the dropdown, and it returns generated_output - the raw text. The genuinely interesting part for ComfyUI users is the multimodal input: image_file_path, video_file_path, and audio_file_path are optional string inputs where you paste an absolute path to a file (e.g. output/file.png), with matching MIME type dropdowns. So the node can look at a file you generated, describe it, critique it, or rewrite it into a better prompt. That's the classic "caption → re-prompt" loop that was previously the job of a second tool.
Inputs that matter
- prompt - the instruction. Defaults to "Describe the content in detail," which is the giveaway for its intended use: describe whatever file path you wired in.
- model -
GEMINI_31_PROby default, withGEMINI_3_FLASHandGEMINI_31_FLASH_LITEas cheaper/faster options. - system_instruction - optional persona or rules layer, useful if you're building a reusable "always output a comma-separated prompt" node.
- temperature / top_p / top_k - the sampling controls; keep defaults unless you're getting boring or chaotic output.
- max_output_tokens (8192 max) and candidate_count (up to 8) - the length and how many alternatives to return.
- stop_sequences and response_mime_type - the latter is worth knowing: set it to
application/jsonand Gemini returns structured JSON, which pairs nicely with anything that parses output. - The four safety threshold dropdowns - Google's content filters, medium-and-above by default.
Note the file inputs take paths, not tensors - there's no IMAGE input here, so if you want to feed it live tensors you'd have to save them first. That's a deliberate design choice, and a minor annoyance.
Installing it
It's in the shared Google GenMedia pack:
cd ComfyUI/custom_nodes
git clone https://github.com/GoogleCloudPlatform/comfyui-google-genmedia-custom-nodes
pip install -r comfyui-google-genmedia-custom-nodes/requirements.txt
Or ComfyUI Manager → search comfyui-google-genmedia-custom-nodes. Restart, find it under Google AI/Gemini. Set gcp_project_id and gcp_region (default global) and authenticate with gcloud auth application-default login. Every call is billed on Vertex AI.
The honest take
It's a solid, boring, dependable node - and boring is good. It won't run locally, it's not free, and it shares Google's safety-filter ceiling, but as a prompt-enhancement or analysis stage it's far cheaper than fiddling with an open LLM setup inside ComfyUI, and the multimodal file inputs make it the most useful "brain" node in this pack. If you only install one text node from here, make it this one.
Inputs (22)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Describe the content in detail. | — |
| model | COMBO | GEMINI_31_PRO | 3 options: GEMINI_31_PRO, GEMINI_3_FLASH, GEMINI_31_FLASH_LITE |
| temperature | FLOAT | 0.700–1 | — |
| max_output_tokens | INT | 81921–8192 | — |
| top_p | FLOAT | 1.000–1 | — |
| top_k | INT | 321–64 | — |
| candidate_count | INT | 11–8 | — |
| stop_sequences | STRING | — | |
| response_mime_type | STRING | text/plain | — |
| harassment_threshold | COMBO | BLOCK_MEDIUM_AND_ABOVE | 4 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE |
| hate_speech_threshold | COMBO | BLOCK_MEDIUM_AND_ABOVE | 4 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE |
| sexually_explicit_threshold | COMBO | BLOCK_MEDIUM_AND_ABOVE | 4 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE |
| dangerous_content_threshold | COMBO | BLOCK_MEDIUM_AND_ABOVE | 4 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE |
| system_instructionopt | STRING | — | |
| image_file_pathopt | STRING | the absolute path of the image e.g output/file.png | |
| image_mime_typeopt | COMBO | image/png | 2 options: image/png, image/jpeg |
| video_file_pathopt | STRING | the absolute path of the video e.g output/file.mp4 | |
| video_mime_typeopt | COMBO | video/mp4 | 2 options: video/mp4, video/mpeg |
| audio_file_pathopt | STRING | the absolute path of the audio e.g output/file.mp3 | |
| audio_mime_typeopt | COMBO | audio/mp3 | 3 options: audio/mp3, audio/wav, audio/mpeg |
| gcp_project_idopt | STRING | GCP project id where Vertex AI API will query Gemini | |
| gcp_regionopt | STRING | global | GCP region for Vertex AI API |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| generated_output | STRING | — |