Skip to main content
POST
Sử dụng route này để chỉnh sửa các hình ảnh hiện có bằng tải lên multipart tương thích OpenAI trên CometAPI.

Sử dụng route này khi

  • Bạn đã có một hình ảnh nguồn và muốn chỉnh sửa theo Prompt
  • Bạn có thể cần một mask để thay đổi có mục tiêu
  • Bạn có thể xử lý tải tệp multipart thay vì một yêu cầu JSON thuần

Yêu cầu đầu tiên an toàn

  • Bắt đầu với một tệp PNG hoặc JPG
  • Bỏ qua mask cho đến khi luồng chỉnh sửa cơ bản hoạt động
  • Sử dụng model: "gpt-image-2" cho các yêu cầu chỉnh sửa hình ảnh GPT trên route này
  • Sử dụng một hướng dẫn ngắn yêu cầu một thay đổi dễ thấy
  • Đọc kết quả đã chỉnh sửa từ data[0].b64_json
  • Đặt output_format: "jpeg" khi bạn muốn payload JPEG
  • Dự kiến độ trễ lâu hơn so với tạo hình ảnh thông thường

Hành vi của model

  • Các model chỉnh sửa hình ảnh GPT trên route này trả về dữ liệu hình ảnh base64 inline
  • output_format điều khiển loại hình ảnh được mã hóa bên trong b64_json
  • response_format chỉ quan trọng khi một model hỗ trợ đầu ra URL
  • qwen-image-edit tuân theo hành vi chỉnh sửa đặc thù của nhà cung cấp phía sau cùng một route CometAPI

Ủy quyền

Authorization
string
header
bắt buộc

Bearer token authentication. Use your CometAPI key.

Nội dung

multipart/form-data
image
file
bắt buộc

Source image file. Start with one PNG or JPG input for the simplest flow.

prompt
string
bắt buộc

Edit instruction describing the change you want.

Ví dụ:

"Add a small red ribbon to the paper boat."

model
string
mặc định:gpt-image-2

The image editing model to use. Choose a supported model from the Models page.

mask
file

Optional PNG mask. Transparent areas mark the regions to edit. The mask dimensions must match the source image exactly.

n
string
mặc định:1

Number of edited images to return.

quality
enum<string>

Quality setting for models that support it.

Tùy chọn có sẵn:
high,
medium,
low
response_format
enum<string>

Requested response container when supported by the selected model. GPT image edit models return data[].b64_json; use output_format to choose the encoded image type.

Tùy chọn có sẵn:
url,
b64_json
output_format
string

Encoded image type for GPT image edit results returned in data[].b64_json. For example, use jpeg for a JPEG payload.

Ví dụ:

"jpeg"

size
string

Requested output size when supported by the selected model.

Phản hồi

200 - application/json

Edited image result.

created
integer
bắt buộc
usage
object
bắt buộc
data
object[]
bắt buộc
background
string

Background mode returned by models that expose it.

output_format
string

Encoded image type returned by GPT image models.

quality
string

Quality level returned by models that expose it.

size
string

Output size returned by models that expose it.