跳转到主要内容
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
必填