Edit images

Edit or combine uploaded reference images with a multipart request; streaming is not supported.

Authentication

AuthorizationBearer
Your production key sent as a bearer token.

Request

This endpoint expects a multipart form with multiple files.
promptstringRequired>=1 character
Text description of the edit.
modelstringRequired

Image model, for example openai/gpt-image-2.

imagefilesOptional

One to 16 reference images (PNG, JPEG, or WebP).

image[]filesOptional

OpenAI SDK spelling of image for multiple uploads.

maskfileOptional
Mask whose transparent areas mark where the first image is edited.
vendorstring or nullOptional
Pin the vendor that runs this request.
customerstring or nullOptional

Customer ID (UUID) to scope this request to, applying that customer’s routing policy, provider keys, budget, and usage attribution.

ninteger or nullOptional1-10
Number of images, 1 to 10.
sizestring or nullOptional
qualitystring or nullOptional
backgroundstring or nullOptional
input_fidelitystring or nullOptional
response_formatstring or nullOptional
output_formatstring or nullOptional
output_compressioninteger or nullOptional0-100
moderationstring or nullOptional
userstring or nullOptional

End-user identifier forwarded to the provider.

streamboolean or nullOptional

Not supported; true returns 400 stream_unsupported.

Response

Successful Response
createdinteger
Unix timestamp in seconds.
datalist of objects
Generated images.
usageobject or nullOptional

Token usage reported by the provider; absent for flat per-image models.

images_generatedintegerOptionalDefaults to 0
Number of images generated.
costdouble or nullOptional

Cost of the request in USD; null when the route is unpriced.

Errors

422
Unprocessable Entity Error