ComfyUI Node

Gemini 3.1

A Gemini 3.1 chat node for ComfyUI, because your workflow needed a brain

By GoogleCloudPlatform·Created 8 months ago·Updated about a month ago· 47
Gemini 3.1
    • generated_output
    promptDescribe the content in detail.
    modelGEMINI_31_PRO
    temperature0.70
    max_output_tokens8192
    top_p1.00
    top_k32
    candidate_count1
    stop_sequences
    response_mime_typetext/plain
    harassment_thresholdBLOCK_MEDIUM_AND_ABOVE
    hate_speech_thresholdBLOCK_MEDIUM_AND_ABOVE
    sexually_explicit_thresholdBLOCK_MEDIUM_AND_ABOVE
    dangerous_content_thresholdBLOCK_MEDIUM_AND_ABOVE
    system_instruction
    image_file_path
    image_mime_typeimage/png
    video_file_path
    video_mime_typevideo/mp4
    audio_file_path
    audio_mime_typeaudio/mp3
    gcp_project_id
    gcp_regionglobal

    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_PRO by default, with GEMINI_3_FLASH and GEMINI_31_FLASH_LITE as 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/json and 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.

    CategoryGoogle AI/Gemini

    Inputs (22)

    NameTypeDefaultDescription
    promptSTRINGDescribe the content in detail.
    modelCOMBOGEMINI_31_PRO3 options: GEMINI_31_PRO, GEMINI_3_FLASH, GEMINI_31_FLASH_LITE
    temperatureFLOAT0.700–1
    max_output_tokensINT81921–8192
    top_pFLOAT1.000–1
    top_kINT321–64
    candidate_countINT11–8
    stop_sequencesSTRING
    response_mime_typeSTRINGtext/plain
    harassment_thresholdCOMBOBLOCK_MEDIUM_AND_ABOVE4 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE
    hate_speech_thresholdCOMBOBLOCK_MEDIUM_AND_ABOVE4 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE
    sexually_explicit_thresholdCOMBOBLOCK_MEDIUM_AND_ABOVE4 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE
    dangerous_content_thresholdCOMBOBLOCK_MEDIUM_AND_ABOVE4 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE
    system_instructionoptSTRING
    image_file_pathoptSTRINGthe absolute path of the image e.g output/file.png
    image_mime_typeoptCOMBOimage/png2 options: image/png, image/jpeg
    video_file_pathoptSTRINGthe absolute path of the video e.g output/file.mp4
    video_mime_typeoptCOMBOvideo/mp42 options: video/mp4, video/mpeg
    audio_file_pathoptSTRINGthe absolute path of the audio e.g output/file.mp3
    audio_mime_typeoptCOMBOaudio/mp33 options: audio/mp3, audio/wav, audio/mpeg
    gcp_project_idoptSTRINGGCP project id where Vertex AI API will query Gemini
    gcp_regionoptSTRINGglobalGCP region for Vertex AI API

    Outputs (1)

    NameTypeDescription
    generated_outputSTRING