OpenAI Images Compatible Image Editing
Use `POST /v1/images/edits` or `POST /v1/edits` to perform editing, inpainting, and image-to-image generation based on existing images.
https://zx1.deepwl.net/v1/images/editscurl -X POST https://zx1.deepwl.net/v1/images/edits \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=gpt-image-1" \
-F "prompt=Change the background to a tech-style office while preserving the main composition" \
-F "image=@input.png" \
-F "size=1024x1024" \
-F "watermark=false"{
"created": 1735689600,
"data": [
{
"url": "https://.../images/edit-abc123.png",
"revised_prompt": "Change the background to a tech-style office while preserving the main composition"
}
]
}Image editing uses the same model family as generation, but the entry point is switched to the edit route. Both POST /v1/images/edits and POST /v1/edits are supported.
- Supports both
multipart/form-dataand JSON request bodies. - Passing
imageenables image-to-image generation; additionally passingmaskenables inpainting. gpt-image-1defaults toquality = standardin editing scenarios, and whennis omitted or set to0, it falls back to1.
Request Headers
Authorizationstring必填Authentication header. Uses a Bearer token, e.g. Bearer YOUR_API_KEY.
Content-TypestringRequest content type. Must be application/json for JSON request bodies; for multipart/form-data it is set automatically by the client (e.g. when using curl -F) and does not need to be set manually.
Request Body
imagefile | string | object必填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.
promptstring必填Editing instructions. Used to describe what to keep and what to modify.
modelstringModel name. If not provided, whether there is a default behavior depends on the upstream service; omitting it is not recommended.
maskfile | string | objectInpainting mask. Transparent areas usually indicate the regions that may be edited.
nintegerNumber of outputs. When omitted or explicitly set to 0, the unified layer falls back to 1.
sizestringOutput size. The available values depend on the target model.
qualitystringQuality field. For gpt-image-1, the editing form defaults to standard.
watermarkbooleanExplicit watermark switch. Explicitly passing false means it is turned off; omitting it means the default policy is used.
Request Examples
Response Examples
Response Fields
createdintegerTimestamp of when the edited result was generated.
dataarray<object>Array of edit results.
urlstringURL of the resulting image.
b64_jsonstringImage data returned when the request uses Base64 format.
revised_promptstringThe editing prompt possibly rewritten by the upstream service.
Use Cases
Basic Image-to-Image
curl -X POST https://zx1.deepwl.net/v1/images/edits \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=gpt-image-1" \
-F "prompt=Change the character's outfit to a dark blue suit" \
-F "image=@portrait.png"
Inpainting
curl -X POST https://zx1.deepwl.net/v1/images/edits \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=gpt-image-1" \
-F "prompt=Change the background to a modern office" \
-F "image=@input.png" \
-F "mask=@mask.png"
Using the Legacy Alias
curl -X POST https://zx1.deepwl.net/v1/edits \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=gpt-image-1" \
-F "prompt=Preserve the main subject and enhance the lighting layers" \
-F "image=@input.png"
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.