Kling Video O3 API
เอกสารอ้างอิง API ฉบับสมบูรณ์สำหรับโมเดล Kling Video O3 โดย Kuaishou.
ตัวเลือกโมเดล {#}
API นี้รองรับ model variants 8 แบบ:
เปรียบเทียบอย่างรวดเร็ว
อัตราส่วนภาพที่รองรับ
16:9, 9:16, 1:1
Kling Video O3 ข้อความเป็นวิดีโอ (Std & Pro)
จุดเชื่อมต่อ
POST /api/v1/video/task
พารามิเตอร์คำขอ
จำเป็น
ไม่บังคับ
ตัวยึดตำแหน่งอ้างอิง @ (AT)
ฟีเจอร์อ้างอิง @ (AT) เชื่อมโยงสื่ออ้างอิงกับพรอมต์ผ่านตัวยึดตำแหน่ง <<<...>>> ที่มีหมายเลข โดยหมายเลขรูปภาพเริ่มจาก 1 และเรียงตามอาร์เรย์ images เนื่องจากโมเดลนี้รับ URL วิดีโออ้างอิงหนึ่งรายการ <<<video_1>>> จึงอ้างอิงถึง video_url
ตัวอย่างคำขอ
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 รูปภาพเป็นวิดีโอ (Std & Pro)
พารามิเตอร์คำขอ
จำเป็น
ไม่บังคับ
ตัวอย่างคำขอ
{
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 อ้างอิงเป็นวิดีโอ (Std & Pro)
พารามิเตอร์คำขอ
จำเป็น
ไม่บังคับ
ตัวอย่างคำขอ
{
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 แก้ไขวิดีโอ (Std & Pro)
พารามิเตอร์คำขอ
จำเป็น
ไม่บังคับ
ตัวอย่างคำขอ
{
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
}
ตัวอย่างคำขอ 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
}
รูปแบบการตอบกลับ
การตอบกลับเริ่มต้น
{
"code": 0,
"message": "success",
"data": {
"task_id": "{task_id}",
"response_url": "https://api.flaq.ai/api/v1/video/{task_id}",
"task_status": "submitted"
}
}
การตอบกลับจากการ Poll
Poll GET /api/v1/video/{taskId} เพื่อตรวจสอบสถานะ:
{
"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": {
"videos": [
{
"url": "https://example.com/generated-video.mp4"
}
]
}
}
}
ค่าสถานะ
submitted: รับงานแล้วและรอประมวลผล
processing: กำลังสร้างวิดีโอ
succeed: การสร้างวิดีโอเสร็จสมบูรณ์
failed: การสร้างวิดีโอล้มเหลว
เวลาประมวลผล
- Standard: 2-5 นาที
- Pro: 3-8 นาที
แนวทางปฏิบัติที่ดี
- การเลือก tier: ใช้ Std สำหรับการวนปรับ และใช้ Pro สำหรับเอาต์พุตสุดท้าย
- คำอธิบายการเคลื่อนไหว: ใส่รายละเอียดเฉพาะของการเคลื่อนไหวกล้องและวัตถุ
- อินพุต reference: ใช้รูปหรือวิดีโอ reference ที่ชัดเจนและคุณภาพสูงเพื่อความสอดคล้องของตัวละครที่ดีขึ้น
- พรอมต์แก้ไขวิดีโอ: ระบุให้ชัดเจนว่าต้องการเปลี่ยนอะไรพร้อมคงคอนเทนต์เดิมไว้