Nodes/ComfyUI-dapaoAPI/通用图像生成(图像编辑)@炮老师的小课堂
ComfyUI Node

通用图像生成(图像编辑)@炮老师的小课堂

One node for every OpenAI-compatible /images/edits API, with multi-image support

By paolaoshi·Created 10 months ago·Updated a day ago· 217
通用图像生成(图像编辑)@炮老师的小课堂
  • 🖼️ 图像1
  • 🖼️ 图像2
  • 🖼️ 图像3
  • 🖼️ 图像4
  • 🖼️ 图像
  • ℹ️ 信息
  • 📄 原始JSON
📝 编辑提示词请根据输入图片进行编辑,保持主体清晰,提升画面质量
🌐 API地址https://api.openai.com/v1/images/edits
🔑 API密钥
🤖 模型IDgpt-image-2
📐 图片尺寸1024x1024
◀️ 自定义宽度1024
▲ 自定义高度1024
📸 出图数量1
📦 返回格式url
📋 额外Body字段{}
⏱️ 超时时间180

This is the editing counterpart to the pack's universal text-to-image node, and the two are designed to be used as a pair. DapaoUniversalImageEditNode ("通用图像生成(图像编辑)@炮老师的小课堂") speaks the OpenAI POST /images/edits dialect: you feed it images, a prompt, and an endpoint, and it posts the lot as a multipart request, then decodes the returned image back into the graph. Same idea as its sibling, but built for the edit side of the API - and it's the node you reach for when you want GPT Image 2-style "change this, keep that" editing without being locked into one vendor's UI.

Inputs that matter

  • 📝 编辑提示词 - the edit instruction. Default is a generic "edit based on the input, keep the subject clear, improve quality," so you'll want to replace it.
  • 🖼️ 图像1 - required, the primary image being edited. 图像2 / 3 / 4 are optional additional references (the pack's README shows multi-image Nano Banana editing through exactly this kind of node).
  • 🌐 API地址 - defaults to https://api.openai.com/v1/images/edits; swap for any compatible relay.
  • 🤖 模型ID - default gpt-image-2.
  • 📐 图片尺寸 - presets or 自定义 (width/height 64–4096, step 64).
  • 📸 出图数量 - 1–4.
  • 📦 返回格式 - url or b64_json.

The optional 📋 额外Body字段 JSON is where you smuggle in vendor-specific parameters, and ⏱️ 超时时间 (default 180s) handles slow relays. Outputs: 🖼️ 图像 (IMAGE), ℹ️ 信息, 📄 原始JSON.

The honest framing

Same story as its sibling, so I'll keep this short. This node's entire value is that it's unopinionated: one UI, any /images/edits endpoint. That's fantastic when you're A/B-testing resellers for price or region access, and it's the reason the pack's README demonstrates it against both official and third-party APIs. It's also the node to be careful with, because "paste any API address and key" is exactly the convenience a malicious relay would love. Two ground rules: verify the endpoint you're pointing at before you paste a key into it, and check the 原始JSON output first when something fails - most "the node is broken" reports turn out to be "the API refused the image size / format / model name," and the raw response says which.

Install

cd ComfyUI/custom_nodes/
git clone https://github.com/paolaoshi/ComfyUI-dapaoAPI.git
cd ComfyUI-dapaoAPI
pip install -r requirements.txt

Restart ComfyUI and it's under the dapaoAPI menu. No model files, no extra deps beyond the pack's requirements.txt (requests, Pillow, torch, numpy).

One size nitpick worth knowing: the image you feed should roughly match the requested size or the API will reject it - 1024x1024 default with a 1536-wide source is a classic 400. Downscale the input first if in doubt. Otherwise, this is the rare utility node that does exactly one thing and lets you decide who's behind it.

Category🤖dapaoAPI/🔮API通用工具🔮

Inputs (15)

NameTypeDefaultDescription
📝 编辑提示词STRING请根据输入图片进行编辑,保持主体清晰,提升画面质量
🌐 API地址STRINGhttps://api.openai.com/v1/images/edits
🔑 API密钥STRING
🤖 模型IDSTRINGgpt-image-2
🖼️ 图像1IMAGE
📐 图片尺寸COMBO1024x10246 options: 1024x1024, 1024x1536, 1536x1024, 512x512, 768x768, 自定义
◀️ 自定义宽度INT102464–4096
▲ 自定义高度INT102464–4096
📸 出图数量INT11–4
📦 返回格式COMBOurl2 options: url, b64_json
🖼️ 图像2optIMAGE
🖼️ 图像3optIMAGE
🖼️ 图像4optIMAGE
📋 额外Body字段optSTRING{}
⏱️ 超时时间optINT18010–600

Outputs (3)

NameTypeDescription
🖼️ 图像IMAGE
ℹ️ 信息STRING
📄 原始JSONSTRING