URL图像编辑丨API
Inpaint or edit through any OpenAI-compatible image endpoint
- image
- image2
- image3
- mask
- image
- raw_response
- status
- debug_info
The OpenAI images/edit endpoint - the one that takes a picture, an instruction, and optionally a mask, and returns an edited image - is the shape behind a lot of hosted inpainting and style work. CustomURLImageEditAPI is the QING node that exposes it against any OpenAI-compatible service: an official OpenAI key, a Chinese gateway that mirrors the format, or a self-hosted proxy. It sends your image(s) and prompt as a multipart edit request, and if you wire a mask in, that becomes an inpainting-style edit where only the masked region changes.
It's part of ComfyUI-QING's API category. Unlike the language/vision chat nodes, this one returns images, not text: image comes back as an IMAGE tensor ready to feed a preview or save node.
How it works. The node builds a multipart request to your base_url (root or /v1 accepted) using the model and prompt you supply. Details worth knowing from the source: when you connect multiple images (image2, image3), they're submitted as image[] fields; the optional mask goes out as a mask field - that's the inpainting hook. size (default 1024x1024) sets the output dimensions and is omitted from the request if you leave it blank. n controls how many images come back (1–4) and returns them as an IMAGE batch. response_format is the fork: b64_json (default) expects the image inline as base64, url expects the service to return a URL the node fetches - pick whichever your endpoint actually speaks.
The inputs that matter.
prompt- the edit instruction.image- required; the primary image to edit.base_urlandmodel- your endpoint and its model ID.size,n,response_format- the output controls above.api_key_override- set it per-node, or rely onCUSTOM_URL_API_KEY/ QING settings.- Optional:
image2/image3,mask,custom_headers_json,extra_body_json,timeout_sec(180).
Outputs: image (IMAGE), raw_response, status, debug_info.
How to install. ComfyUI-QING is a one-pack install - search "ComfyUI-QING" in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/GAO-SHIQING/ComfyUI-QING
cd ComfyUI-QING
python install_dependencies.py
The openai dependency is in the pack's requirements. Restart after installing. The README's clone URL is typo'd (GAOSHI-QING, missing the H) - use the URL above or Manager.
Troubleshooting. The response_format mismatch is the first thing to check when you get an empty image: if the service returns URLs but the node is set to b64_json, nothing decodes. Read status/debug_info - that's what they're for. Second: mask support is endpoint-dependent; if your service doesn't accept a mask field, it'll reject the request, and you're doing straight edits instead of inpainting. Third, edit endpoints are picky about size - some models only accept their own supported sizes, so a custom size that the server rejects will 400; blank it to let the server default. And the usual API-node reminders: your images leave the machine to the endpoint, the service's content policy applies, and per-call cost adds up faster than you think if you're iterating edits in a loop.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | 图像编辑指令 | |
| custom_headers_json | STRING | 可选JSON对象,例如 {"X-API-Key":"..."} | |
| extra_body_json | STRING | 可选JSON对象,会作为multipart字段提交 | |
| image | IMAGE | 要编辑的主图像 | |
| base_url | STRING | OpenAI兼容服务地址,可填根地址或 /v1 | |
| model | STRING | 图像编辑模型ID,按自定义服务实际名称填写 | |
| api_key_override | STRING | 仅当前节点生效;留空时读取 CUSTOM_URL_API_KEY 或 QING custom_url_api_key | |
| size | STRING | 1024x1024 | 输出尺寸,如 1024x1024;留空则不提交 |
| n | INT | 11–4 | 生成图片数量,返回为IMAGE批次 |
| response_format | COMBO | b64_json | 服务端返回图片格式 |
| timeout_sec | INT | 1805–900 | — |
| image2opt | IMAGE | 可选第二张参考图;连接多图时所有图像按 image[] 字段提交 | |
| image3opt | IMAGE | 可选第三张参考图;连接多图时所有图像按 image[] 字段提交 | |
| maskopt | MASK | 可选编辑遮罩,按 mask 字段提交 |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| raw_response | STRING | — |
| status | STRING | — |
| debug_info | STRING | — |