跳转到主要内容
POST
/
v1
/
images
/
variations
curl -X POST "https://api.lemondata.cc/v1/images/variations" \
  -H "Authorization: Bearer sk-your-api-key" \
  -F "[email protected]" \
  -F "n=2" \
  -F "size=1024x1024"
{
  "created": 1706000000,
  "data": [
    {
      "url": "https://..."
    },
    {
      "url": "https://..."
    }
  ]
}

概述

创建给定图像的变体。需要 multipart/form-data 内容类型。

请求体

image
file
必填
用作变体基础的图像。必须是有效的 PNG 文件,小于 4MB,且为正方形。
model
string
默认值:"dall-e-2"
用于图像变体的模型。目前仅支持 dall-e-2
n
integer
默认值:"1"
要生成的图像数量。必须在 1 到 10 之间。
size
string
生成图像的尺寸。必须是 256x256512x5121024x1024 之一。
response_format
string
默认值:"url"
返回生成图像的格式。必须是 urlb64_json
user
string
代表终端用户的唯一标识符,用于滥用监控。

响应

created
integer
图像创建时间的 Unix 时间戳。
data
array
生成的图像变体数组。每个对象包含:
  • url (string): 变体图像的 URL(如果 response_format 是 url
  • b64_json (string): Base64 编码的图像(如果 response_format 是 b64_json
curl -X POST "https://api.lemondata.cc/v1/images/variations" \
  -H "Authorization: Bearer sk-your-api-key" \
  -F "[email protected]" \
  -F "n=2" \
  -F "size=1024x1024"
{
  "created": 1706000000,
  "data": [
    {
      "url": "https://..."
    },
    {
      "url": "https://..."
    }
  ]
}

注意事项

图像变体仅适用于 DALL-E 2。模型将生成与原始图像在风格和内容上相似的新图像。

请求体

application/json
image
file
必填

用作变体基础的图像。必须是有效的 PNG 文件,小于 4MB,且为正方形。

model
string

用于图像变体的模型。目前仅支持 dall-e-2

n
integer

要生成的图像数量。必须在 1 到 10 之间。

size
string

生成图像的尺寸。必须是 256x256512x5121024x1024 之一。

response_format
string

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

user
string

代表终端用户的唯一标识符,用于滥用监控。

响应

200 - application/json

Response 200

created
integer

图像创建时间的 Unix 时间戳。

data
object[]

生成的图像变体数组。 每个对象包含: url (string): 变体图像的 URL(如果 response_format 是 urlb64_json (string): Base64 编码的图像(如果 response_format 是 b64_json