Nodes/comfyui-byokey/BYOKey Gemini (Google)
ComfyUI Node

BYOKey Gemini (Google)

Vision-capable text gen with your own key

By MeteorAndy·Created 4 months ago·Updated 3 months ago· 0
BYOKey Gemini (Google)
  • images
  • STRING
api_key
base_urlhttps://generativelanguage.googleapis.com/v1beta
prompt
modelgemini-2.5-flash
seed42
system_prompt
temperature1.00
top_p0.95
max_output_tokens32768

If you've already got a Google AI Studio key - and honestly, Gemini's free tier is why a lot of people do - BYOKey_Gemini is the way to spend it inside ComfyUI. It's the BYOKey replacement for the official Google Gemini text node: same job (multimodal text generation), same STRING output, but it calls the Gemini Developer API directly with your key instead of burning Comfy credits on the same model. The official nodes are a metered storefront; this is the bring-your-own-key lane.

What it's good for is the standard LLM-in-the-graph work - turning rough ideas into structured prompts, captioning images for LoRA sets, chaining "describe this image, then rewrite it as a video prompt" loops. Gemini's a strong vision model and the free tier makes it the cheapest way to get a genuinely good captioner, which is exactly the job the KB's LLM essay recommends an API for when you want quality and don't care about local.

How it works

It calls the Gemini Developer API (generativelanguage.googleapis.com/v1beta by default) with your prompt, optional system_prompt, and any images you attach - sent as inline base64 data URIs, the same pattern every BYOKey node uses. The model's reply comes back as a single STRING output. Nothing runs on your machine; the whole thing is an HTTP round-trip.

The inputs that matter

  • model - a dropdown defaulting to gemini-2.5-flash, with gemini-2.5-pro, gemini-2.5-flash-lite, and a couple of preview variants on the list. For most captioning and prompt-rewriting jobs flash is the sane choice; lite if you're batching.
  • images - optional vision context. The tooltip notes to use the Batch Images node for multiple images, because a single IMAGE input carries one image at a time in ComfyUI.
  • system_prompt - the instructions that set the model's behavior. This is where you'd scope the job ("output only the rewritten prompt, no preamble").
  • temperature (0–2, default 1), top_p (default 0.95) - the creativity dials.
  • max_output_tokens (default 32768) - the response ceiling, and the tooltip flags that it includes internal thinking, so cut-offs with thinking-heavy models mean raise this.
  • seed - best-effort deterministic seed (default 42). Gemini won't give you byte-identical reruns, but this is more deterministic than most.

Output is a STRING - the tooltip-free name in the schema is literally "STRING" - wiring into any text consumer in your graph.

Installing it

It ships in the comfyui-byokey pack, no extra dependencies beyond ComfyUI's bundled torch/aiohttp/PIL/numpy/av. Install via ComfyUI Manager (search "byokey") or:

cd ComfyUI/custom_nodes
git clone https://github.com/MeteorAndy/comfyui-byokey.git

Restart, and it's under api/byokey/text. No model downloads, no GPU requirement.

Gotchas

Two things worth knowing. First, the free tier is real but rate-limited - if you're batching a big captioning run you'll hit quota and the node just errors; that's Google's meter, not a bug. Second, the pack-wide caution: your API key is a widget value, so it's baked into the saved workflow JSON. Scrub it before you share a workflow, and if you're paste-a-key-into-a-node shy, that's healthy - this whole category (API nodes) has a documented malware history (LLMVISION), and the fix is the boring one: this pack is open source, so skim it if you care. For the price of a free Google key, this is one of the cheapest ways to get a genuinely good vision-language model inside your ComfyUI graph.

Categoryapi/byokey/text

Inputs (10)

NameTypeDefaultDescription
api_keySTRINGGoogle AI Studio (Gemini) API key.
base_urlSTRINGhttps://generativelanguage.googleapis.com/v1betaAPI base URL. Change only for third-party relays.
promptSTRINGText input to the model. Include detailed instructions, questions, or context for generating a response.
modelCOMBOgemini-2.5-flash6 options: gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-pro-preview-05-06, gemini-2.5-flash-preview-04-17, gemini-2.5-flash-lite, gemini-2.0-flash
seedINT420–18446744073709550000Best-effort deterministic seed. By default a random seed is used.
imagesoptIMAGEOptional image(s) as context. Use the Batch Images node for multiple.
system_promptoptSTRINGFoundational instructions that dictate the model's behavior.
temperatureoptFLOAT1.000–2Controls randomness. Lower is more deterministic, higher more creative.
top_poptFLOAT0.950–1Nucleus sampling threshold.
max_output_tokensoptINT3276816–65536Maximum tokens to generate, including internal thinking.

Outputs (1)

NameTypeDescription
STRINGSTRING