跳转到主要内容
POST
/
api
/
ai
/
image
/
edit
编辑图像
curl --request POST \
  --url https://aitoearn.cn/api/ai/image/edit \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <api-key>' \
  --data '
{
  "model": "<string>",
  "image": "<string>",
  "prompt": "<string>"
}
'
{
  "code": 0,
  "message": "请求成功",
  "data": {
    "created": 1,
    "list": [
      {
        "url": "string",
        "b64_json": "string",
        "revised_prompt": "string"
      }
    ],
    "usage": {
      "input_tokens": 1,
      "output_tokens": 1,
      "total_tokens": 1
    },
    "background": "string",
    "output_format": "string",
    "quality": "string",
    "size": "string"
  }
}

授权

X-Api-Key
string
header
必填

AiToEarn Open Platform API Key。

请求体

application/json
model
string
必填

图片编辑模型

image
必填

原始图片

prompt
string
必填

编辑描述

Required string length: 1 - 4000
mask
string

遮罩图片

n
integer

生成图片数量

必填范围: 1 <= x <= 1
size
string

图片尺寸

response_format
enum<string>

返回格式

可用选项:
url,
b64_json
user
string

用户标识符

source
enum<string>

消费来源

可用选项:
ai_image,
ai_draft_generation,
plugin

响应

200 - application/json

请求已被服务处理。业务是否成功以响应体 code === 0 为准。

code
integer
必填

业务状态码。0 表示成功,非 0 表示业务错误。

message
string
必填

响应消息。

data
object
requestId
string

请求 ID。

timestamp
integer

错误响应时间戳,Unix 毫秒。