Skip to content

Task: Virtual Try-On

Overview

  • Method: POST
  • Path: /kling/v1/images/kolors-virtual-try-on
  • Content-Type: application/json

Authentication

  • HTTP Bearer: Authorization: Bearer <token>

Request Parameters

Body Parameters (JSON)

ParameterTypeRequiredDescription
callback_urlstringNoCallback URL for task result notifications
model_namestringNoModel name, enum: kolors-virtual-try-on-v1-5, kolors-virtual-try-on-v1. Default is kolors-virtual-try-on-v1
human_imagestringYesHuman image (Base64 or URL), supports jpg/jpeg/png, <=10MB, resolution >=300x300
cloth_imagestringYesClothing image (product image or white-background image), supports jpg/jpeg/png, <=10MB, resolution >=300x300

The model kolors-virtual-try-on-v1-5 supports single item or top+bottom combinations. Failure cases include top/top, bottom/bottom, one-piece/one-piece, top/one-piece, bottom/one-piece.


Example Request

curl Example

bash
curl -X POST "https://api.gpt.ge/kling/v1/images/kolors-virtual-try-on" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-xxxx" \
  -d '{
    "model_name": "kolors-virtual-try-on-v1-5",
    "human_image": "https://gw.alicdn.com/imgextra/i1/1860536677/O1CN012wEzZ11zC7RDNm0Jr_!!1860536677.jpg",
    "cloth_image": "https://gw.alicdn.com/imgextra/i4/3370044138/O1CN01p0Zl411gRFvj0NnwQ_!!3370044138.jpg"
  }'

JavaScript (fetch) Example

javascript
fetch('https://api.gpt.ge/kling/v1/images/kolors-virtual-try-on', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer sk-xxxx'
  },
  body: JSON.stringify({
    model_name: 'kolors-virtual-try-on-v1-5',
    human_image: 'https://gw.alicdn.com/imgextra/i1/1860536677/O1CN012wEzZ11zC7RDNm0Jr_!!1860536677.jpg',
    cloth_image: 'https://gw.alicdn.com/imgextra/i4/3370044138/O1CN01p0Zl411gRFvj0NnwQ_!!3370044138.jpg'
  })
}).then(r => r.json()).then(console.log)

Python Example (requests)

python
import requests

resp = requests.post(
    'https://api.gpt.ge/kling/v1/images/kolors-virtual-try-on',
    headers={
        'Content-Type': 'application/json',
        'Authorization': 'Bearer sk-xxxx'
    },
    json={
        'model_name': 'kolors-virtual-try-on-v1-5',
        'human_image': 'https://gw.alicdn.com/imgextra/i1/1860536677/O1CN012wEzZ11zC7RDNm0Jr_!!1860536677.jpg',
        'cloth_image': 'https://gw.alicdn.com/imgextra/i4/3370044138/O1CN01p0Zl411gRFvj0NnwQ_!!3370044138.jpg'
    }
)
print(resp.json())

Response Fields

200 Success

FieldTypeDescription
codeintegerReturn code, 0 indicates success
messagestringReturn message
request_idstringUnique request ID
data.task_idstringTask ID
data.task_statusstringTask status, e.g. submitted
data.created_atintegerTask creation timestamp in milliseconds
data.updated_atintegerTask update timestamp in milliseconds

Response Example

json
{
  "code": 0,
  "message": "SUCCEED",
  "request_id": "Cji7cGctxFMAAAAAAEU5sQ",
  "data": {
    "task_id": "Cji7cGctxFMAAAAAAEU5sQ",
    "task_status": "submitted",
    "created_at": 1731172864209,
    "updated_at": 1731172864209
  }
}