Gemini Web Automation (Playwright)
Gemini Image Output Inside ComfyUI, Without an API Key or a Cent Spent
- input_image
- text_response
- output_image
This node is a workaround wearing a trench coat, and it mostly works. Gemini's image generation - the Nano Banana line - has no open weights, and the official way to get it into ComfyUI is a paid API with a Google Cloud billing account. GeminiWebAutomation sidesteps all of that by driving the free gemini.google.com web app in a real browser and dropping the result back into your graph. No API key, no credits, no model downloads. It's the "free hosted tier" branch of the external-API pattern (see the KB's external-api-nodes.md), turned up to eleven: instead of calling a free endpoint, it types into a web page like a person would.
That framing tells you both what it's for and where it's fragile. It's for people who want Gemini's vision and image output inside a workflow - caption an image, get Gemini to describe or rewrite something, generate a frame that then feeds your local upscaler or a video model - without opening a Google Cloud account. The catch: everything you send goes through a browser session logged into your actual Google account. Same privacy, content filters, and free-tier limits as using Gemini web yourself, because that is literally what you're doing.
How it actually works
The ComfyUI node is a thin HTTP client. It takes your prompt (and, optionally, an image tensor, converted to a PNG in ComfyUI's temp folder), POSTs a JSON payload to http://127.0.0.1:8000/chat, and waits - up to 600 seconds - for the response. The real work happens in a separate server, HP-Gemini-Browser-API, also by this author: a Playwright process that opens a real browser, pastes your prompt into Gemini, uploads your image if there is one, and hands back whatever Gemini returns - a text string and a list of image paths. The node parses that, loads the images back into an IMAGE tensor, and returns them. On any failure it returns an error string plus a blank 64×64 image instead of crashing your whole graph.
The inputs that matter
Five required, one optional. These are the ones you'll actually touch:
- user_input - the prompt sent to Gemini. Multiline. Defaults to "描述这张图片" ("describe this image"), a tell that this pack is Chinese-authored; you'll want to change it.
- api_url - where the local server listens. Leave it at
http://127.0.0.1:8000/chatunless you moved the server. - new_chat - on by default, meaning each send starts a fresh conversation. Flip it off to keep chatting in the same thread if you're building a multi-step dialogue.
- seed - and here's the trap. This is not a diffusion seed. It's a re-send trigger. Per the README, unless you change the seed, ComfyUI only sends identical content once and later re-sends get ignored. Bump the seed (or randomize it) to force the same prompt through again.
- ratio -
auto/16:9/1:1, the output aspect ratio. The README is honest that this is "essentially a statement that can be included in the prompt" - it's injected as text rather than set natively, so just write the ratio inuser_inputand skip this field. - input_image (optional) - an
IMAGEto attach so Gemini can see it. This is what powers captioning and image-editing workflows.
Outputs: text_response (STRING - wire it to a Show Text or Save Text node, or into a prompt template) and output_image (IMAGE - wire it to a Preview/Save, or on to an upscaler).
Installing it
Via ComfyUI Manager, search "ComfyUI-HP-GeminiWebAutomation", or clone it by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/50486787/ComfyUI-HP-GeminiWebAutomation
Then restart ComfyUI. The node itself is dependency-light - requests, Pillow, and torch, which ComfyUI already ships. The real install is the other repo: HP-Gemini-Browser-API running on 127.0.0.1:8000 with Playwright's Chromium installed and a browser profile logged into Google, with Gemini's web UI able to answer in that profile. Without that server up, the node hands you a connection error that, per the source, literally reads "check whether server.py is running." No model files to download anywhere in this stack.
Where people get burned
The seed/"fix" behavior confuses everyone first - identical content with an unchanged seed silently doesn't re-send, and it looks like the node broke. The author also hit keep-alive connection resets and hard-coded Connection: close plus a retry loop to deal with it, so a retry in the console is normal. Two more things before you trust it for anything important: the 600-second timeout means a slow Gemini generation looks hung when it isn't, and because this drives a live Google session, the whole thing can snap whenever Google changes the web UI. It's a clever free hack, not infrastructure - for a vetted, stable path to Gemini's closed image models, the official ComfyUI API nodes are the boring choice.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| user_input | STRING | 描述这张图片 | — |
| api_url | STRING | http://127.0.0.1:8000/chat | — |
| seed | INT | 00–18446744073709550000 | — |
| new_chat | BOOLEAN | true | — |
| ratio | COMBO | 3 options: auto, 16:9, 1:1 | |
| input_imageopt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| text_response | STRING | — |
| output_image | IMAGE | — |