2025-05-08 13:52:26 +08:00
2025-03-21 15:26:41 +08:00
2025-03-13 23:30:07 +08:00
2025-03-13 23:30:07 +08:00
2025-03-13 23:30:07 +08:00
2025-05-08 13:52:09 +08:00
2025-03-13 23:30:07 +08:00
2025-05-08 13:52:26 +08:00
2025-03-21 15:26:41 +08:00
2025-03-21 15:26:41 +08:00
2025-03-16 15:06:05 +08:00

ComfyUI Gemini API

中文 | English

A custom node for ComfyUI to integrate Google Gemini API.

Installation

Method 1: Manual Installation

  1. Clone this repository into your ComfyUI's custom_nodes directory:

    cd ComfyUI/custom_nodes
    git clone https://github.com/CY-CHENYUE/ComfyUI-Gemini-API
    
  2. Install required dependencies:

    If you're using ComfyUI portable version:

    ..\..\..\python_embeded\python.exe -m pip install -r requirements.txt
    

    If you're using your own Python environment:

    path\to\your\python.exe -m pip install -r requirements.txt
    

Method 2: Install via ComfyUI Manager

  1. Install and open ComfyUI Manager in ComfyUI
  2. Search for "Gemini API"
  3. Click the install button

Restart ComfyUI after installation

Node Description

Gemini 2.0 image

alt text

alt text

A node that generates images using the Gemini API.

Input Parameters:

  • prompt (required): Text prompt describing the image you want to generate
  • api_key (required): Your Google Gemini API key (automatically saved after first setup)
  • model: Model selection
  • width: Width of the generated image (512-2048 pixels)
  • height: Height of the generated image (512-2048 pixels)
  • aspect_ratio: Choose image orientation (Free, Landscape, Portrait, Square)
  • temperature: Parameter controlling generation diversity (0.0-2.0)
  • seed (optional): Random seed for reproducible results
  • images (optional): Reference image input, supports multiple images

Outputs:

  • image: Generated image that can be connected to other ComfyUI nodes
  • API Respond: Text information containing processing logs and API response

Use Cases:

  • Creating unique concept art
  • Generating images from text descriptions
  • Creating style-consistent new images using one or multiple reference images
  • Image editing based on existing images

Multi-Image Feature:

  • The node now supports inputting multiple reference images simultaneously
  • Multiple images will be sent together to the Gemini API as style reference
  • The system automatically adjusts the prompt to inform the model about multiple reference images
  • This feature is ideal for mixing multiple styles or providing more reference information

Getting API Key

  1. Visit Google AI Studio
  2. Create an account or sign in
  3. Create a new API key in the "API Keys" section
  4. Copy the API key and paste it into the node's api_key parameter (only needed for first use, will be saved automatically)

Temperature Parameter Guide

  • Temperature range: 0.0 to 2.0
  • Lower temperature (near 0): More deterministic, predictable results
  • Higher temperature (near 2): More diverse, creative results
  • Default value 1.0: Balances determinism and creativity

Important Notes

  • API may have usage limits or costs, please refer to Google's official documentation
  • Image generation quality and speed depend on Google's server status and your network connection
  • Reference image feature will send your images to Google services, please be aware of privacy implications
  • API key needs to be entered only once, it will be stored in gemini_api_key.txt in the node directory
  • About Image Orientation: Gemini API generates images based on the selected orientation (landscape, portrait, or square), though the model may not always perfectly follow these instructions

Contact Me

S
Description
No description provided
Readme Apache-2.0
1.2 MiB
Languages
Python 100%