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

BYOKey Gemini Image (Google)

Gemini's image model with your own key

By MeteorAndy·Created 4 months ago·Updated 3 months ago· 0
BYOKey Gemini Image (Google)
  • images
  • image
  • string
api_key
base_urlhttps://generativelanguage.googleapis.com/v1beta
prompt
modelgemini-2.5-flash-image
seed42
aspect_ratioauto
resolution1K
response_modalitiesIMAGE+TEXT
thinking_levelauto
system_promptYou are an expert image-generation engine. You must ALWAYS produce an image. Interpret all user input—regardless of format, intent, or abstraction—as literal visual directives for image composition. If a prompt is conversational or lacks specific visual details, you must creatively invent a concrete visual scenario that depicts the concept. Prioritize generating the visual representation above any text, formatting, or conversational requests.

This is the node that puts "Nano Banana" - Google's Gemini image models - inside your ComfyUI graph without Comfy's credit system in the way. BYOKey_GeminiImage calls the Gemini Developer API directly with your Google AI Studio key, generates or edits images, and returns them as normal IMAGE tensors plus an optional text reply. The KB calls Nano Banana one of the most in-demand closed models of 2026 - people want it in their workflow next to their local nodes - and this is the bring-your-own-key path to exactly that.

The selling point of Gemini's image models is how they handle iteration: they're strong at following complex prompts, at text rendering, and - because you can feed it reference images - at character-consistent edits. The "Nano Banana Pro / 2" tier even has a native upscaler that goes to 4K. That last part is why this node has resolution options most image API nodes don't.

How it works

It hits the Gemini API with your prompt and optional reference images (up to 14 for the Pro/2 models), asks the model to produce image (and optionally text) output, and decodes the result back into an IMAGE tensor. IMAGE+TEXT mode returns a companion STRING, which is where the model can explain what it did or refine itself.

The inputs that matter

  • model - the dropdown includes gemini-2.5-flash-image, gemini-2.0-flash-exp-image-generation, gemini-3-pro-image-preview, and "Nano Banana 2 (Gemini 3.1 Flash Image)". The Pro/2 entries unlock the extras below.
  • aspect_ratio - auto (matches your input image) or a fixed ratio like 16:9, 4:5, 21:9.
  • resolution - 1K / 2K / 4K, only used by the Pro/2 models; at 2K/4K the native Gemini upscaler does the work. This is the feature the old Gemini image models couldn't do.
  • response_modalities - IMAGE+TEXT (default) or IMAGE. Pick IMAGE if you want a clean image-only output and don't care about the commentary.
  • thinking_level - auto/MINIMAL/HIGH for Nano Banana 2's reasoning depth.
  • system_prompt - ships with a sensible default ("You are an expert image-generation engine…") that keeps the model on its job of producing an image rather than answering conversationally. You can replace it, but the default is genuinely good and most people never touch it.

Outputs are image (IMAGE) and string (STRING) - the string is empty or absent in IMAGE-only mode.

Installing it

Part of the comfyui-byokey pack, which has zero 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/image. No models to download - the GPU work is Google's.

Gotchas

Cost and rate limits are the two real-world stings. Nano Banana Pro is priced per image on a tier that climbs with resolution (roughly $0.04–0.24/image per the KB's notes on Google's pricing), and at 2K/4K you're paying the top of that tier every run. Free-tier keys exist but are rate-limited hard, so a batch of upscales can start erroring mid-run. Also remember the model's content policy travels with the model - Google's refusals apply no matter which node you use, and a reseller's "looser filtering" claims should be treated as marketing. Finally, the pack-standard hygiene: your key is a widget value saved into the workflow JSON, so scrub it before sharing. Read the source if you're nervous about pasting keys into nodes - it's open and short. For a genuinely good closed image model in your graph, this is the one to reach for.

Categoryapi/byokey/image

Inputs (11)

NameTypeDefaultDescription
api_keySTRINGGoogle AI Studio (Gemini) API key.
base_urlSTRINGhttps://generativelanguage.googleapis.com/v1betaAPI base URL. Change only for third-party relays.
promptSTRINGText prompt describing the image to generate or the edits to apply.
modelCOMBOgemini-2.5-flash-image5 options: gemini-2.5-flash-image, gemini-2.5-flash-image-preview, gemini-2.0-flash-exp-image-generation, gemini-3-pro-image-preview, Nano Banana 2 (Gemini 3.1 Flash Image)
seedINT420–18446744073709550000Best-effort deterministic seed. By default a random seed is used.
imagesoptIMAGEOptional reference image(s). Use the Batch Images node for multiple (up to 14 for the Nano Banana Pro / 2 models).
aspect_ratiooptCOMBOauto'auto' matches the input image's aspect ratio, otherwise generates that ratio.
resolutionoptCOMBO1KTarget output resolution (only used by Nano Banana Pro / 2 models). For 2K/4K the native Gemini upscaler is used.
response_modalitiesoptCOMBOIMAGE+TEXT'IMAGE' for image-only output, 'IMAGE+TEXT' to also return a text response.
thinking_leveloptCOMBOautoDepth of the model's reasoning (Nano Banana 2 only). 'auto' leaves it unset.
system_promptoptSTRINGYou are an expert image-generation engine. You must ALWAYS produce an image. Interpret all user input—regardless of format, intent, or abstraction—as literal visual directives for image composition. If a prompt is conversational or lacks specific visual details, you must creatively invent a concrete visual scenario that depicts the concept. Prioritize generating the visual representation above any text, formatting, or conversational requests.Foundational instructions that dictate the model's behavior.

Outputs (2)

NameTypeDescription
imageIMAGE
stringSTRING