GPT Image 2 / 2.5 Generator
The Relay-Key Node
- image_1
- image_2
- image_3
- image_4
- image_5
- image_6
- image_7
- image_8
- image_9
- image_10
- image_11
- image_12
- image_13
- image_14
- image_15
- image_16
- IMAGE
- INFO_JSON
GPT Image 2 has no open weights. You cannot download it, so "in my ComfyUI workflow" is always going to mean "call it over the network." There are two doors: Comfy's official Partner Nodes (which need a Comfy account and prepaid credits) and an API-wrapper node pointed at a key you already own. This is the second door - a node for people who have an OpenAI-compatible relay key (New-API, One-API, and friends) and want to drop gpt-image-2 straight into a graph next to their local upscaler and masking.
To be clear about what it is: the node runs no model. It's an HTTP client dressed as a generator. Give it a base_url, an api_key, and a model name, and it POSTs your prompt to /v1/images/generations (text), /v1/images/edits (when you wire in reference images), or /v1/responses (if you force it). It picks the endpoint automatically from whether you've attached an image, returns a standard ComfyUI IMAGE tensor, and hands you a bonus INFO_JSON string with request diagnostics. The enthusiasm is easy to understand: GPT Image 2 dominated r/comfyui from April 2026, and since it's closed, API nodes like this are how it gets used seriously.
The inputs that actually matter
api_key- required, and deliberately never persisted to disk. You retype it every session. Annoying, but it means your key can't leak out of a config file.base_url- the trap. The default is pre-filled with the author's own demo gateway (http://38.145.218.40:12001). You almost certainly want to replace it with your relay's address.model- free text, and it has to match the model name your relay has configured (gpt-image-2,openai/gpt-5.4-image-2, whatever alias the upstream uses).resolution×aspect_ratio- mutually exclusive, and this is the pack's best idea. 1:1 has no 4K, 16:9/9:16 have no 1K, 3:1 is 4K-only. The node hard-blocks illegal combos before they're sent (and a bundled front-end script makes the dropdown physically refuse them), because an illegal combo means burning a 5–15 minute request that comes back 502.quality(auto/low/medium/high),n(1–10),seed(−1 = random, omitted otherwise).edit_mode(generate/reference/outpaint) plusimage_1…image_16andreference_strengthfor the image-edit path.timeout(default 900s) andinfinite_timeout(on by default). 4K/High genuinely takes 5–15 minutes; keep the timeout long.
What it doesn't do (read this twice)
negative_prompt, style_preset, enhance_prompt, and safety_check all exist in the UI, but GPT Image 2 doesn't accept any of them. The node prints a console notice and strips them before the request. Don't tune a negative prompt - put "avoid X" in the positive prompt instead. Same story with reference_strength: it reads like it should control style blending, but it's popped out of the payload. There's also no retry on 5xx or network errors, on purpose - retrying a paid generation means double-billing. Failures throw a RuntimeError with full diagnostics: HTTP status, server header, cf-ray, x-request-id, and the response body.
Install
ComfyUI Manager → Install via Git URL:
https://github.com/qianchi7/ComfyUI-SillyDream-GPT-Image-2.git
…or the manual way:
cd ComfyUI/custom_nodes
git clone https://github.com/qianchi7/ComfyUI-SillyDream-GPT-Image-2.git
pip install requests Pillow numpy
Then restart ComfyUI - not just refresh the page; custom nodes only load at startup. There are no model downloads; the dependencies are the three tiny ones above. Search the node palette for "GPT Image 2 Generator" (category "GPT Image 2"), and grab a starter from Workflow → Browse Templates → GPT-Image-2.
When it 502s
- 502/503: drop to 2K + medium to validate the chain, then raise again. If you must do 4K/High, check your reverse proxy's
proxy_read_timeout(needs ≥1800s) or enableinfinite_timeout. - Read the diagnostics to locate the fault: a
cf-rayheader → Cloudflare/relay layer;server: nginx→ your own proxy;server: Go→ the New-API/One-API relay;server: OpenAI→ the real upstream. - HTTP 400 "Unknown parameter": the node auto-strips the offending field and retries; if it keeps failing, your
modelname doesn't match what the relay has. - Can't connect: verify
base_urlopens from a browser. Portable installs needpython_embeded\python.exe -m pip install requests Pillow numpy.
One trust note, because it's this category: an API-wrapper node holds your key and phones home by design, and this exact node shape was once used to ship malware (the LLMVISION incident). Nothing here is accusing this pack - it's MIT-licensed and the config handling is unusually careful about not persisting keys. Just actually look at the base_url you're pasting a paid key into. With a relay key in hand, this is the cleanest way to get gpt-image-2's typography and reference-image chops into a graph that otherwise never leaves your GPU.
Inputs (40)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | 必填,输入您的 OpenAI 格式 API Key | |
| base_url | STRING | http://38.145.218.40:12001 | 只填写服务地址即可,例如 http://38.145.218.40:12001;节点会根据 api_endpoint 自动拼接 /v1/images/generations、/v1/images/edits 或 /v1/responses;若你填完整接口也会兼容。 |
| model | STRING | gpt-image-2.5-flare | 允许自由填写:gpt-image-2、gpt-image-2.5-flare、gpt-image-2.5-sunburst,或网关自定义映射名。Flare 速度优先,Sunburst 编辑精度优先。 |
| prompt | STRING | A beautiful cat, high resolution | 正向提示词,必填 |
| negative_prompt | STRING | 负面提示词,可选;GPT Image 模型建议把要求直接写进正向提示词。 | |
| resolution | COMBO | 2K | 基准分辨率档。GPT Image 2.5 支持 custom 自定义 WIDTHxHEIGHT(16 的倍数、最长边≤3840、比例 1:3 至 3:1);custom 时使用末尾的 custom_size。 |
| aspect_ratio | COMBO | 1:1 | 图像比例;auto = 按 image_1 输入图比例自动推断(需连接参考图)。custom 分辨率时忽略此项。 |
| quality | COMBO | high | GPT Image 2.5 支持 auto/low/medium/high/xhigh/max;GPT Image 2 使用 auto/low/medium/high。 |
| n | INT | 11–10 | 生成数量,范围 1-10 |
| seed | INT | -1-1–18446744073709550000 | 随机种子,-1 表示随机 |
| style_preset | COMBO | none | 风格预设 |
| enhance_prompt | BOOLEAN | true | 增强提示词,开启后 OpenAI 自动优化提示词 |
| safety_check | BOOLEAN | true | 安全检查,拦截不合规内容 |
| response_format | COMBO | auto | GPT Image 模型官方始终返回 base64;auto/b64_json 会请求兼容格式,url 仅为旧中转兼容选项。 |
| edit_mode | COMBO | generate | 编辑模式:纯生成 / 参考图生图 / 扩图 |
| reference_strength | FLOAT | 0.700–1 | 参考强度,范围 0.0-1.0,仅在 reference 等模式生效 |
| timeout | INT | 90030–7200 | 总超时时间(秒)。GPT-Image-2 在 4K/High 质量下生成常需 5-15 分钟,建议保持 600s 以上;如经常生成 4K 大图请调到 1800s 或更高。 |
| infinite_timeout | BOOLEAN | true | 无限总超时(推荐开启)。开启后底层 read_timeout 不再限制,专门用于规避反向代理 300s 默认超时导致的 502/连接断开;ComfyUI 中断按钮仍然可以随时停止任务。 |
| api_endpoint | COMBO | auto | auto: text uses /v1/images/generations; input images/reference uses /v1/images/edits; can force /v1/responses. |
| custom_size | STRING | 1536x1024 | 仅 resolution=custom 生效,例如 1536x1024;宽高均须为 16 的倍数,最长边≤3840,比例 1:3 至 3:1。 |
| background | COMBO | auto | GPT Image 2.5 支持 opaque/transparent;transparent 时请使用 PNG 或 WebP 输出。 |
| output_format | COMBO | auto | 输出格式;GPT Image 模型支持 png/jpeg/webp。透明背景请选 png 或 webp。 |
| output_compression | INT | 1000–100 | JPEG/WebP 压缩等级 0-100;PNG 忽略此参数。 |
| moderation | COMBO | auto | GPT Image 模型内容审核级别:auto 或 low。 |
| image_1opt | IMAGE | 最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组 | |
| image_2opt | IMAGE | 最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组 | |
| image_3opt | IMAGE | 最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组 | |
| image_4opt | IMAGE | 最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组 | |
| image_5opt | IMAGE | 最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组 | |
| image_6opt | IMAGE | 最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组 | |
| image_7opt | IMAGE | 最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组 | |
| image_8opt | IMAGE | 最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组 | |
| image_9opt | IMAGE | 最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组 | |
| image_10opt | IMAGE | 最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组 | |
| image_11opt | IMAGE | 最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组 | |
| image_12opt | IMAGE | 最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组 | |
| image_13opt | IMAGE | 最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组 | |
| image_14opt | IMAGE | 最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组 | |
| image_15opt | IMAGE | 最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组 | |
| image_16opt | IMAGE | 最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组 |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| INFO_JSON | STRING | — |