Nodes/Comfyui-zhenzhen/zhenzhen-gpt-image-2-official
ComfyUI Node

zhenzhen-gpt-image-2-official

Aspect Ratios, 4K, and Async Polling

By T8mars·Created 12 months ago·Updated about 16 hours ago· 725
zhenzhen-gpt-image-2-official
  • image1
  • image2
  • image3
  • image4
  • image5
  • image6
  • image7
  • image8
  • image9
  • image10
  • image11
  • image12
  • image13
  • image14
  • image15
  • image16
  • mask
  • image
  • image_url
  • response
prompt
api_key
modelgpt-image-2
n1
qualityauto
sizeauto
backgroundauto
output_formatpng
output_compression100
moderationauto
async_modetrue
webhook
max_poll_attempts300
poll_interval5
max_retries5
initial_timeout900
seed0
skip_errorfalse

This is the flagship OpenAI image node in the Comfly pack, and the name says the important part: official. The earlier GPT Image nodes ride the proxy's reverse-engineered "default" group, which is cheap but wobbly. This one hits the real GPT Image 2 API - which is why it's the node with the grown-up parameter list: a real aspect-ratio menu, 1K/2K/4K resolution control, up to five reference images, a mask input for inpainting, and an async submit-and-poll mode so long generations don't just sit there with a spinner.

If you want GPT Image 2 and you want it to behave, this is the node. It's the one I'd wire into a product-shot or design workflow, because the resolution and aspect controls are the difference between "whatever comes back" and "the thing that fits my canvas."

How it works

Prompt (and any of image1–image5 plus an optional mask) goes to the GPT Image 2 API through the Comfly proxy. Two flavors of wait: with async_mode on (the default) the node submits the task, then polls at poll_interval seconds up to max_poll_attempts times - you can also give it a webhook and let the proxy call you instead. With async off, it's the blocking request/response style. Either way you get an IMAGE tensor, a hosted image_url, and the raw response.

The inputs that matter

  • model - gpt-image-2 (default), gpt-image-2-vip, plus the newer gpt-image-2-2K and gpt-image-2-4K variants. The 2K/4K model names bake the resolution into the model, so pair them with the right resolution setting (the README notes these are pay-per-tier).
  • aspect_ratio - thirteen ratios from 21:9 to 9:16, default 1:1. This is the control the earlier GPT Image nodes don't give you - pick your canvas instead of cropping afterward.
  • resolution - 1k / 2k / 4k, default 1k. Bigger costs more; 2K is the sweet spot for anything you'll actually use.
  • image1–image5 - reference images. GPT Image 2 edits and composites from these; wire in your subject or style reference.
  • mask - a MASK input for proper inpainting: mask the region you want regenerated.
  • quality / background / output_format / output_compression - the usual quality triad. output_compression (0100, default 100) trades file size for fidelity; background here is just auto/opaque (the transparent trick is the plain gpt_image node's game).
  • moderation - auto/low.
  • async_mode, webhook, max_poll_attempts, poll_interval, max_retries, initial_timeout - the reliability toolkit. If generations keep timing out, raise initial_timeout (default 900) or max_poll_attempts rather than crossing your fingers.
  • seed - reproducible takes; n - 1–10 images (billed per image).

Outputs: image (IMAGE), image_url (STRING), response (STRING).

Install

Manager → Comfyui_Comfly, or:

cd ComfyUI/custom_nodes
git clone https://github.com/ainewsto/Comfyui_Comfly

Restart. Usual requirements.txt (aiohttp, requests, Pillow, numpy, plus the torch/transformers you already run) - no weights to fetch. Key from ai.comfly.chat in Comflyapi.json or the node's api_key.

Where people get burned

The trap is forgetting you configured a 4K, high-quality, n=4 run and then wondering why the credit meter moved a lot. Also, async_mode means the node can sit polling for a while - if you're running a big batch, bump poll_interval a bit so you're not hammering the status endpoint. And the VIP/4K model tiers are real price steps, so read the proxy's price list before you make "gpt-image-2-4K" your default.

Categoryzhenzhen/Openai

Inputs (35)

NameTypeDefaultDescription
promptSTRING
image1optIMAGE
image2optIMAGE
image3optIMAGE
image4optIMAGE
image5optIMAGE
image6optIMAGE
image7optIMAGE
image8optIMAGE
image9optIMAGE
image10optIMAGE
image11optIMAGE
image12optIMAGE
image13optIMAGE
image14optIMAGE
image15optIMAGE
image16optIMAGE
maskoptMASK
api_keyoptSTRING
modeloptCOMBOgpt-image-24 options: gpt-image-2, gpt-image-2-all, gpt-image-2-2K, gpt-image-2-4K
noptINT11–10
qualityoptCOMBOauto4 options: auto, high, medium, low
sizeoptCOMBOauto8 options: auto, 1024x1024, 1536x1024, 1024x1536, 2048x2048, 2048x1152, +2
backgroundoptCOMBOauto2 options: auto, opaque
output_formatoptCOMBOpng3 options: png, jpeg, webp
output_compressionoptINT1000–100
moderationoptCOMBOauto2 options: auto, low
async_modeoptBOOLEANtrue
webhookoptSTRING
max_poll_attemptsoptINT30010–1000
poll_intervaloptINT52–60
max_retriesoptINT51–10
initial_timeoutoptINT90060–1200
seedoptINT00–18446744073709550000
skip_erroroptBOOLEANfalse开启后,节点失败时不报错、按旧行为返回默认空结果;关闭时(默认)失败直接抛出错误。

Outputs (3)

NameTypeDescription
imageIMAGE
image_urlSTRING
responseSTRING