POST
/
v1
/
images
/
edits
curl -X POST "https://api.applerouter.ai/v1/images/edits/" \
  -H "Authorization: Bearer sk-your-api-key" \
  -F "image=@image.png" \
  -F "prompt=A cute baby sea otter wearing a beret" \
  -F "n=1" \
  -F "size=1024x1024"
{
  "created": 1713833628,
  "data": [
    {
      "url": "https://example.com/edited-image.png"
    }
  ]
}

Overview

Create an edited or extended version of an existing image. Upload an image and provide a text prompt describing the desired changes.
image
file
required
The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency.
prompt
string
required
A text description of the desired edit (Prompt) (max 1000 characters)
mask
file
An additional image whose fully transparent areas indicate where to edit (Mask)
model
string
The model to use (e.g. dall-e-2)
n
integer
The number of images to generate (1-10)
size
string
The size of the generated images: 256x256, 512x512 or 1024x1024
response_format
string
The format in which the generated images are returned: url or b64_json
curl -X POST "https://api.applerouter.ai/v1/images/edits/" \
  -H "Authorization: Bearer sk-your-api-key" \
  -F "image=@image.png" \
  -F "prompt=A cute baby sea otter wearing a beret" \
  -F "n=1" \
  -F "size=1024x1024"
{
  "created": 1713833628,
  "data": [
    {
      "url": "https://example.com/edited-image.png"
    }
  ]
}

Authorizations

Authorization
string
header
required

使用 Bearer Token 认证。格式: Authorization: Bearer sk-xxxxxx

Body

multipart/form-data
image
file
required

要编辑的图像。必须是有效的 PNG 文件,小于 4MB,并且是方形的。如果未提供遮罩,图像必须具有透明度,将用作遮罩。

prompt
string
required

所需图像的文本描述。最大长度为 1000 个字符。

Example:

"A cute baby sea otter wearing a beret."

mask
file

附加图像,其完全透明区域(例如,alpha 为零的区域)指示image应编辑的位置。必须是有效的 PNG 文件,小于 4MB,并且尺寸与原始image相同。

n
string

要生成的图像数。必须介于 1 和 10 之间。

Example:

"1"

size
string

生成图像的大小。必须是256x256512x5121024x1024之一。

Example:

"1024x1024"

response_format
string

生成的图像返回的格式。必须是urlb64_json

Example:

"url"

user
string

代表您的最终用户的唯一标识符,可以帮助 OpenAI 监控和检测滥用行为。了解更多

Example:

""

model
string
Example:

"dall-e-2"

Response

200 - application/json

The response is of type object.