OpenAI Images Compatible

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.

POSThttps://zx1.deepwl.net/v1/images/edits
Request
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 tech-style office while preserving the main composition" \
  -F "image=@input.png" \
  -F "size=1024x1024" \
  -F "watermark=false"
Response
{
  "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-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.

Request Headers

Authorizationstring必填

Authentication header. Uses a Bearer token, e.g. Bearer YOUR_API_KEY.

Content-Typestring

Request 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.

modelstring

Model name. If not provided, whether there is a default behavior depends on the upstream service; omitting it is not recommended.

maskfile | string | object

Inpainting mask. Transparent areas usually indicate the regions that may be edited.

ninteger

Number of outputs. When omitted or explicitly set to 0, the unified layer falls back to 1.

sizestring

Output size. The available values depend on the target model.

qualitystring

Quality field. For gpt-image-1, the editing form defaults to standard.

watermarkboolean

Explicit watermark switch. Explicitly passing false means it is turned off; omitting it means the default policy is used.

Request Examples

Response Examples

Response Fields

createdinteger

Timestamp of when the edited result was generated.

dataarray<object>

Array of edit results.

urlstring

URL of the resulting image.

b64_jsonstring

Image data returned when the request uses Base64 format.

revised_promptstring

The 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.