Nodes/Duanyll Nodepack/OpenAI Image Edit
ComfyUI Node

OpenAI Image Edit

Gpt-image inpainting and edits straight from your graph

By Duanyll·Created about a year ago·Updated 4 months ago· 2
OpenAI Image Edit
  • client
  • images
  • mask
  • extra_body
  • image
  • response
prompt
modelgpt-image-2
sizeauto
custom_size
qualityauto
backgroundauto
input_fidelityauto
output_formatauto
output_compression100
moderationauto
n1
user

OpenAI Image Edit is the pack's paid-API shortcut: it sends your image (and optionally a mask) to OpenAI's gpt-image editing endpoint and gets back a finished edit - no local model, no VRAM, just money. If you've ever wanted the polish of a frontier image model mid-workflow without running a 12B model locally, this is the node. It pairs with the pack's Create OpenAI Client, which handles the key and the HTTP plumbing.

This is the edit half, so it's built for instruction-style changes: "change the background," "make the person smile," "replace the car with a bicycle." If you feed it a mask, it becomes inpainting - the model only touches the masked region. No mask, and it's a full-image edit where the prompt rules. Either way, the heavy lifting happens on OpenAI's servers, so the node is really just a well-formed API call plus image decoding back to a ComfyUI tensor.

What you set

  • client - an OPENAI_CLIENT from Create OpenAI Client. Required; there's no bypass.
  • images - what you're editing. A tensor from any image source.
  • prompt - the instruction. This is 90% of the quality right here.
  • mask (optional) - restrict edits to a region. Must match the image's dimensions.
  • model - defaults to gpt-image-2; gpt-image-1, gpt-image-1.5, gpt-image-1-mini, and dall-e-2 are the other options.
  • size - auto lets the model pick, or force one of the presets like 1024x1024 or 2048x2048; custom lets you type your own.
  • background, input_fidelity, quality, output_format - the expected gpt-image controls for transparency, how closely to stick to the source, and output encoding.

Two outputs: image (the edited tensor, ready for a Save Image node) and response (the raw API response object, useful if you want the model name or metadata that got used).

Install

ComfyUI Manager → "Duanyll Nodepack" → install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/Duanyll/duanyll_nodepack
cd duanyll_nodepack && pip install -r requirements.txt

The pack's requirements pull in opencv-python-headless, kornia, insightface, matplotlib, and the Volcengine Ark SDK regardless - this node only genuinely needs requests.

The fine print nobody tells you

This costs real money, per image, and the n input (up to 10) multiplies that. Watch it. Also, gpt-image edits run at a fixed native resolution and get resized to match the API's requirements, so if your input is odd-sized, expect the result to come back at a different resolution than you sent - check size if that matters.

The other gotcha is the upload path. The client it depends on supports two upload modes, multipart_form (default) and json_base64; the field name matters for some OpenAI-compatible proxies, so if a third-party endpoint keeps rejecting your requests, flip image_upload_mode and the multipart_image_field on the client node and retry.

The honest framing: this is an obscure pack, and nobody's writing guides about it. For a genuinely local alternative you'd run Flux Kontext or Qwen-Image-Edit (both of which this pack also touches) - but if you specifically want the gpt-image results in your workflow, this is the only path, and it works.

Categoryduanyll/models/openai

Inputs (16)

NameTypeDefaultDescription
clientOPENAI_CLIENT
imagesIMAGE
promptSTRING
maskoptMASK
modeloptCOMBOgpt-image-25 options: gpt-image-2, gpt-image-1.5, gpt-image-1, gpt-image-1-mini, dall-e-2
sizeoptCOMBOauto11 options: auto, custom, 1024x1024, 1536x1024, 1024x1536, 2048x2048, +5
custom_sizeoptSTRING
qualityoptCOMBOauto5 options: auto, high, medium, low, standard
backgroundoptCOMBOauto3 options: auto, transparent, opaque
input_fidelityoptCOMBOauto3 options: auto, high, low
output_formatoptCOMBOauto4 options: auto, png, jpeg, webp
output_compressionoptINT1000–100
moderationoptCOMBOauto2 options: auto, low
noptINT11–10
useroptSTRING
extra_bodyopt*

Outputs (2)

NameTypeDescription
imageIMAGE
response*