Skip to main content
POST
/
v1
/
images
/
edits
Edit Image
curl --request POST \
  --url https://www.anyfast.ai/v1/images/edits \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form model=gpt-image-2-c \
  --form 'prompt=Change the background to a sunset over the ocean' \
  --form image='@example-file' \
  --form 'image[]=<string>' \
  --form mask='@example-file' \
  --form output_format=png \
  --form output_compression=50 \
  --form size=1024x1024 \
  --form response_format=url \
  --form image[].items='@example-file'
{
  "data": [
    {
      "url": "<string>",
      "b64_json": "<string>",
      "revised_prompt": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data
model
enum<string>
required

Model ID.

Available options:
gpt-image-2-c
Example:

"gpt-image-2-c"

prompt
string
required

Text description of the edit you want to apply.

Example:

"Change the background to a sunset over the ocean"

image
file

Single source image file to edit (PNG or JPEG). Use image[] instead when providing multiple images.

image[]
file[]

Multiple source image files (PNG or JPEG). Up to 16 images per request. Use instead of image for multi-image input.

mask
file

Mask image file with an alpha channel. Indicates which areas of the source image to edit. Must be the same format and same size as the source image (< 50MB). Requires selecting the Direct group.

output_format
enum<string>
default:png

Output image format. Default: png.

Available options:
png,
jpeg
output_compression
integer

Compression level for jpeg output (0–100).

Required range: 0 <= x <= 100
size
string
default:1024x1024

Output image size in {width}x{height} format. Same flexible-resolution constraints as image generation.

Example:

"1024x1024"

response_format
enum<string>
default:url

Response format. Either url or b64_json.

Available options:
url,
b64_json
Example:

"url"

Response

Image edited successfully.

data
object[]

Array of edited images.