Skip to content

OpenAI Edits ​

/v1/images/edits is the OpenAI Images API compatible synchronous image editing endpoint.

Interface ​

ItemValue
MethodPOST
Path/v1/images/edits, also supports /images/edits
Content-Typemultipart/form-data or application/json
AuthenticationAuthorization: Bearer YOUR_API_KEY
Regular API keyRequires an OpenAI platform group with image generation enabled

Multipart Parameters ​

ParameterTypeRequiredDescription
modelstringNoOpenAI Images compatible 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_fidelitystringNoOpenAI Images API edit parameter. Availability depends on the selected model.

JSON Parameters ​

ParameterTypeRequiredDescription
modelstringNoOpenAI Images compatible 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.

For JSON requests, image URLs must be accessible by the service. Use multipart upload when the source image is local to the client.

Multipart Example ​

bash
curl https://api.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://api.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"
  }'

Response — 200 OK ​

json
{
  "created": 1779912000,
  "data": [
    {
      "b64_json": "..."
    }
  ]
}
FieldDescription
createdUnix timestamp when the response was created.
data[].b64_jsonBase64 edited image payload when response_format is b64_json.
data[].urlEdited image URL when URL responses are available.

Errors ​

StatusCause
400Request body is invalid, an image file or images[].image_url is missing, or unsupported fields such as file_id are used.
401API key is missing or invalid.
403Balance, quota, or group permission check failed.
404Current API key group cannot call the OpenAI Images API.
429Rate limit or concurrency limit was reached.
500 / 502 / 503Gateway or upstream provider failed.