POST
/
v1
/
images
/
edits
Image Mask Editing (gpt-image-1)
curl --request POST \
  --url https://api.example.com/v1/images/edits

Image Mask Editing (gpt-image-1)

Edit images using the gpt-image-1 model with a mask to specify the area to modify.

Endpoint

POST /v1/images/edits

Authentication

All requests require a Bearer token in the Authorization header:
Authorization: Bearer YOUR_API_KEY

Request Parameters

ParameterTypeRequiredDescription
modelstringYesModel ID: gpt-image-1
promptstringYesText describing the desired edit
imagefile/stringYesThe image to edit, can be a file upload or URL
maskfile/stringNoMask image specifying the area to edit (transparent areas will be modified)
nintegerNoNumber of images to generate, default 1
sizestringNoImage size, default 1024x1024

Request Example

curl -X POST "https://www.anyfast.ai/v1/images/edits" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "model=gpt-image-1" \
  -F "prompt=a cute pig" \
  -F "image=@/path/to/image.png" \
  -F "mask=@/path/to/mask.png" \
  -F "n=1" \
  -F "size=1024x1024"

Response Example

{
  "created": 1700000000,
  "data": [
    {
      "url": "https://example.com/edited-image.png",
      "revised_prompt": "a cute pig"
    }
  ]
}

Response Fields

FieldTypeDescription
createdintegerCreation timestamp
dataarrayList of edited images
data[].urlstringImage URL
data[].revised_promptstringModel’s revised prompt