Nodes/comfyui-PD_comfy-api-node/PD: Google Gemini (ComfyUI API Key)
ComfyUI Node

PD: Google Gemini (ComfyUI API Key)

The PD Gemini text node

By 7BEII·Created 9 months ago·Updated a day ago· 2
PD: Google Gemini (ComfyUI API Key)
  • image_1
  • audio_1
  • video_1
  • files
  • text
  • price
comfy_api_key
prompt
modelGemini 3.1 Pro
thinking_levelHIGH
temperature1.00
top_p0.95
max_output_tokens32768
seed42
system_prompt

A frontier LLM as a plain custom node

PD: Google Gemini (ComfyUI API Key) is exactly what it says on the tin: a text-generation node that reaches Google's Gemini through Comfy's own API proxy using a key you paste in yourself. It's a re-implementation of Comfy's official Gemini API node as an ordinary custom node - same endpoint, same model, but you bring the comfy_api_key and it sits in your graph like any other node. It lives under PD_Tools/Text_Generation.

Why you'd reach for it: the classic LLM-in-the-graph jobs - prompt enhancement, captioning, or just having a strong model write text in the middle of a workflow. The honest rule from the LLM-in-ComfyUI playbook applies here: if you want uncensored, offline, free-per-call, run a local 8B GGUF instead. You pick this node when you want genuine frontier-chat quality and don't need local or NSFW. Bonus: it's genuinely multimodal, taking optional image, audio, and video inputs alongside the prompt - a vision-language node as much as a text one.

How it works

The node builds a Gemini contents payload - your prompt plus any image (base64 PNG), audio (MP3), or video (MP4) - and POSTs it to https://api.comfy.org/proxy/vertexai/gemini/<model> with your key in an X-API-KEY header. The request runs in a background thread, so cancel works mid-call instead of hanging your queue for five minutes. Two models are offered: Gemini 3.1 Pro (gemini-3.1-pro-preview) and Gemini 3.1 Flash-Lite - pick Flash-Lite for cheap bulk rewriting, Pro for the good stuff.

The inputs that matter

  • comfy_api_key - the one real setup step. Get it from comfy.org/api-keys and paste it. And read the tooltip: the key is stored in the workflow when the workflow is saved. Your key is baked into the .json file. Don't share workflows with this node in them.
  • prompt - your actual request; multiline.
  • model - Pro or Flash-Lite. The underlying model IDs are previews, so they'll drift as Google ships newer ones.
  • system_prompt - optional, for setting the role. Also multiline.

thinking_level (LOW/HIGH), temperature, top_p, max_output_tokens and seed are all there if you want them; defaults are sane. The optional image_1, audio_1, video_1 and files inputs are how you go multimodal.

Outputs

Two of them: text and price. The text is the model's answer; the price output is a formatted string with the model version, elapsed time, input/output/thinking token counts and an estimated cost in USD, RMB and Comfy credits. It's genuinely handy for watching what a workflow costs - and a reminder that every call is metered.

Install and gotchas

The pack is one git clone:

cd ComfyUI/custom_nodes
git clone https://github.com/7BEII/comfyui-PD_comfy-api-node.git
pip install -r comfyui-PD_comfy-api-node/requirements.txt

then restart. This node needs a reasonably current ComfyUI, because the code imports the official API-node support (comfy_api_nodes) that recent builds bundle. If the node is missing from the menu, check the ComfyUI console - the pack logs a per-module load failure like [PD_NODE] Failed to load module, and a stale ComfyUI is the usual suspect.

Watch out for: the key living in saved workflows, a 300-second request timeout (fine for text, tight for long generations), and the fact that everything you send goes to Google's servers - prompts and images get logged for abuse monitoring, same as any Gemini API call. Billing is through Comfy credits, so costs land on your Comfy account, not Google's. The author's own dev notes emphasize not blind-retrying billable requests, which is the right instinct - if a call times out, that's a call you may have paid for.

CategoryPD_Tools/Text_Generation

Inputs (13)

NameTypeDefaultDescription
comfy_api_keySTRINGThe key is stored in the workflow when the workflow is saved.
promptSTRING
modelCOMBOGemini 3.1 Pro2 options: Gemini 3.1 Pro, Gemini 3.1 Flash-Lite
thinking_levelCOMBOHIGH2 options: LOW, HIGH
temperatureFLOAT1.000–2
top_pFLOAT0.950–1
max_output_tokensINT3276816–65536
seedINT420–2147483647
system_promptSTRING
image_1optIMAGE
audio_1optAUDIO
video_1optVIDEO
filesoptGEMINI_INPUT_FILES

Outputs (2)

NameTypeDescription
textSTRING
priceSTRING