Skip to content

OpenAI Edits

/v1/images/edits is the OpenAI Images API compatible synchronous image editing endpoint. It uses the same platform, group permission, content moderation, concurrency, and billing checks as image generation.

Interface

ItemValue
MethodPOST
Path/v1/images/edits
Content-Typemultipart/form-data or application/json
AuthenticationAuthorization: Bearer YOUR_API_KEY
Platform requirementOpenAI platform group with image generation enabled

Multipart Parameters

ParameterTypeRequiredDescription
modelstringNoImage model. Defaults to gpt-image-2.
promptstringYesEdit instruction.
imagefileYesInput image. Multiple images can use repeated image fields or image[].
maskfileNoMask image.
sizestringNoOutput size.
nintegerNoNumber of images.
response_formatstringNoResponse format.
input_fidelitystringNoNative OpenAI edit parameter, forwarded when supported upstream.

JSON Parameters

ParameterTypeRequiredDescription
modelstringNoImage model. Defaults to gpt-image-2.
promptstringYesEdit instruction.
imagesarrayYesItems support { "image_url": "https://..." }. file_id is not supported.
mask.image_urlstringNoMask image URL. mask.file_id is not supported.
sizestringNoOutput size.
nintegerNoNumber of images.

Multipart Example

bash
curl https://llmapi.site/v1/images/edits \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -F 'model=gpt-image-2' \
  -F 'image=@input.png' \
  -F 'prompt=change the background to a clean studio setting' \
  -F 'size=1024x1024'

JSON Example

bash
curl https://llmapi.site/v1/images/edits \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "gpt-image-2",
    "prompt": "replace the background with a bright studio",
    "images": [
      { "image_url": "https://example.com/input.png" }
    ],
    "size": "1024x1024"
  }'

Common Errors

ErrorMeaning
Images API is not supported for this platformThe current key group is not OpenAI.
images[].image_url is requiredJSON edit request is missing an input image URL.
images[].file_id is not supportedJSON edit requests do not currently support file_id.
image file is requiredMultipart edit request is missing an image file.