MCPcopy Index your code
hub / github.com/GoogleCloudPlatform/comfyui-google-genmedia-custom-nodes

github.com/GoogleCloudPlatform/comfyui-google-genmedia-custom-nodes @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
147 symbols 662 edges 28 files 108 documented · 73% updated 28d ago★ 442 open issues

Browse by type

Functions 106 Types & classes 41
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

This is not an officially supported Google product. This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.

This is a preview version of Google GenAI custom nodes for ComfyUI.

ComfyUI custom nodes for Google GenMedia

This repository contains ComfyUI custom nodes for the following Google GenMedia models: - Gemini (2.5, 3.1, 3.5) - Gemini 2.5 Flash Image (Nano Banana 🍌) - Gemini 3.1 Flash Image (Nano Banana 2 🍌) - Gemini 3 Pro Image (Nano Banana Pro 🍌) - Imagen3 - Imagen4 - Lyria2 - Veo2 - Veo3.1 - Virtual-try-on

All of these nodes need a Google Cloud project and region as input and uses the Vertex AI APIs to access Google GenMedia models. If you are running ComfyUI on GKE as described in ComfyUI on GKE guide, the Vertex AI APIs will be authenticated with GKE workload identity and no additional action is required form your end.

If you are running your own(local) ComfyUI installation, you will need to install the custom nodes and authenticate to Google Cloud as an user or a Service Account. See installation section for details.

Pricing

All the custom nodes provided with this repo use Vertex AI APIs to generate content and hence, Vertex AI pricing is applied to each API call. See Vertex AI Pricing for the model that you want to use.

Note : If you store the content in Google Cloud Storage using these custom nodes, refer to Google Cloud Storage pricing.

Installing the Google Generative Media custom nodes

ComfyUI on GKE

If you want to run ComfyUI on GKE and use these custom nodes, follow the ComfyUI on GKE guide that will spin up ComfyUI on GKE with these custom nodes installed and ready to use.

ComfyUI running locally

If you are running ComfyUI locally or at a place other than GCP and want to use these custom nodes, you need to perform the following steps to install them:

  1. Download these custom nodes in one of the following ways:

    • Using the ComfyUI Manager
    • Go to ComfyUI Manager --> Custom Node Manager --> search for comfyui-google-genmedia-custom-nodes. Click Install.

    • Manual installation using git

    • Open the terminal on the machine that is running ComfyUI and change to the directory where ComfyUI is running from. ```sh cd

      E.g if your ComfyUI is running from "/home/user/username/ComfyUI", replace <PATH_TO_COMFYUI_INSTALLATION> with "/home/user/username/"
      ```
         - Change to the custom_nodes folder.
      

      sh cd ComfyUI/custom_nodes

    • Clone this repository in the custom_nodes folder: sh git clone https://github.com/GoogleCloudPlatform/comfyui-google-genmedia-custom-nodes

    • Install python packages:
      1. If you are running ComfyUI in a python virtual environment, activate it before installing the dependencies. shREADME.md source <PATH_TO_PYTHON_VIRTUAL_ENVIRONMENT>/bin/activate
      2. Install python packages sh pip install -r comfyui-google-genmedia-custom-nodes/requirements.txt
  2. Now that the custom nodes are installed, set up authentication with Google Cloud. This is needed because the custom nodes will use Vertex AI APIs in the given Google Cloud project and region. Choose one of the following authentication methods:

  3. Re-start ComfyUI via ComfyUI manager or manually. Verify there are no failures in the logs and the log says that google-genmedia custom node has been loaded successfully, similar to the following message: sh Import times for custom nodes: ..... ..... ..... 2.8 seconds: /XXX/XXXX/ComfyUI/custom_nodes/comfyui-google-genmedia-custom-nodes

  4. You are all set! Start using the custom nodes. Right click on ComfyUI, Click the 'Add node' menu and you should see a category named Google AI with custom nodes for Google’s genmedia models as shown in the image below. You will need to pass a GCP project id and GCP region as input parameter to every node if you are using the custom nodes from your local ComfyUI installation. menu
  5. Optional step : If you are not familiar with Google's GenMedia custom nodes, we provide some sample workflows with this repo that shows how to use the nodes. You can download and use the sample workflows by following the steps in Sample Workflows section. For full set of features and input parameters to each node, see Node features section for more details.

Authenticate local ComfyUI with Google Cloud user

  • On the machine where you are running ComfyUI, install gcloud cli using the documentation https://docs.cloud.google.com/sdk/docs/install
  • Authenticate with the following command. Enter your Google Cloud credentials when prompted: sh gcloud auth application-default login

Authenticate local ComfyUI with Google Cloud Service Account

  • On the machine where you are running ComfyUI, install gcloud cli using the documentation https://docs.cloud.google.com/sdk/docs/install
  • Authenticate with the following command. Enter your Google Cloud credentials when prompted: sh gcloud auth login
  • Set shell variables ``sh export PROJECT_ID="<YOUR_PROJECT_ID>" export SERVICE_ACCOUNT_ID="<YOUR_SERVICE_ACCOUNT_ID>" export USER_EMAIL=gcloud auth list --filter=status:ACTIVE --format="value(account)"`

    Replace with the GCP project id you plan to use Replace with the name of the service account you will use to access Google Cloud with ComfyUI. It will be created in the next step. - Set Google Cloud project.sh gcloud config set project $PROJECT_ID - Create a new service account:sh gcloud iam service-accounts create $SERVICE_ACCOUNT_ID \ --display-name="ComfyUI Service Account" \ --description="Service Account to use ComfyUI" - Grant permissions to the service account:sh gcloud projects add-iam-policy-binding $PROJECT_ID \ --member="serviceAccount:${SERVICE_ACCOUNT_ID}@${PROJECT_ID}.iam.gserviceaccount.com" \ --role="roles/storage.objectUser" --condition=None

    gcloud projects add-iam-policy-binding $PROJECT_ID \ --member="serviceAccount:${SERVICE_ACCOUNT_ID}@${PROJECT_ID}.iam.gserviceaccount.com" \ --role="roles/aiplatform.user" --condition=None - Grant the Service Account Token Creator role to your user on the service account. This role lets your user account to impersonate the Service Account created in previous steps:sh gcloud iam service-accounts add-iam-policy-binding \ ${SERVICE_ACCOUNT_ID}@${PROJECT_ID}.iam.gserviceaccount.com \ --member="user:${USER_EMAIL}" \ --role="roles/iam.serviceAccountTokenCreator" - Now, set yourself to impersonate the service accountsh gcloud auth application-default login --impersonate-service-account=${SERVICE_ACCOUNT_ID}@${PROJECT_ID}.iam.gserviceaccount.com ```

Node features

Gemini 2.5 Custom Node

Category: Google AI/Gemini

This node integrates the Gemini 2.5 into ComfyUI, supporting text generation only with multimodal inputs (image, video, audio).

Required Inputs

Parameter Type Default Description
prompt STRING "Describe the content in detail." Multiline string. The main text prompt for the model.
model Dropdown GEMINI_PRO Selects the specific Gemini model to use.
temperature FLOAT 0.7 Controls randomness (0.0 to 1.0). Higher values are more creative; lower are more deterministic.
max_output_tokens INT 8192 The maximum number of tokens to generate in the response (Max: 8192).
top_p FLOAT 1.0 The maximum cumulative probability of tokens to consider (0.0 to 1.0).
top_k INT 32 The maximum number of tokens to consider when generating the next token (1 to 64).
candidate_count INT 1 Number of alternative responses to generate (1 to 8).
stop_sequences STRING "" Comma-separated phrases that cause the model to stop generating text.
response_mime_type String text/plain The desired format of the response. Options: text/plain, application/json.
harassment_thresholds Dropdown BLOCK_MEDIUM_AND_ABOVE Individual settings for Harassment Content.
hate_speech_thresholds Dropdown BLOCK_MEDIUM_AND_ABOVE Individual settings for Content.
sexually_explicit_thresholds Dropdown BLOCK_MEDIUM_AND_ABOVE Individual settings for Sexually Explicit Content.
dangerous_content_thresholds Dropdown BLOCK_MEDIUM_AND_ABOVE Individual settings Dangerous Content.
gcp_project_id STRING "" Manually specify GCP Project ID.
gcp_region STRING "" Manually specify GCP Region.

Optional Inputs

Parameter Type Default Description
system_instruction STRING "" Multiline string. System instructions to guide the model's behavior or persona.
image_file_path STRING "" Absolute path to an image file (e.g., output/file.png).
image_mime_type Dropdown image/png Helper to specify the MIME type for the image path provided.
video_file_path STRING "" Absolute path to a video file (e.g., output/file.mp4).
video_mime_type Dropdown video/mp4 Helper to specify the MIME type for the video path provided.
audio_file_path STRING "" Absolute path to an audio file (e.g., output/file.mp3).
audio_mime_type Dropdown audio/mp3 Helper to specify the MIME type for the audio path provided.

Outputs

Name Type Description
generated_output STRING The raw text content generated by the Gemini model.

Sample

Sample workflow using Gemini node

Gemini 3.1 Custom Node

Category: Google AI/Gemini

This node integrates the Gemini 3.1 into ComfyUI, supporting text generation with multimodal inputs (image, video, audio).

Required Inputs

Parameter Type Default Description
prompt STRING "Describe the content in detail." Multiline string. The main text prompt for the model.
model Dropdown GEMINI_31_PRO Selects the specific Gemini model to use. Options: GEMINI_31_PRO, GEMINI_3_FLASH, GEMINI_31_FLASH_LITE.
temperature FLOAT 0.7 Controls randomness (0.0 to 1.0). Higher values are more creative; lower are more deterministic.
max_output_tokens INT 8192 The maximum number of tokens to generate in the response.
top_p FLOAT 1.0 The maximum cumulative probability of tokens to consider (0.0 to 1.0).
top_k INT 32 The maximum number of tokens to consider when generating the next token (1 to 64).
candidate_count INT 1 Number of alternative responses to generate (1 to 8).
stop_sequences STRING "" Comma-separated phrases that cause the model to stop generating text.
response_mime_type String text/plain The desired format of the response. Options: text/plain, application/json.
harassment_threshold Dropdown BLOCK_MEDIUM_AND_ABOVE Individual settings for Harassment Content.
hate_speech_threshold Dropdown BLOCK_MEDIUM_AND_ABOVE Individual settings for Hate Speech Content.
sexually_explicit_threshold Dropdown BLOCK_MEDIUM_AND_ABOVE Individual settings for Sexually Explicit Content.
dangerous_content_threshold Dropdown BLOCK_MEDIUM_AND_ABOVE Individual settings for Dangerous Content.
gcp_project_id STRING "" Manually specify GCP Project ID.
gcp_region STRING global Manually specify GCP Region. Default is global.

Optional Inputs

Parameter Type Default Description
system_instruction STRING "" Multiline string. System instructions to guide the model's behavior or persona.
image_file_path STRING "" Absolute path to an image file (e.g., output/file.png).
image_mime_type Dropdown image/png Helper to specify the MIME type for the image path provided.
video_file_path STRING "" Absolute path to a video file (e.g., output/file.mp4).
video_mime_type Dropdown video/mp4 Helper to specify the MIME type for the video path provided.
audio_file_path STRING "" Absolute path to an audio file (e.g., output/file.mp3).
audio_mime_type Dropdown audio/mp3 Helper to specify the MIME type for the audio path provided.

Outputs

Name Type Description
**ge

Core symbols most depended-on inside this repo

Shape

Method 76
Class 41
Function 30

Languages

Python93%
TypeScript7%

Modules by API surface

google_genmedia/utils.py15 symbols
google_genmedia/veo3_nodes.py12 symbols
web/js/preview_veo_video.js10 symbols
google_genmedia/veo2_nodes.py9 symbols
google_genmedia/imagen4_nodes.py8 symbols
google_genmedia/gemini_nodes.py8 symbols
google_genmedia/gemini_flash_image_node.py8 symbols
google_genmedia/constants.py8 symbols
google_genmedia/helper_nodes.py7 symbols
google_genmedia/veo3_api.py6 symbols
google_genmedia/virtual_try_on.py5 symbols
google_genmedia/veo2_api.py5 symbols

For agents

$ claude mcp add comfyui-google-genmedia-custom-nodes \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page