Skip to main content
POST
OpenAI Images Compatible Image Editing

OpenAI Images Compatible Image Editing

Image editing uses the same model family as generation, but the entry point is switched to the edit route.
  • Compatible with both POST /v1/images/edits and POST /v1/edits.
  • Supports both multipart/form-data and JSON request bodies.
  • Passing image enables image-to-image generation; additionally passing mask enables inpainting.
  • gpt-image-1 defaults to quality = standard in editing scenarios, and when n is omitted or set to 0, it falls back to 1.

Method and Path

Request Examples

Response Examples

Authentication

Body

image
file | string | object
required
The input image for editing. Under multipart/form-data, this is usually a file; in JSON scenarios, it can be a URL, Base64, or an object structure.
prompt
string
required
Editing instructions. Used to describe what to keep and what to modify.
model
string
Model name. If not provided, whether there is a default behavior depends on the upstream service; omitting it is not recommended.
mask
file | string | object
Inpainting mask. Transparent areas usually indicate the regions that may be edited.
n
integer
Number of outputs. When omitted or explicitly set to 0, the unified layer falls back to 1.
size
string
Output size. The available values depend on the target model.
quality
string
Quality field. For gpt-image-1, the editing form defaults to standard.
watermark
boolean
Explicit watermark switch. Explicitly passing false means it is turned off; omitting it means the default policy is used.

Response

created
integer
Timestamp of when the edited result was generated.
data[].url
string
URL of the resulting image.
data[].b64_json
string
Image data returned when the request uses Base64 format.
data[].revised_prompt
string
The editing prompt possibly rewritten by the upstream service.

Use Cases

Basic Image-to-Image

Inpainting

Using the Legacy Alias

Notes

Although the editing interface supports both JSON and form submissions, different upstream services have very different requirements for field shapes. The safest approach is still to submit editing fields such as image, prompt, and mask using multipart/form-data.