Skip to navigation

Edit images

Changes one or more images following a prompt, optionally only where a mask is transparent.

Authentication

AuthorizationBearer

Your API key, sk-..., from Console → API keys.

Request

This endpoint expects a multipart form containing an optional file.
modelstringRequired
promptstringRequired
imagestring or list of stringsRequired
The image or images to edit.
maskfileOptional
A PNG whose transparent areas mark what to change.
nintegerOptional>=1
sizestringOptional
qualitystringOptional
backgroundenumOptional
Allowed values:
output_formatenumOptional
Allowed values:
userstringOptional

Response

Links to the edited images.
createdintegerOptional
datalist of objectsOptional
usageobjectOptional
Token usage, for models billed by tokens.

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
404
Not Found Error
429
Too Many Requests Error
502
Bad Gateway Error