Skip to main content
POST
/
vendors
/
openai
/
v1
/
gpt-image-2
/
edit
Image Edit
curl --request POST \
  --url https://api.mulerouter.ai/vendors/openai/v1/gpt-image-2/edit \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "<string>",
  "images": [
    "<string>"
  ],
  "size": "auto",
  "n": 1,
  "mask": "<string>",
  "format": "png"
}
'
{
  "task_info": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "status": "pending",
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z"
  }
}

Overview

Edit existing images using a text prompt with GPT Image 2. Pass one or more input images (URL or Base64) and an optional mask to constrain the edit region. Supports up to 4K output and batch generation of 1–4 edited images per request.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
prompt
string
required

Text prompt describing the desired edit.

Minimum string length: 1
images
string[]
required

Input images to edit. Each item is a URL or Base64-encoded string.

Minimum array length: 1
size
enum<string>
default:auto

Output image resolution.

Available options:
1024x1024,
1536x1024,
1024x1536,
2048x2048,
2048x1152,
3840x2160,
2160x3840,
auto
n
integer
default:1

Number of edited images to generate.

Required range: 1 <= x <= 4
mask
string

Optional mask image (URL or Base64-encoded) to specify the edit region.

format
enum<string>
default:png

Output image format.

Available options:
png,
jpeg,
webp

Response

202 - application/json

Accepted - Task created successfully

task_info
object