Skip to main content
POST
/
images
/
edits
Create image edit
curl --request POST \
  --url https://dimilinks.com/v1/images/edits \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'prompt=<string>' \
  --form model=gpt-image-2 \
  --form 'size=<string>' \
  --form 'resolution=<string>' \
  --form image='@example-file' \
  --form 'image[]=<string>' \
  --form mask='@example-file' \
  --form image[].items='@example-file'
{
  "created": 1777080000,
  "task_id": "img_xxx",
  "data": [
    {
      "url": "/p/img/img_xxx/0?exp=1777166400000&sig=...",
      "file_id": "file_xxx"
    }
  ]
}
/v1/images/edits 用于上传图片文件并生成编辑结果。当前更推荐用 Create image generation 搭配 image_urls 走异步链路。

请求地址

POST https://dimilinks.com/v1/images/edits
Content-Type: multipart/form-data
至少上传一张 image 文件。

单图示例

curl "https://dimilinks.com/v1/images/edits" \
  -H "Authorization: Bearer $DIMILINKS_API_KEY" \
  -F "model=gpt-image-2" \
  -F "prompt=把图片改成复古胶片风格,保留主体" \
  -F "size=16:9" \
  -F "resolution=2k" \
  -F "image=@/path/to/reference.png"

多图示例

curl "https://dimilinks.com/v1/images/edits" \
  -H "Authorization: Bearer $DIMILINKS_API_KEY" \
  -F "model=gpt-image-2" \
  -F "prompt=融合两张参考图的风格,生成电商主图" \
  -F "size=1:1" \
  -F "resolution=4k" \
  -F "image[]=@/path/to/ref-1.png" \
  -F "image[]=@/path/to/ref-2.png"

文件字段

字段说明
image单文件,推荐。
image[]多文件。
images多文件兼容字段。
images[]多文件兼容字段。
image_1image_2编号字段兼容。
mask可选。当前会作为参考图一并处理。

响应

成功后返回图片结果:
{
  "created": 1777080000,
  "task_id": "img_xxx",
  "data": [
    {
      "url": "/p/img/img_xxx/0?exp=1777166400000&sig=...",
      "file_id": "file_xxx"
    }
  ]
}

Authorizations

Authorization
string
header
required

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

Body

multipart/form-data
prompt
string
required
model
string
default:gpt-image-2
size
string
resolution
string
image
file
image[]
file[]
mask
file

Response

Image edit result

created
integer
Example:

1777080000

task_id
string
Example:

"img_xxx"

data
object[]