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)
| Parameter | Type | Required | Description |
|---|---|---|---|
| callback_url | string | No | Callback URL for task result notifications |
| model_name | string | No | Model name, enum: kolors-virtual-try-on-v1-5, kolors-virtual-try-on-v1. Default is kolors-virtual-try-on-v1 |
| human_image | string | Yes | Human image (Base64 or URL), supports jpg/jpeg/png, <=10MB, resolution >=300x300 |
| cloth_image | string | Yes | Clothing image (product image or white-background image), supports jpg/jpeg/png, <=10MB, resolution >=300x300 |
The model
kolors-virtual-try-on-v1-5supports 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
| Field | Type | Description |
|---|---|---|
| code | integer | Return code, 0 indicates success |
| message | string | Return message |
| request_id | string | Unique request ID |
| data.task_id | string | Task ID |
| data.task_status | string | Task status, e.g. submitted |
| data.created_at | integer | Task creation timestamp in milliseconds |
| data.updated_at | integer | Task 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
}
}