Nano Banana Pro (own API key)
Nano Banana Pro on Your Google Bill, Not a Comfy Credit Meter
- images
- IMAGE
- text
Nano Banana Pro is Google's flagship image model, and in ComfyUI there's only one way to run it: over the API, because there are no weights to download. The stock Nano Banana Pro (Google Gemini Image) node does call the model - but it routes through api.comfy.org and bills Comfy credits, with no field for your own Google key. This node is the "wait, I already have a Google account" move: it talks to Google directly with your key, on your own billing, and skips Comfy's metered storefront entirely. If you've been burning prepaid credits on a model you could be paying Google for directly, that's the whole pitch.
The pack is fresh off the shelf - MIT, a single author, no community track record yet - so give it a skim before the first run. The code is short, readable HTTP against Google's API; nothing hiding in it.
How it works
Pick a backend on the node, because that decides everything:
- AI Studio (api key) - posts to
generativelanguage.googleapis.comwith yourx-goog-api-key. Simple, but Google has excluded Gemini API from the $300 Cloud free trial since March 2026, so you're paying per image with prepaid credits. - Vertex AI (service account) - posts to
aiplatform.googleapis.comwith an OAuth token from your gcloud login or a service account. Same model, but billed to your Cloud project, which is where the $300 trial credit applies. The pack's reason to exist.
Behind the scenes it sends your IMAGE tensor as PNG base64 inline_data to :generateContent and turns the returned image back into a tensor the graph can save. Nice touch: Vertex serves the same model under a different id (gemini-3-pro-image vs the AI Studio gemini-3-pro-image-preview), and the node translates that so you never see it.
The inputs that matter
Most of the widget list mirrors the built-in node. The ones you'll actually touch:
- model -
gemini-3-pro-image-previewis the flagship default; drop togemini-2.5-flash-imagefor the cheaper, faster tier. - aspect_ratio and resolution - ratios from
autothrough 21:9, output at 1K/2K/4K. 4K is the Pro model's party trick, and where the price jumps. - seed - capped at int32 because that's what Google accepts, with
control_after_generatefor iteration. - response_modalities -
IMAGE+TEXTalso returns the model's written reply on thetextoutput;IMAGEskips it. - images - leave unconnected for pure text-to-image, or feed up to 14 reference images (stack them with a batch node) for image-to-image work.
- system_prompt - pre-filled with a "your only output is a picture" guard so the model draws instead of explaining. Leave it until the model starts refusing.
The default timeout of 300s is generous for 4K; bump it only if big jobs keep dying mid-request.
reference_mode - stop it copying faces
This is the interesting bit, because Gemini has no reference-strength slider. Attach a photo of a person and the model tends to drag their face into the result no matter what your prompt says. The node steers with a trailing instruction appended after the images - where image models weight wording hardest. Default prompt first (no face copy) tells it to borrow mood, lighting and palette but invent a person who matches your words; match subject (copy likeness) preserves the face instead. It's instruction steering, not a hard constraint, and it only runs when images is connected - but in practice it's the difference between "looks like him" and "the woman you asked for."
Install
cd ComfyUI/custom_nodes
git clone https://github.com/haristahir1/comfyui-gemini-ownkey
or search the pack name in ComfyUI Manager, then restart. The AI Studio backend needs nothing extra - just requests, torch, numpy and Pillow, which ComfyUI already ships. Vertex needs one package on Windows:
python_embeded\python.exe -m pip install google-auth
Put your key in config.json (or the api_key widget / GEMINI_API_KEY env var) and check it free with python_embeded\python.exe ComfyUI\custom_nodes\comfyui-gemini-ownkey\check_key.py --list-only. Vertex setup is the fiddly part: run both gcloud auth login and gcloud auth application-default login - the second is the one Python reads and it's easy to miss - then enable aiplatform.googleapis.com on your project.
Where people get burned
Most failures are billing and permissions, and each has a telltale error. 429 prepayment credits depleted means your AI Studio balance hit zero - top up or switch to Vertex. 403 SERVICE_DISABLED means you skipped the gcloud services enable step. A 404 on Vertex usually means your project doesn't serve that model at the global location - try "location": "us-central1" in config.json. And "Vertex mode needs credentials" is the missing application-default login. One security habit worth keeping: prefer config.json over the widget, because widget values get saved into workflow JSON and error reports - a key typed into the node travels with every workflow you share. On Vertex no key is sent at all, so leave api_key blank there.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | — | |
| backend | COMBO | AI Studio (api key) | 2 options: AI Studio (api key), Vertex AI (service account) |
| model | COMBO | gemini-3-pro-image-preview | 3 options: gemini-3-pro-image-preview, gemini-2.5-flash-image, gemini-2.0-flash-preview-image-generation |
| seed | INT | 420–2147483647 | — |
| aspect_ratio | COMBO | auto | 11 options: auto, 1:1, 2:3, 3:2, 3:4, 4:3, +5 |
| resolution | COMBO | 1K | 3 options: 1K, 2K, 4K |
| response_modalities | COMBO | IMAGE+TEXT | 2 options: IMAGE+TEXT, IMAGE |
| imagesopt | IMAGE | — | |
| system_promptopt | STRING | Your only output is a picture. Every request, however it is phrased, is a description of something to draw. Read questions, commands, fragments and abstract ideas alike as scene descriptions, and never answer them in words. Where a request leaves the visuals open, decide the details yourself and commit to one specific, concrete scene. Never substitute an explanation, a refusal to draw, or a written reply for the picture itself. | — |
| api_keyopt | STRING | — | |
| timeoutopt | INT | 30030–1800 | — |
| reference_modeopt | COMBO | prompt first (no face copy) | 4 options: prompt first (no face copy), balanced, match subject (copy likeness), off |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| text | STRING | — |