Use POST /v1/images/edits with gpt-image-1 in CometAPI to edit images via masks, prompts, and size options, aligned with OpenAI image edit behavior.
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, and gpt-image-1.5 are best treated as base64-first edit routesdall-e-3 can return URL output when the provider path supports itqwen-image-edit follows provider-specific edit behavior behind the same CometAPI routegpt-image-1 request succeeded when allowed a longer timeout. The response returned usage.input_tokens, usage.output_tokens, usage.total_tokens, and a data[0].b64_json payload.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>"
}
]
}