Configure Gemini Interactions API Key
Paste your Gemini key once — the config node behind every Interactions call
- safety_override
- config
This node does nothing. It doesn't call Google, doesn't validate your key, doesn't spend a token. It reads twelve widget values, packs them into a dictionary, and hands that dictionary down a wire. Delete it and your workflow dies not because it was busy, but because nothing else in the graph knows your credentials.
That's fine, because it's the node you configure once and forget. Everything in the pack's Interactions branch - the newer code path built on Gemini's client.interactions.create rather than the classic generate_content - takes one shared config socket. This is where that socket is born.
Two things worth being blunt about, since the canvas hides them. You're not running a model - you're bolting an HTTP client with your key onto a local graph, and the model behind it has no weights you could ever download (external-api-nodes.md). And Google's Gemini image line is closed and aggressively filtered, which is exactly why the same workflow usually keeps a local model around for anything the filter refuses (closed-source-models.md, kg/entities/google.json).
What it actually does
The execute method builds a dict with exactly these keys: api_key, api_version, use_vertexai_env, vertexai_express, vertexai_project, vertexai_location, google_application_credentials, use_cache, cache_ttl_minutes, cache_seed, safety_level, safety_method. That dict is the config output, typed GEMINI_CONFIG.
The real client is created later, inside the text node, and cached per auth mode, key hash, api version and proxy - so a given key isn't re-authenticated on every queue. Vertex environment variables are read at call time rather than load time, so you can fix a bad GOOGLE_CLOUD_PROJECT without reinstalling; you do still need to restart ComfyUI so it inherits the new environment.
The widgets you actually touch
api_key is the only one that's mandatory in practice. Get one from Google AI Studio, paste it, done - field mode is the default path and everything Vertex-shaped can stay off.
api_version defaults to v1beta (the other options are v1alpha and v1beta1). Leave it alone unless you know why you're changing it; one wrinkle is that with either Vertex mode enabled the downstream node quietly promotes a v1beta selection to v1beta1 for you.
use_vertexai_env and vertexai_express are the two Enterprise/Vertex doors. The first expects environment variables to be set before ComfyUI starts:
export GOOGLE_CLOUD_PROJECT=your-project-id
export GOOGLE_CLOUD_LOCATION=global
export GOOGLE_GENAI_USE_ENTERPRISE=true # legacy name: GOOGLE_GENAI_USE_VERTEXAI
# then launch ComfyUI, or restart it
If both variables are set and disagree, the node warns and GOOGLE_GENAI_USE_ENTERPRISE wins. vertexai_project and vertexai_location are fallbacks for when the env vars aren't there, and google_application_credentials takes an absolute path to a service-account JSON if you're not relying on ambient ADC. Turning on use_vertexai_env while the env var is false or missing gets you Invalid Enterprise/Vertex AI configuration in the text output - a config failure, not a network one. vertexai_express is the simpler option: API key only, no project or location.
use_cache, cache_ttl_minutes and cache_seed need translating. The tooltip on cache_ttl_minutes admits it's "retained for config compatibility": the Interactions API does implicit server-side caching, so you aren't managing an explicit cache here. cache_seed is the seed used while use_cache is on. The cache that actually saves money at the local level is the text node's own result cache, keyed off use_seed.
safety_level and safety_method are defaults, not overrides. The text node falls back to them only when its own safety_level/safety_method are set to default; safety_level here defaults to block_none, and safety_method to default (probability vs severity scoring).
Install
ComfyUI Manager: search the pack title, ComfyUI Gemini Expanded API. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI_Gemini_Expanded_API.git
cd ComfyUI_Gemini_Expanded_API
pip install -r requirements.txt
requirements.txt is small - google-genai>=2.17.0, numpy, torch, Pillow - but that floor matters: client.interactions is a recent surface, and if some other pack left an older google-genai in your environment you'll see the failure as API call/processing error: 'Client' object has no attribute 'interactions'. Force it with pip install -U "google-genai>=2.17.0" inside ComfyUI's Python. The source also imports cv2, which isn't listed in requirements; stock ComfyUI ships OpenCV so you're normally fine, but a stripped-down or custom Python env will throw ModuleNotFoundError: No module named 'cv2' at load time.
Where people get burned
- Your key is saved in the workflow JSON. It's a plain string widget, so every .json you share from that canvas carries your key. The pack also ships a
Get API Key from JSONnode if you'd rather keep keys in a file outside the graph. - Nothing is validated here. A typo'd key fails at generation time, and the error lands in the text node's
textoutput rather than as an exception. - No proxy on this node. The proxy host and port widgets live on the text node, not here; this node just supplies credentials.
- The README documents the older sibling. It walks through
Configure Gemini API KeyatAPI/Gemini- a different node with a differentapi_versionlist. The socket type is the sameGEMINI_CONFIG, so the wrong config node will still connect, but trust this node's tooltips. - Change a widget, get a new call. Every value here is hashed into the text node's input fingerprint, so flipping
cache_seedorapi_versioninvalidates the cached result and fires a fresh, billable request.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | — | |
| api_version | COMBO | v1beta | Select API version to use for Interactions API. Default is v1beta. |
| use_vertexai_env | BOOLEAN | false | Uses Gemini Enterprise Agent Platform (formerly Vertex AI) with GOOGLE_GENAI_USE_ENTERPRISE or legacy GOOGLE_GENAI_USE_VERTEXAI environment variable. |
| vertexai_express | BOOLEAN | false | Uses Vertex AI Express mode with an API key. |
| vertexai_projectopt | STRING | Google Cloud Project ID. | |
| vertexai_locationopt | STRING | Google Cloud Location/Region (e.g. us-central1). | |
| google_application_credentialsopt | STRING | Optional absolute path to an application default credentials JSON file for Vertex AI. | |
| use_cacheopt | BOOLEAN | false | Enable context caching workflow. Interactions API uses implicit server-side caching and session storage. |
| cache_ttl_minutesopt | INT | 60 | Context cache TTL minutes (retained for config compatibility). |
| cache_seedopt | INT | 00–2147483647 | Gemini generation seed used when context caching is enabled. |
| safety_overrideopt | GEMINI_SAFETY_CONFIG | Optional safety override settings from Configure Gemini Interactions Safety node. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| config | GEMINI_CONFIG | — |