跳轉到主要內容
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