GPT Image Generate
Nano Banana and friends over a streaming chat API
- image_1
- image_2
- image
If the general ChatImageBridge node is your Swiss-army endpoint client, GPTImage is the one tuned specifically for the GPT Image / Nano Banana family - gpt-image-2-vip, gpt-image-2, nano-banana, nano-banana-2, and nano-banana-pro. These are the closed Google/OpenAI image models the KB's closed-source-models.md catalogs: Nano Banana Pro is Gemini 3 Pro Image with 4K native output and "thinking mode", Nano Banana 2 is the 3.1 Flash speed-quality hybrid, and GPT Image is OpenAI's natively-multimodal image model. You're not running any of that locally - this node is a client for a relay that fronts them, which is the whole point. The heavy lifting happens in someone else's data center; your GPU stays cool.
How it works
Where the generic node uses non-streaming chat completions, this one streams the response ("stream": true). The README says that's deliberate: image generation can take a while, and a streaming request is far less likely to trip Cloudflare or an upstream gateway timeout than sitting on one long non-streaming call. When the provider returns an image as a direct URL in the stream, the node downloads it and converts it to a tensor; it also handles b64_json and markdown references.
The part worth understanding is the size math, because it's not just passed through. When both resolution and aspect_ratio are explicit, the node looks up a concrete pixel size and sends it as the size field:
4K + 16:9 -> 3840x2160
2K + 1:1 -> 2048x2048
1K + 9:16 -> 720x1280
If either is auto, it doesn't error out - it just skips size and writes your intent into the message as a hint ("Target image resolution: 4K."), letting the provider interpret it semantically.
Inputs and outputs
The essentials are api_key, base_url, model (a dropdown with the five models above), and prompt. Then resolution (default 1K), aspect_ratio (default 1:1), and timeout_seconds (default 600, 60–3600 - generous, because streaming long generations is the whole design). image_1 and image_2 are optional and get attached as reference images when present. Output is a single image tensor, straight to Save Image.
The trap: resolution limits
Not every model takes every resolution. The node enforces this per model:
| Model | Allowed |
| --- | --- |
| gpt-image-2-vip | 1K, 2K, 4K |
| gpt-image-2 | 1K only |
| nano-banana | 1K only |
| nano-banana-2 | 1K, 2K, 4K |
| nano-banana-pro | 1K, 2K, 4K |
Pick 2K on plain gpt-image-2 and the node throws on purpose rather than fire a doomed request and burn your credits. The error message tells you what the model supports. People hit this constantly because the default resolution is 1K and then they bump it - read the error instead of fighting it.
Install
Part of the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/Marigold1122/Chat-Image-Bridge-Node.git ComfyUI-ChatImageBridge
pip install -r ComfyUI-ChatImageBridge/requirements.txt
Restart, then api -> Chat Image Bridge -> GPT Image Generate (or ComfyUI Manager, search "Chat-Image-Bridge-Node"). Just requests for a dependency.
Troubleshooting
- SSL errors behind a proxy - the streaming code has a real-world quirk worth knowing: if the first request hits an SSL error, it retries once with environment proxy settings disabled, because corporate proxies frequently break these relays.
- "GPT Image stream did not contain image data" - the provider streamed text but no image, usually a refusal or a non-image response. The error shows a preview of what came back.
- Long generations - if the stream just hangs, check
timeout_seconds; the default 600s is there because these models genuinely take minutes at 4K. - A streaming provider must actually stream - a few relays advertise compatibility but return a single non-streaming blob, which this node also tolerates in practice. If yours fails consistently, the plain
ChatImageBridgenode is the fallback for the same endpoint.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | — | |
| base_url | STRING | — | |
| model | COMBO | gpt-image-2-vip | 5 options: gpt-image-2-vip, gpt-image-2, nano-banana, nano-banana-2, nano-banana-pro |
| prompt | STRING | — | |
| resolution | COMBO | 1K | 4 options: auto, 1K, 2K, 4K |
| aspect_ratio | COMBO | 1:1 | 11 options: auto, 1:1, 16:9, 9:16, 4:3, 3:4, +5 |
| timeout_seconds | INT | 60060–3600 | — |
| image_1opt | IMAGE | — | |
| image_2opt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |