Kling
Kling 動画を延長する
POST /kling/v1/videos/video-extend を使用して、task_id と video_id で Kling が生成した動画を延長します。親アカウント上のサブタスクとして実行されます。
POST
/
kling
/
v1
/
videos
/
video-extend
cURL
curl https://api.cometapi.com/kling/v1/videos/video-extend \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"task_id": "<parent_task_id>",
"video_id": "<video_id>",
"prompt": "Continue with the same calm morning atmosphere",
"cfg_scale": 0.5
}'import os
import requests
response = requests.post(
"https://api.cometapi.com/kling/v1/videos/video-extend",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"task_id": "<parent_task_id>",
"video_id": "<video_id>",
"prompt": "Continue with the same calm morning atmosphere",
"cfg_scale": 0.5
},
)
result = response.json()
print(result.get("code"), result.get("data", {}).get("task_id"))
const response = await fetch("https://api.cometapi.com/kling/v1/videos/video-extend", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"task_id": "<parent_task_id>",
"video_id": "<video_id>",
"prompt": "Continue with the same calm morning atmosphere",
"cfg_scale": 0.5
}),
});
const result = await response.json();
console.log(result.code, result.data?.task_id);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/kling/v1/videos/video-extend",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'task_id' => '<parent_task_id>',
'video_id' => '<video_id>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/kling/v1/videos/video-extend"
payload := strings.NewReader("{\n \"task_id\": \"<parent_task_id>\",\n \"video_id\": \"<video_id>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cometapi.com/kling/v1/videos/video-extend")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"task_id\": \"<parent_task_id>\",\n \"video_id\": \"<video_id>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/kling/v1/videos/video-extend")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"task_id\": \"<parent_task_id>\",\n \"video_id\": \"<video_id>\"\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"message": "<string>",
"request_id": "<string>",
"data": {
"task_id": "<string>",
"task_status": "<string>",
"task_status_msg": "<string>",
"task_info": {
"parent_video": {
"id": "<string>",
"url": "<string>",
"duration": "<string>"
}
},
"task_result": {
"videos": [
{
"id": "<string>",
"url": "<string>",
"duration": "<string>"
}
]
},
"created_at": 123,
"updated_at": 123
}
}このエンドポイントを使用すると、既存の Kling 動画を後続タスクとして延長できます。
呼び出し前の確認事項
- 完了済みの Kling 動画結果を起点にします
- 親タスクの結果から
video_idを渡します - 親の
task_idをvideo_idとあわせて渡します - 延長に対応したソース動画を使用してください。対応していないソース動画では延長タスクは作成されず、代わりに HTTP 400 が返されます
- 延長互換性の観点では、完了済みの 5 秒の Kling v1 または v1-6 の text-to-video または image-to-video 親タスクを起点にするほうが安全です
- 続きの内容を調整する必要がある場合にのみ、
prompt、negative_prompt、またはcfg_scaleを追加します - 親タスクと同じアカウントコンテキストで延長を実行します
- 親タスクのリソースが期限切れになる前に、速やかに延長を開始してください
タスクフロー
1
親動画タスクを完了する
元の Kling 動画を作成し、その結果が利用可能になるまで待ちます。
2
延長リクエストを送信する
親の
task_id、video_id、および必要に応じて prompt を送信し、返された task id を保存します。3
延長タスクをポーリングする
延長された動画が終端状態になるまで、Kling タスクを取得する を続けて実行します。
完全なパラメータリファレンスについては、Kling の公式ドキュメント を参照してください。
ボディ
application/json
最終更新日 2026年6月25日
⌘I
cURL
curl https://api.cometapi.com/kling/v1/videos/video-extend \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"task_id": "<parent_task_id>",
"video_id": "<video_id>",
"prompt": "Continue with the same calm morning atmosphere",
"cfg_scale": 0.5
}'import os
import requests
response = requests.post(
"https://api.cometapi.com/kling/v1/videos/video-extend",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"task_id": "<parent_task_id>",
"video_id": "<video_id>",
"prompt": "Continue with the same calm morning atmosphere",
"cfg_scale": 0.5
},
)
result = response.json()
print(result.get("code"), result.get("data", {}).get("task_id"))
const response = await fetch("https://api.cometapi.com/kling/v1/videos/video-extend", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"task_id": "<parent_task_id>",
"video_id": "<video_id>",
"prompt": "Continue with the same calm morning atmosphere",
"cfg_scale": 0.5
}),
});
const result = await response.json();
console.log(result.code, result.data?.task_id);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/kling/v1/videos/video-extend",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'task_id' => '<parent_task_id>',
'video_id' => '<video_id>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/kling/v1/videos/video-extend"
payload := strings.NewReader("{\n \"task_id\": \"<parent_task_id>\",\n \"video_id\": \"<video_id>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cometapi.com/kling/v1/videos/video-extend")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"task_id\": \"<parent_task_id>\",\n \"video_id\": \"<video_id>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/kling/v1/videos/video-extend")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"task_id\": \"<parent_task_id>\",\n \"video_id\": \"<video_id>\"\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"message": "<string>",
"request_id": "<string>",
"data": {
"task_id": "<string>",
"task_status": "<string>",
"task_status_msg": "<string>",
"task_info": {
"parent_video": {
"id": "<string>",
"url": "<string>",
"duration": "<string>"
}
},
"task_result": {
"videos": [
{
"id": "<string>",
"url": "<string>",
"duration": "<string>"
}
]
},
"created_at": 123,
"updated_at": 123
}
}