Skip to main content
POST
/
v1
/
images
/
edits
Edit images
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>"
    }
  ]
}
Use this route to edit existing images with OpenAI-compatible multipart uploads on CometAPI.

Use this route when

  • You already have a source image and want a prompt-driven edit
  • You may need a mask for targeted changes
  • You can handle multipart file upload instead of a plain JSON request

First validation path

  • Start with one PNG or JPG file
  • Skip the mask until the base edit flow works
  • Use one short instruction that asks for one visible change
  • Expect longer latency than plain image generation

Model behavior

  • gpt-image-1, gpt-image-1-mini, and gpt-image-1.5 are best treated as base64-first edit routes
  • dall-e-3 can return URL output when the provider path supports it
  • qwen-image-edit follows provider-specific edit behavior behind the same CometAPI route
Live validation on 2026-03-13 confirmed that a PNG-based gpt-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.

Authorizations

Authorization
string
header
required

Bearer token authentication. Use your CometAPI key.

Body

multipart/form-data
image
file
required

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

prompt
string
required

Edit instruction describing the change you want.

Example:

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

model
string
default:gpt-image-1

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

mask
file

Optional PNG mask. Transparent areas indicate regions that should be edited.

n
string
default:1

Number of edited images to return.

quality
enum<string>

Quality setting for models that support it.

Available options:
high,
medium,
low
response_format
enum<string>

Requested output format when supported by the selected model.

Available options:
url,
b64_json
size
string

Requested output size when supported by the selected model.

Response

200 - application/json

Edited image result.

created
integer
required
data
object[]
required
usage
object