
文字生成圖像
根據文字提示詞建立 AI 圖像
使用快手 Kling 4.0 API,在 Best Image AI 延伸現有影片片段,創作更長的產品故事、行銷活動影片片段和社群影片。
快手 Kling 4.0 Video Extend API 協助開發者與創意團隊透過 Best Image AI 續寫現有影片。 以來源片段為基礎,用文字描述接下來的動作或場景,並可選擇提供結尾影像, 引導最終畫面構圖。此 Kling 影片續寫 API 支援更長的產品故事、行銷活動結尾和社群 影片,將原始影片與生成的續寫片段一併回傳,並維持來源影片的長寬比。
現有影片續寫: 以來源影片為起點,透過文字提示詞描述接下來的動作或場景 發展。
可選目標結尾影格: 當新增片段需要朝特定的最終構圖發展時,可提供結尾 影像。
新增片段時長控制: 獨立設定要生成的新片段時長,不受來源片段 現有長度的限制。
完整影片輸出: 一併取得原始影片與生成的續寫片段,用於剪輯 工作流程、行銷活動製作和內容交付。
保留來源影片長寬比: 輸出沿用來源影片的長寬比,讓續寫片段維持 相同的畫幅格式。
可選輸出解析度: 根據延長後影片的交付需求,選擇 720p 或 1080p。
方便開發者整合: 為創意工具和自動化工作流程加入影片續寫功能,用於延長 產品片段、行銷活動影片和敘事序列。
輸入: 必填的來源影片 URL 和描述預期續寫內容的自然語言提示詞,以及 可選的目標結尾影像 URL。
輸出: 包含原始片段和新生成片段的完整影片。
結尾影格: 可選擇加入影像,引導延長片段最終呈現的畫面。
解析度: 每次請求均需選擇支援的輸出解析度。
長寬比: 結果沿用來源影片的長寬比。此工作流程無法另外設定輸出長寬比。
時長: 明確指定新增片段為 3 至 30 秒。完整影片的時長為來源 片段長度加上請求的延長時長。
計費: 用量取決於延長時長和所選解析度。延長時長範圍並不 代表來源影片的上傳限制。
功能: 根據提示詞續寫影片、可選結尾影格引導、可調整的延長時長、 保留來源影片長寬比,以及完整影片輸出。
敘事影片製作: 在現有片段之後續寫下一個動作、環境變化或場景節奏, 用於視覺故事和創意序列。
產品與行銷活動結尾: 為產品展示和品牌序列增加片段,引導 影片走向預期的結尾。
目標影格序列: 當續寫內容需要接近預設的結尾構圖時,可提供最終影像。
社群影片節奏調整: 為選定片段加入續寫內容,同時保留適合目標 發布版位的畫幅格式。
自動化影片工作流程: 將來源影片上傳、續寫提示詞和可選結尾影像整合至 創意應用程式,交付延長後的完整影片。
注意 請確保提示詞和媒體內容符合快手及 Best Image AI 的內容安全要求,並使用您有權使用的影片素材和結尾影像。
Kling 4.0 與 Veo 3.1 影片延長
Veo 3.1 支援延長先前由 Veo 生成的影片。
Kling 4.0 Video Extend 接收來源影片 URL 和可選結尾影像,並一併回傳原始片段
及其續寫內容。
Kling 4.0 與 Luma Ray2 影片延長
Luma 的 Ray2 延長工作流程可續寫已完成生成的影片,
並支援結尾影格引導。Kling 4.0 Video Extend 在 Best Image AI 上使用來源影片 URL、明確指定的新增時長,
以及可選的目標影格引導。
Kling 4.0 Video Extend 與 Kling 4.0 Video Edit
Video Edit 用於修改影片內容,並使用總輸出時長。Video Extend 則在
現有片段的基礎上增加請求的時長,並回傳延長後的完整結果。
Kling 4.0 Video Extend 與 Kling 4.0 Image-to-Video
Image-to-Video 從開場影像建立影片序列,並可選擇提供結尾及中間影格。Video Extend
則在需要生成後續內容時,以現有影片為起點。
Kling 4.0 Video Extend 與 Kling 4.0 Reference-to-Video
Reference-to-Video 使用可選媒體引導生成。Video Extend 必須提供要續寫的片段,維持其
長寬比,並將請求時長視為新增片段的時長。
在瀏覽器中探索多種 AI 創作工具,快速完成圖像和影片工作流程,再透過 Best Image AI 可用於正式環境的模型 API 擴展成功創意。Best Image AI 為所有模型提供統一 API 層,讓工作流程的使用和擴展更輕鬆。
// Step 1: Submit generation request
const response = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
model_name: 'kling-v4.0-video-extend',
prompt: 'Continue the camera movement forward through the valley as the sun rises above the mountains',
video_url: 'https://example.com/source.mp4',
resolution: '720p',
duration: 5
})
});
const { data } = await response.json();
const taskId = data.task_id;
// Step 2: Poll for results
const taskId = data.task_id;
const pollResult = async (taskId) => {
const res = await fetch(`https://api.flaq.ai/api/v1/video/${taskId}`, {
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});
return res.json();
};
while (true) {
const pollResultData = await pollResult(taskId);
const status = pollResultData.data.task_status;
if (status === 'succeed') {
console.log(pollResultData.data.task_result.videos[].);
;
}
(status === ) {
.(pollResultData..);
;
}
( (resolve, ));
}
# Step 1: Submit generation request
import requests
response = requests.post(
'https://api.flaq.ai/api/v1/video/task',
headers={
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
json={
'model_name': 'kling-v4.0-video-extend',
'prompt': 'Continue the camera movement forward through the valley as the sun rises above the mountains',
'video_url': 'https://example.com/source.mp4',
'resolution': '720p',
'duration': 5
}
)
result = response.json()
task_id = result['data']['task_id']
# Step 1: Submit generation request
curl -X POST https://api.flaq.ai/api/v1/video/task \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model_name": "kling-v4.0-video-extend",
"prompt": "Continue the camera movement forward through the valley as the sun rises above the mountains",
"video_url": "https://example.com/source.mp4",
"resolution": "720p",
"duration": 5
}'
# Step 2: Poll for results
# Replace {task_id} with the task_id returned from the submit response
curl -X GET "https://api.flaq.ai/api/v1/video/{task_id}" \
-H "Authorization: Bearer YOUR_API_KEY"
# Step 2: Poll for results
task_id = response.json()['data']['task_id']
poll_url = f"https://api.flaq.ai/api/v1/video/{task_id}"
while True:
poll_result = requests.get(poll_url, headers={'Authorization': 'Bearer YOUR_API_KEY'}).json()
status = poll_result['data']['task_status']
if status == 'succeed':
print(poll_result['data']['task_result']['videos'][0]['url'])
break
if status == 'failed':
print(poll_result['data']['task_status_msg'])
break
time.sleep(10)