Nodes/comfyui-PD_comfy-api-node/PD: Gemini Image (ComfyUI AuthToken)
ComfyUI Node

PD: Gemini Image (ComfyUI AuthToken)

The Gemini image node for people who don't want to mint an API key

By 7BEII·Created 10 months ago·Updated 9 days ago· 2
PD: Gemini Image (ComfyUI AuthToken)
  • images
  • files
  • image
  • info
auth_token
promptA futuristic city with flying cars
modelgemini-2.5-flash-image
aspect_ratioauto
resolution1K
seed0
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 same Gemini image generation as PD: Gemini Image (ComfyUI Key) - same engine, same proxy - but it authenticates with a browser auth token instead of an API key. If the words "mint a ComfyUI API key, watch the credits" make you hesitate, this variant exists so you can instead paste the token your logged-in ComfyUI session already has, and generate against your existing account.

The two auth flavors, explained once

The whole comfyui-PD_comfy-api-node pack comes in two flavors per model. The apikey nodes send your key in the X-API-KEY header; the AuthToken nodes send a JWT as Authorization: Bearer <token>. The token is the same auth_token_comfy_org value your ComfyUI web/desktop session stores after you log in on comfy.org.

Getting it is fiddly on purpose, so the pack bundles a Tampermonkey userscript at temperay/PD_comfyui_token_grabber.user.js. Install it, load your ComfyUI session, log in, and the script extracts the JWT from the app's localStorage and copies it for you (the author points to a Bilibili tutorial for the full walkthrough). Paste it into the node's auth_token field. When the token stops working - it's a login token, so it expires - run the grabber again.

What's different from the API key version

Inputs are the same shape: prompt, model (gemini-2.5-flash-image / preview), aspect_ratio (a slightly different set here, including 9:21), seed, plus optional images, files, and the preloaded system_prompt. Two notable extras:

  • resolution - auto, 1K, 2K, or 4K. The API key variant doesn't expose this for Gemini; the token path lets you push past 1K.
  • Outputs stay image + info - no price string here, because you're not paying per-call through a metered key the same way.

Everything else - the proxy endpoint at api.comfy.org/proxy/vertexai/gemini/..., the base64 inline images, the tensor decoding - is identical to the key version.

Why pick the token route?

The appeal is real for casual users: no API key management, and you use the permissions you already have. The cost is fragility. Auth tokens are not meant to be pasted into third-party nodes, they expire, and they're tied to your account session - which is exactly why the README calls this the "advanced user" path and the API key the recommended one. If you're building a workflow you'll share or run unattended, an API key is the less annoying dependency. If you just want to fiddle with Gemini image gen tonight without opening another billing dashboard, the token route gets you there fastest.

Installing and troubleshooting

Same install as every node in the pack - clone into custom_nodes, restart, find it under PD_Tools/Image_Generation. Watch for:

  • 401/403 responses - stale or expired token. Re-grab it.
  • Black image output - the error placeholder; the message in info is the real signal.
  • "Bearer" confusion - the node strips a leading Bearer prefix if you paste the whole header value, so don't stress about exact format.

If the token dance ever feels like too much ceremony, the sibling PD: Gemini Image (ComfyUI Key) node is one key away from the same result.

CategoryPD_Tools/Image_Generation

Inputs (9)

NameTypeDefaultDescription
auth_tokenSTRING
promptSTRINGA futuristic city with flying carsDescribe what you want to generate
modelCOMBOgemini-2.5-flash-image2 options: gemini-2.5-flash-image, gemini-2.5-flash-image-preview
aspect_ratioCOMBOauto8 options: auto, 1:1, 16:9, 9:16, 4:3, 3:4, +2
resolutionCOMBO1K4 options: auto, 1K, 2K, 4K
seedINT00–18446744073709550000
imagesoptIMAGEReference image(s) for image-to-image generation
filesoptGEMINI_INPUT_FILES
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.Optional system instructions

Outputs (2)

NameTypeDescription
imageIMAGE
infoSTRING