跳轉到主要內容
POST
/
kling
/
v1
/
images
/
kolors-virtual-try-on
Virtual Try-On
curl --request POST \
  --url https://api.cometapi.com/kling/v1/images/kolors-virtual-try-on \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "human_image": "https://assets.christiandior.com/is/image/diorprod/LOOK_F_25_1_LOOK_095_E04?$lookDefault_GH-GHC$&crop=568,0,1864,2000&bfc=on&qlt=85",
  "cloth_image": "https://assets.christiandior.com/is/image/diorprod/511R59A1166X3389_E01?$default_GHC$&crop=501,147,998,1572&bfc=on&qlt=85"
}
'
{
  "code": 123,
  "message": "<string>",
  "request_id": "<string>",
  "data": {
    "task_id": "<string>",
    "task_status": "<string>",
    "task_status_msg": "<string>",
    "created_at": 123,
    "updated_at": 123,
    "task_result": {
      "images": [
        {
          "url": "<string>"
        }
      ]
    }
  }
}
使用此端點可根據一張人物圖片與一張服裝圖片產生虛擬試穿影像。

呼叫前須知

  • 提供一張 human_image 和一張 cloth_image
  • 請從 kolors-virtual-try-on-v1kolors-virtual-try-on-v1-5 開始
  • 第一次測試時,請使用乾淨的服裝商品圖或白底服裝圖片

任務流程

1

提交試穿任務

傳送人物圖片與服裝圖片,然後儲存回傳的任務 id。
2

輪詢任務

持續使用 單筆查詢,直到任務進入終態並回傳渲染完成的影像。
3

保存結果

如果試穿結果需要保留更長時間,請將完成的影像儲存到你自己的儲存空間中。
如需完整參數參考,請參閱 Kling 官方文件

授權

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

主體

application/json
human_image
string
預設值:example
必填

Person image to dress. Accepts an image URL or raw Base64 string (no data: prefix). Formats: JPG, JPEG, PNG. Max 10 MB, minimum 300×300 px.

cloth_image
string
預設值:example
必填

Clothing image for the try-on. Accepts an image URL or raw Base64 string (no data: prefix). Formats: JPG, JPEG, PNG. Max 10 MB, minimum 300×300 px. Supports tops, bottoms, and one-piece dresses. The v1-5 model also accepts a combined top+bottom image stitched together.

callback_url
string

Webhook URL for task status notifications.

model_name
enum<string>
預設值:kolors-virtual-try-on-v1

Virtual try-on model version.

可用選項:
kolors-virtual-try-on-v1,
kolors-virtual-try-on-v1-5

回應

200 - application/json

Successful Response

code
integer
必填

Error code; specifically define the error code

message
string
必填

error message

request_id
string
必填

Request ID, system-generated, for tracking requests, troubleshooting issues

data
object
必填