Image Edits
POST/v1/images/edits
Follows the OpenAI Responses API spec: https://developers.openai.com/api/reference/resources/images/methods/edit
Request
- multipart/form-data
Body
required
Image to edit
Identifier of the model to use.
Prompt provided to the model.
Number of images to generate.
Possible values: >= 1 and <= 10
Image size between 1x1 and 512x512.
Possible values: Value must match regular expression ^(0|[1-9][0-9]{0,2}|[1-4][0-9]{2}|512)x(0|[1-9][0-9]{0,2}|[1-4][0-9]{2}|512)$
512x512Quality of image to generate by editing. Note: This property is accepted but ignored by the API.
Possible values: [low, standard, hd]
Reference if the provided image is from url or by upload. Note: This property is accepted but ignored by the API.
Possible values: [image_url, file_id]
file_idUser that requested image edit. Note: This property is accepted but ignored by the API.
Responses
- 200
- 400
Successful Response
- application/json
- Schema
- Example (from schema)
Schema
data
object
required
Base64-encoded image.
Image size.
usage
object
input_tokens_details
object
{
"created": 0,
"data": {
"b64_json": "string",
"revised_prompt": "string",
"url": "string"
},
"output_format": "string",
"size": "string",
"usage": {
"total_tokens": 0,
"input_tokens": 0,
"input_tokens_details": {
"image_tokens": 0,
"text_tokens": 0
},
"output_tokens": 0
}
}
Bad request Error when passing an invalid or non-existing model name or an invalid enum or an invalid type in a field
- application/json
- Schema
- Example (from schema)
Schema
error
object
required
Error returned as response for invalid or missing model name
{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}