Використовуйте POST /v1/images/edits у CometAPI для редагування зображень за допомогою multipart uploads, масок, моделей GPT для зображень і елементів керування закодованим виводом зображення.
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": 1776836647,
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 981,
"prompt_tokens_details": {
"cached_tokens_details": {}
},
"completion_tokens_details": {},
"input_tokens": 785,
"output_tokens": 196,
"input_tokens_details": {
"image_tokens": 768,
"text_tokens": 17,
"cached_tokens_details": {}
},
"claude_cache_creation_5_m_tokens": 0,
"claude_cache_creation_1_h_tokens": 0
},
"data": [
{
"b64_json": "<base64-image-data>"
}
]
}Використовуйте цей маршрут, щоб редагувати наявні зображення за допомогою сумісних з OpenAI multipart uploads у CometAPI.Documentation Index
Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
Use this file to discover all available pages before exploring further.
model: "gpt-image-2" для запитів на редагування зображень GPT на цьому маршрутіdata[0].b64_jsonoutput_format: "jpeg", якщо вам потрібен payload JPEGoutput_format керує типом закодованого зображення всередині b64_jsonresponse_format має значення лише тоді, коли модель підтримує виведення URLqwen-image-edit дотримується специфічної для провайдера поведінки редагування за тим самим маршрутом CometAPIBearer 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 supported 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 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.
url, b64_json Encoded image type for GPT image edit results returned in data[].b64_json. For example, use jpeg for a JPEG payload.
"jpeg"
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": 1776836647,
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 981,
"prompt_tokens_details": {
"cached_tokens_details": {}
},
"completion_tokens_details": {},
"input_tokens": 785,
"output_tokens": 196,
"input_tokens_details": {
"image_tokens": 768,
"text_tokens": 17,
"cached_tokens_details": {}
},
"claude_cache_creation_5_m_tokens": 0,
"claude_cache_creation_1_h_tokens": 0
},
"data": [
{
"b64_json": "<base64-image-data>"
}
]
}