AGTCloud API Docs
GuidesAPI ReferenceIntegrations and resourcesUpdate and help
Image generationOpenAI Images

Edit an image

Edit images with the OpenAI Images Edits API.

POST/v1/images/edits

Supports Multipart file uploads or JSON image references; mask and markup are mutually exclusive. Set stream: true to receive SSE image events.

Authorization

bearerAuth
AuthorizationBearer <token>

Use a platform API key in the format Authorization: Bearer your-api-key.

In: header

Request Body

multipart/form-data

Upload files with Multipart or reference images with JSON; each format uses its own fields.

TypeScript Definitions

Use the request body type in TypeScript.

JSON image references

FieldJSON representation
images
mask / markup

Optional, using the same image-reference structure; cannot be supplied together

curl -X POST "https://api.agtcloud.cn/v1/images/edits" \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL_ID",
    "images": [
      {
        "image_url": "https://example.com/source.png"
      }
    ],
    "prompt": "Replace the background with a light-colored wall, preserving the subject"
  }'

Response Body

application/json

application/json

application/json

Streaming response events

These fields describe the JSON in one data: event, not the complete SSE text stream.

OpenAI Images Edits official documentationSee API fields and streaming event definitions.