Tài liệu tham khảo API đầy đủ cho các mô hình Kling Video O3 của Kuaishou.
Các Biến Thể Mô Hình
API này hỗ trợ tám biến thể mô hình:
So Sánh Nhanh
Tỷ Lệ Khung Hình Được Hỗ Trợ
16:9, 9:16, 1:1
Kling Video O3 Text to Video (Std & Pro)
Endpoint
POST /api/v1/video/task
Tham Số Yêu Cầu
Bắt buộc
Tùy chọn
Placeholder Tham Chiếu @ (AT)
Tính năng tham chiếu @ (AT) liên kết phương tiện tham chiếu với prompt thông qua các placeholder <<<...>>> được đánh số. Số thứ tự hình ảnh bắt đầu từ 1 và tuân theo thứ tự của mảng images. Vì mô hình này nhận một URL video tham chiếu, <<<video_1>>> tham chiếu đến video_url.
Ví Dụ Yêu Cầu
const response = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model_name: 'kling-video-o3-std-text-to-video',
prompt: 'A drone flying over a mountain range at sunrise',
duration: 5,
aspect_ratio: '16:9'
})
});
const { data } = await response.json();
const taskId = data.task_id;
Kling Video O3 Image to Video (Std & Pro)
Tham Số Yêu Cầu
Bắt buộc
Tùy chọn
Ví Dụ Yêu Cầu
{
model_name: 'kling-video-o3-pro-image-to-video',
image_url: 'https://example.com/image.jpg',
prompt: 'Camera slowly pulls back revealing the landscape',
duration: 5,
image_end_url: 'https://example.com/end-frame.jpg'
}
Kling Video O3 Reference to Video (Std & Pro)
Tham Số Yêu Cầu
Bắt buộc
Tùy chọn
Ví Dụ Yêu Cầu
{
model_name: 'kling-video-o3-std-reference-to-video',
video_url: 'https://example.com/source.mp4',
images: ['https://example.com/reference-a.jpg', 'https://example.com/reference-b.jpg'],
prompt: 'Character walking through a forest',
duration: 8,
aspect_ratio: '16:9',
keep_original_sound: true
}
Kling Video O3 Video Edit (Std & Pro)
Tham Số Yêu Cầu
Bắt buộc
Tùy chọn
Ví Dụ Yêu Cầu
{
model_name: 'kling-video-o3-pro-video-edit',
video_url: 'https://example.com/source.mp4',
duration: 5,
images: ['https://example.com/ref.jpg'],
prompt: 'Add falling snow throughout the scene',
keep_original_sound: true
}
Ví Dụ Yêu Cầu Reference-to-Video @ (AT)
{
model_name: 'kling-video-o3-std-reference-to-video',
video_url: 'https://example.com/motion-reference.mp4',
images: [
'https://example.com/athlete-reference.jpg',
'https://example.com/uniform-reference.jpg'
],
prompt: 'Make the athlete from <<<image_1>>> follow the motion in <<<video_1>>> while preserving the uniform details from <<<image_2>>>',
duration: 8,
aspect_ratio: '16:9',
keep_original_sound: true
}
Định Dạng Phản Hồi
Phản Hồi Ban Đầu
{
"code": 0,
"message": "success",
"data": {
"task_id": "{task_id}",
"response_url": "https://api.flaq.ai/api/v1/video/{task_id}",
"task_status": "submitted"
}
}
Phản Hồi Polling
Thực hiện polling tại GET /api/v1/video/{taskId} để kiểm tra trạng thái:
{
"code": 0,
"message": "success",
"data": {
"task_id": "{task_id}",
"response_url": "https://api.flaq.ai/api/v1/video/{task_id}",
"task_status": "succeed",
"task_status_msg": null,
"task_result": {
"credit": 0.2,
"videos": [
{
"url": "https://example.com/generated-video.mp4"
}
]
}
}
}
Các Giá Trị Trạng Thái
submitted: Tác vụ đã được gửi và đang chờ xử lý
processing: Quá trình tạo video đang diễn ra
succeed: Tạo video hoàn tất
failed: Tạo video thất bại
Thời Gian Xử Lý
- Standard: 2-5 phút
- Pro: 3-8 phút
Thực Hành Tốt Nhất
- Lựa Chọn Tier: Dùng Std để thử nghiệm lặp, dùng Pro cho kết quả cuối cùng
- Mô Tả Chuyển Động: Bao gồm chi tiết cụ thể về chuyển động của máy quay và đối tượng
- Đầu Vào Tham Chiếu: Sử dụng hình ảnh tham chiếu hoặc video tham chiếu rõ ràng, chất lượng cao để đảm bảo tính nhất quán của nhân vật
- Prompt Chỉnh Sửa Video: Mô tả cụ thể những gì cần thay đổi trong khi vẫn giữ nguyên nội dung gốc