Nodes/SillyDream GPT-Image-2 / 2.5 Generator/GPT Image 2 / 2.5 Generator
ComfyUI Node

GPT Image 2 / 2.5 Generator

The Relay-Key Node

By qianchi7·Created about a month ago·Updated 7 days ago· 2
GPT Image 2 / 2.5 Generator
  • 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
api_key
base_urlhttp://38.145.218.40:12001
modelgpt-image-2.5-flare
promptA beautiful cat, high resolution
negative_prompt
resolution2K
aspect_ratio1:1
qualityhigh
n1
seed-1
style_presetnone
enhance_prompttrue
safety_checktrue
response_formatauto
edit_modegenerate
reference_strength0.70
timeout900
infinite_timeouttrue
api_endpointauto
custom_size1536x1024
backgroundauto
output_formatauto
output_compression100
moderationauto

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) plus image_1image_16 and reference_strength for the image-edit path.
  • timeout (default 900s) and infinite_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 enable infinite_timeout.
  • Read the diagnostics to locate the fault: a cf-ray header → 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 model name doesn't match what the relay has.
  • Can't connect: verify base_url opens from a browser. Portable installs need python_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.

CategoryGPT Image 2

Inputs (40)

NameTypeDefaultDescription
api_keySTRING必填,输入您的 OpenAI 格式 API Key
base_urlSTRINGhttp://38.145.218.40:12001只填写服务地址即可,例如 http://38.145.218.40:12001;节点会根据 api_endpoint 自动拼接 /v1/images/generations、/v1/images/edits 或 /v1/responses;若你填完整接口也会兼容。
modelSTRINGgpt-image-2.5-flare允许自由填写:gpt-image-2、gpt-image-2.5-flare、gpt-image-2.5-sunburst,或网关自定义映射名。Flare 速度优先,Sunburst 编辑精度优先。
promptSTRINGA beautiful cat, high resolution正向提示词,必填
negative_promptSTRING负面提示词,可选;GPT Image 模型建议把要求直接写进正向提示词。
resolutionCOMBO2K基准分辨率档。GPT Image 2.5 支持 custom 自定义 WIDTHxHEIGHT(16 的倍数、最长边≤3840、比例 1:3 至 3:1);custom 时使用末尾的 custom_size。
aspect_ratioCOMBO1:1图像比例;auto = 按 image_1 输入图比例自动推断(需连接参考图)。custom 分辨率时忽略此项。
qualityCOMBOhighGPT Image 2.5 支持 auto/low/medium/high/xhigh/max;GPT Image 2 使用 auto/low/medium/high。
nINT11–10生成数量,范围 1-10
seedINT-1-1–18446744073709550000随机种子,-1 表示随机
style_presetCOMBOnone风格预设
enhance_promptBOOLEANtrue增强提示词,开启后 OpenAI 自动优化提示词
safety_checkBOOLEANtrue安全检查,拦截不合规内容
response_formatCOMBOautoGPT Image 模型官方始终返回 base64;auto/b64_json 会请求兼容格式,url 仅为旧中转兼容选项。
edit_modeCOMBOgenerate编辑模式:纯生成 / 参考图生图 / 扩图
reference_strengthFLOAT0.700–1参考强度,范围 0.0-1.0,仅在 reference 等模式生效
timeoutINT90030–7200总超时时间(秒)。GPT-Image-2 在 4K/High 质量下生成常需 5-15 分钟,建议保持 600s 以上;如经常生成 4K 大图请调到 1800s 或更高。
infinite_timeoutBOOLEANtrue无限总超时(推荐开启)。开启后底层 read_timeout 不再限制,专门用于规避反向代理 300s 默认超时导致的 502/连接断开;ComfyUI 中断按钮仍然可以随时停止任务。
api_endpointCOMBOautoauto: text uses /v1/images/generations; input images/reference uses /v1/images/edits; can force /v1/responses.
custom_sizeSTRING1536x1024仅 resolution=custom 生效,例如 1536x1024;宽高均须为 16 的倍数,最长边≤3840,比例 1:3 至 3:1。
backgroundCOMBOautoGPT Image 2.5 支持 opaque/transparent;transparent 时请使用 PNG 或 WebP 输出。
output_formatCOMBOauto输出格式;GPT Image 模型支持 png/jpeg/webp。透明背景请选 png 或 webp。
output_compressionINT1000–100JPEG/WebP 压缩等级 0-100;PNG 忽略此参数。
moderationCOMBOautoGPT Image 模型内容审核级别:auto 或 low。
image_1optIMAGE最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组
image_2optIMAGE最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组
image_3optIMAGE最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组
image_4optIMAGE最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组
image_5optIMAGE最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组
image_6optIMAGE最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组
image_7optIMAGE最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组
image_8optIMAGE最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组
image_9optIMAGE最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组
image_10optIMAGE最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组
image_11optIMAGE最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组
image_12optIMAGE最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组
image_13optIMAGE最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组
image_14optIMAGE最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组
image_15optIMAGE最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组
image_16optIMAGE最多支持16张参考图;auto 下会走 /v1/images/edits multipart,强制 generations 时才放入 JSON image 数组

Outputs (2)

NameTypeDescription
IMAGEIMAGE
INFO_JSONSTRING