跳转到内容

執行用於影像轉影像的 AI 文字生成圖片任務 V2。

请求

AI 任務是非同步的。當功能支援 webhook 時,請優先使用以 webhook 為基礎的完成處理。設定您的 webhook 端點、驗證 webhook 簽章,並在收到 success 或 error 通知後,使用收到的 task_id 查詢任務結果。設定與驗證細節請見 webhook 整合指南。

若您的整合不支援 webhook 或無法使用 webhook,請實作輪詢。送出 AI 任務後,以固定間隔(例如每 10 秒)輪詢狀態端點,直到任務狀態為 success 或 error。

安全
BearerAuthenticationV2
正文application/json必需
Any of:
modelstring必需

模型名稱。

Value:"youcam-image-v2"
promptstring, [ 1 .. 800 ] characters必需

描述您希望生成影像中具備的元素與視覺特徵的影像編輯指示(正面提示)。
此參數支援中文與英文,最大長度為 800 個字元。每個中文字或英文字母都計為一個字元。

示例:"Make the girl from Image 1 wear the black dress from Image 2 and sit in the pose from Image 3. Keep her clothing, hairstyle, and expression unchanged
negative_promptstring, [ 1 .. 500 ] characters

負面提示,描述您不希望出現在生成影像中的內容。
此參數支援中文與英文,最大長度為 500 個字元。每個中文字或英文字母都計為一個字元。

示例:"low resolution, error, worst quality, low quality, disfigured, extra fingers, bad proportions."
sizestring

以 width*height 格式指定輸出影像的解析度,例如 "1024*1536"。
- 寬與高都必須落在 [512, 2048] 像素的範圍內。
- 預設總像素數約為 1024*1024,長寬比與輸入圖片(或多張圖片請求中的最後一張)相近。
當您指定 size 參數時,系統會以 size 指定的寬與高為目標,並將實際輸出影像的寬與高調整為最接近的 16 的倍數。例如,若指定 1033*1032,輸出影像尺寸為 1040*1024。
常見長寬比的建議解析度:
- 1:1:1024*1024、1536*1536
- 2:3:768*1152、1024*1536
- 3:2:1152*768、1536*1024
- 3:4:960*1280、1080*1440
- 4:3:1280*960、1440*1080
- 9:16:720*1280、1080*1920
- 16:9:1280*720、1920*1080
- 21:9:1344*576、2048*872

示例:"1024*1024"
prompt_extendboolean

啟用智慧提示改寫。模型會最佳化正面提示。不會影響負面提示。

默认值:true
Enum ValueDescription
true

Enables rewriting. Use this for more diverse image content; the model adds details.

false

Disables rewriting. Use this for tighter control over image details.

示例:true
src_file_urlsArray of strings, [ 1 .. 3 ] items必需

來自上傳檔案 API 的檔案網址。應提供 'src_file_urls' 或 'src_file_ids' 其中之一。

示例:
[ "https://example.com/selfie.jpg", "https://example.com/selfie.jpg", "https://example.com/selfie.jpg" ]
curl -i -X POST \
  https://yce-api-01.makeupar.com/s2s/v2.0/task/image-to-image/youcam \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "src_file_urls": [
      "https://example.com/selfie.jpg",
      "https://example.com/selfie.jpg",
      "https://example.com/selfie.jpg"
    ],
    "model": "youcam-image-v2",
    "prompt": "Make the girl from Image 1 wear the black dress from Image 2 and sit in the pose from Image 3. Keep her clothing, hairstyle, and expression unchanged, and ensure the action is natural and smooth.",
    "negative_prompt": "low resolution, error, worst quality, low quality, disfigured, extra fingers, bad proportions.",
    "size": "1024*1024",
    "prompt_extend": true
  }'

响应

任務執行成功

正文application/json
statusinteger

回應狀態

示例:200
dataobject
响应
{ "status": 200, "data": { "task_id": "grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe" } }