跳转到主要内容
POST
/
v1
/
images
/
edits
编辑图片
curl --request POST \
  --url https://www.anyfast.ai/v1/images/edits \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form image='@example-file' \
  --form model=gpt-image-2 \
  --form 'prompt=帮我生成一张这个卡通形象的其他风格的一张头像,背景需要是矩形颜色为 RGB(153, 162, 212),最好幽默一点' \
  --form mask='@example-file' \
  --form n=1 \
  --form size=1024x1024 \
  --form response_format=url
{
  "data": [
    {
      "url": "<string>",
      "b64_json": "<string>",
      "revised_prompt": "<string>"
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://docs.anyfast.ai/llms.txt

Use this file to discover all available pages before exploring further.

授权

Authorization
string
header
必填

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

请求体

multipart/form-data
image
file
必填

待编辑的源图片文件(支持 png、jpeg、webp 等常见格式)。

model
enum<string>
必填

模型 ID。gpt-image-2 为官方模型,gpt-image-2-c 为逆向版本(支持 response_format)。

可用选项:
gpt-image-2,
gpt-image-2-c
示例:

"gpt-image-2"

prompt
string
必填

编辑指令文本。

示例:

"帮我生成一张这个卡通形象的其他风格的一张头像,背景需要是矩形颜色为 RGB(153, 162, 212),最好幽默一点"

mask
file

蒙版图片文件(含 Alpha 通道),用于指定源图片中要编辑的区域。必须与源图片格式和尺寸一致(< 50MB)。需在控制台选择 Direct 分组。

n
integer
默认值:1

返回图片数量,支持 1–10,默认 1需在控制台选择 Direct 分组。

必填范围: 1 <= x <= 10
示例:

1

size
string
默认值:1024x1024

输出图片尺寸,格式 {宽}x{高},约束与图片生成接口一致(灵活分辨率)。

示例:

"1024x1024"

response_format
enum<string>
默认值:url

响应格式。gpt-image-2-c(逆向版本)支持该参数,当前仅 url

可用选项:
url
示例:

"url"

响应

图片编辑成功。

data
object[]

编辑后的图片数组。