comfyui_soze_gemini
Ported from ComfyUI-IF_Gemini to support Gemini 3.0 API calls. Please NOTE: Open Router Functionality has been removed.
Ported from ComfyUI-IF_Gemini to support Gemini 3.0 API. Please NOTE: Open Router Functionality has been removed.
This port is for my own personal use, I am sharing back to the community as a number of people have expressed an interest in having this functionality back in CommfyUI. I am happy to accept PRs and bug reports and will integrate or resolve as possible
Features
- Text Generation: Create content, answer questions, and generate creative text formats
- Image Analysis: Describe, analyze, and extract information from images
- Image Generation: Generate images with Gemini 3's advanced image generation capabilities
- Multi-Modal Input: Combine text and images in your prompts
- Gemini 3 Enhanced Features:
- Thinking Level control for adjustable reasoning depth
- Media Resolution control for optimized image/video processing
- Advanced structured output capabilities
- Customizable Parameters: Control temperature, output tokens, and other generation settings
- Chat Mode: Maintain conversation history for interactive sessions
- Batch Processing: Generate multiple outputs with a single prompt
-
Verify your API key using the "Verify API Key" button in the node
-
Configure the node:
- For text generation, set "operation_mode" to "analysis" or "generate_text"
- For image generation, set "operation_mode" to "generate_images"
- Connect reference images (optional) for style-based generation
-
Set additional parameters as needed:
- Prompt: Your text instructions
- Model version: Select appropriate Gemini model
- Temperature: Controls randomness (0.0-1.0)
- Thinking Level (Gemini 3 only): Controls how much the model "thinks" before responding
none: Standard response (default)low: Brief reasoning (1024 token budget)medium: Moderate reasoning (4096 token budget)high: Extensive reasoning (16384 token budget)
- Media Resolution (Gemini 3 only): Controls image/video processing resolution
- 1K
- 2K
- 4K
- Chat Mode: Enable conversation history for interactive sessions
- Clear History: Clear chat history when enabled (works with Chat Mode)
- Seed: For reproducible results
Vertex AI Nodes
In addition to the AI Studio node above, there are two nodes that call Google Cloud's Vertex AI using the same google-genai SDK. They read their own credentials, kept completely separate from GEMINI_API_KEY:
| Env var | Purpose |
| --- | --- |
| VERTEX_API_KEY | Vertex AI express mode API key |
| VERTEX_PROJECT_ID | GCP project id (falls back to GOOGLE_CLOUD_PROJECT) |
| VERTEX_LOCATION | Region, e.g. us-central1 or global (falls back to GOOGLE_CLOUD_LOCATION) |
These can be set as system env vars, in your shell config, or in a .env file (same lookup as the Gemini key). Each node also exposes optional fields to override the API key (external_api_key / vertex_api_key), project, and location per-node.
- Vertex Gemini (Soze) — Gemini text / multimodal analysis / image generation via Vertex (including the Gemini "Nano Banana" image models). Same inputs and behaviour as the AI Studio node, just pointed at Vertex.
Auth modes: Set
VERTEX_API_KEYfor express mode (closest to the AI Studio flow). Alternatively, setVERTEX_PROJECT_ID+VERTEX_LOCATIONand authenticate withgcloud auth application-default loginto use Application Default Credentials (ADC). For ADC, leave the API key blank and provide a project — the nodes detect this and use ADC automatically. A service-account JSON works too: setGOOGLE_APPLICATION_CREDENTIALSto the key path.
Model IDs differ from AI Studio. Vertex uses different model id strings (e.g. AI Studio's
gemini-3.1-flash-image-previewisgemini-3.1-flash-imageon Vertex). The Vertex Gemini node ships a Vertex-specific dropdown, but exact availability still depends on your project, region, and express-vs-standard access. A404 NOT_FOUND ... was not found or your project does not have access to iterror means the chosen model isn't available to your setup. To see what is available, run the diagnostic:& ".venv\Scripts\python.exe" list_vertex_models.pyThen pick a listed model. Image-generation models also tend to require a real region (e.g.
us-central1) rather thanglobal.
Troubleshooting
- If you encounter API key errors, use the "Verify API Key" button to check its validity
- For image safety errors, try modifying your prompt to avoid content that may trigger safety filters
- Ensure your Gemini API has appropriate quotas for your usage
License
MIT