Skip to main content
POST
cURL
使用此端點可根據一張人物圖片與一張服裝圖片生成虛擬試穿圖片。

呼叫前準備

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

任務流程

1

提交試穿任務

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

輪詢任務

輪詢對應的 Kling 圖片查詢路徑,直到任務進入終態並回傳渲染完成的圖片。
3

保存結果

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

授權

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

標頭

Content-Type
string
預設值:application/json

Must be application/json.

主體

application/json
human_image
string
必填

Person image to dress. Image URL or raw Base64 string without a data: prefix. Supported formats: JPG, JPEG, PNG. Maximum 10 MB, minimum 300x300 px, aspect ratio between 1:2.5 and 2.5:1.

cloth_image
string
必填

Clothing image for the try-on. Image URL or raw Base64 string without a data: prefix. Supported formats: JPG, JPEG, PNG. Maximum 10 MB, minimum 300x300 px, aspect ratio between 1:2.5 and 2.5:1. Supports tops, bottoms, and one-piece dresses.

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

Virtual try-on model version. Defaults to kolors-virtual-try-on-v1.

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

Webhook URL for task status notifications.

external_task_id
string

Optional user-defined task ID for your own tracking. Must be unique per account.

回應

200 - application/json

Task request accepted or an error response returned by the API.

code
必填

Response code. 0 means the task request was accepted.

message
string
必填

Response message.

data
object
必填
request_id
string

Request identifier returned when present.