Skip to main content
POST
/
v1
/
images
/
edits
gpt-image-1 (image edit)
curl --request POST \
  --url https://api.example.com/v1/images/edits
OpenAI’s official format for the image edit API.
curl -X POST "https://gptproto.com/v1/images/edits" \
  -H "Authorization: YOUR_API_KEY" \
  -F "model=gpt-image-1" \
  -F "image=@/path/to/image.png" \
  -F "prompt=A cat wearing a hat" \
  -F "mask=@/path/to/mask.png" \
  -F "n=1" \
  -F "size=1024x1024"
{
  "error": {
    "message": "Invalid signature",
    "type": "401"
  }
}

Parameters

ParameterTypeRequiredDefaultDescription
modelstring✅ Yesgpt-image-1The model to use for the request
imagefile✅ Yes-The image to edit. Must be a valid PNG file, less than 4MB, and square.
promptstring✅ YesA cat wearing a hatA text description of the desired image(s). The maximum length is 1000 characters.
maskfile❌ No-An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where image should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as image.
ninteger❌ No1The number of images to generate. Must be between 1 and 10.
sizestring❌ No1024x1024The size of the generated images. Must be one of 256x256, 512x512, or 1024x1024.