API Image Generate (BYOK)
API Image Generate (BYOK)
- IMAGE
What this thing actually is
Some models you are never going to run locally, because nobody released the weights. Nano Banana, Imagen - Google ships them API-only and always will. If you want them inside a graph next to your local upscaler and your masking, a node that makes an HTTP call is the only door. This is that door for still images.
"BYOK" is the whole story: bring your own key. Set GEMINI_API_KEY on the ComfyUI server and the node calls Google directly, at Google's rate. ComfyUI's official Partner Nodes do the same models through your Comfy account and prepaid credits; this skips the middleman. And it uses zero VRAM - your 8GB card stays free for the local parts of the graph while a 4K-capable model renders in the cloud. You pay per image instead of per second, and your prompt and reference images leave your machine. That's the trade.
How it works
LiteLLM does the provider translation underneath. Text-to-image goes through aimage_generation, image-to-image through aimage_edit. No polling, no queue - one request, and the returned base64 images become a ComfyUI IMAGE tensor. A short freeze, then pixels.
Two details explain most of the weirdness. The model list is hardcoded - Imagen 4, Imagen 4 Fast, Imagen 3, plus three Nano Banana ids - because "gemini" also appears in ordinary chat model names, so a live list can't be filtered safely. And Imagen vanishes when you pick image as the source: not a bug, it has no edit endpoint in litellm, so image-to-image is Nano Banana only. Those natively accept a list of references, which is why this node can send several refs in one call.
The fields that matter
prompt is a multiline string. Everything else hangs off source, a dynamic combo with two options:
source: text- text-to-image. Revealsprovider(Gemini only for now), thenmodel, then that model's settings.source: image- image-to-image. Nano Banana only, and it adds areference_imagesocket.
You'll actually touch size - exactly three options, 1024x1024, 1792x1024, 1024x1792, no free-form dimensions - and num_images, 1 to 4. Above 1, results come back as one batched IMAGE tensor, so a Save Image node writes four files instead of one. There's no multi-image input socket either: batch your references upstream with a Batch Images node and wire that into reference_image.
The single output is IMAGE, into Save Image, Preview Image, or straight into another generation node.
One optional field, api_key, and the author's tooltip says what you need: leave it blank. Anything typed there gets saved into the workflow JSON and into output file metadata, which in ComfyUI means it rides inside the PNG.
Install
Via ComfyUI Manager, search ComfyUI_ExternalAPI. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/andy-ratsirarson/ComfyUI_ExternalAPI.git
cd ComfyUI_ExternalAPI
pip install -r requirements.txt
Then restart. Dependencies are litellm==1.100.0 and google-genai==1.47.0 and nothing else - no weights, no CUDA wheels, no gigabytes. The one hard requirement is a reasonably current ComfyUI: the pack is written against the newer backend authoring API (comfy_api.latest, io.ComfyNode, io.Schema), so on an old build it won't register at all. And don't go grepping for NODE_CLASS_MAPPINGS to check it installed - a modern pack legitimately has none.
Where people get burned
The key has to be in the server's environment at startup. If ComfyUI launched without GEMINI_API_KEY, the node can't authenticate. Put it in the same shell, systemd unit or Docker env that launches ComfyUI, restart, then run. Setting it in your own terminal does nothing if ComfyUI runs under a service manager.
Google's filter is what refuses you, not ComfyUI's. This pack rewrites raw provider errors into readable English, including a specific message for content-safety refusals that tells you to tone the wording down and retry - nicer than most API nodes. But the refusal is still the model's, and Nano Banana is aggressively filtered; a January 2026 policy update tightened it further around celebrity and famous-IP prompts.
Every image costs money, and higher resolutions cost more. Fire off a batch of four at the wrong size and you'll notice. That's the honest price of the one thing local can't give you.
One security note you shouldn't skim, because it covers this whole category. A custom node is arbitrary Python with full OS access, running the moment ComfyUI loads it, and this one's purpose is to hold a credential and call the network - so a malicious version's phone-home would look completely normal. Not hypothetical: a node called ComfyUI_LLMVISION shipped credential-stealing malware. This pack has essentially no footprint in the community threads, which cuts both ways: nothing bad is known about it, and nobody has vouched for it either. It's short and it's MIT. Read it before you give it a key.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Text description of the image to generate. | |
| source | COMBO | Generation source: a text prompt alone, or a text prompt plus reference image(s). | |
| api_keyopt | STRING | Overrides the provider's standard env var (e.g. GEMINI_API_KEY) when set. Warning: unlike an env var, this value is saved into the workflow JSON and into output file metadata. Prefer leaving this blank and setting the env var on the ComfyUI server instead. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |