在 CometAPI 中使用 POST /v1/images/edits,通过 mask、prompt 和尺寸选项编辑图像,并与 OpenAI 图像编辑行为保持一致。
curl --request POST \
--url https://api.cometapi.com/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'prompt=Add a small red ribbon to the paper boat.' \
--form image='@example-file' \
--form mask='@example-file'{
"created": 1773381100,
"usage": {
"input_tokens": 226,
"input_tokens_details": {
"image_tokens": 194,
"text_tokens": 32
},
"output_tokens": 4160,
"total_tokens": 4386
},
"data": [
{
"b64_json": "<base64-image-data>"
}
]
}gpt-image-1、gpt-image-1-mini 和 gpt-image-1.5 主要是以 base64 为主的编辑路由dall-e-3 可以返回 URL 输出qwen-image-edit 在同一个 CometAPI 路由下遵循提供商特定的编辑行为Bearer token authentication. Use your CometAPI key.
Source image file. Start with one PNG or JPG input for the simplest flow.
Edit instruction describing the change you want.
"Add a small red ribbon to the paper boat."
The image editing model to use. Choose a current model from the Models page.
Optional PNG mask. Transparent areas indicate regions that should be edited.
Number of edited images to return.
Quality setting for models that support it.
high, medium, low Requested output format when supported by the selected model.
url, b64_json Requested output size when supported by the selected model.
curl --request POST \
--url https://api.cometapi.com/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'prompt=Add a small red ribbon to the paper boat.' \
--form image='@example-file' \
--form mask='@example-file'{
"created": 1773381100,
"usage": {
"input_tokens": 226,
"input_tokens_details": {
"image_tokens": 194,
"text_tokens": 32
},
"output_tokens": 4160,
"total_tokens": 4386
},
"data": [
{
"b64_json": "<base64-image-data>"
}
]
}