モデル別ルート
Kling Omni動画の作成
URLにモデルIDを指定してKling Omni動画タスクを作成し、タスクIDを使って結果を取得します。
POST
/
omni-video
/
{model}
cURL
curl https://api.cometapi.com/omni-video/kling-3.0-omni \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'JSON'
{
"contents": [
{
"type": "prompt",
"text": "A paper boat drifts on a pond."
}
],
"settings": {
"resolution": "720p",
"aspect_ratio": "16:9",
"duration": 5,
"multi_shot": false,
"audio": "off"
}
}
JSONimport os
import requests
response = requests.post(
"https://api.cometapi.com/omni-video/kling-3.0-omni",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"contents": [
{
"type": "prompt",
"text": "A paper boat drifts on a pond.",
}
],
"settings": {
"resolution": "720p",
"aspect_ratio": "16:9",
"duration": 5,
"multi_shot": False,
"audio": "off",
},
},
)
response.raise_for_status()
result = response.json()
print(result["data"]["id"])
const response = await fetch(
"https://api.cometapi.com/omni-video/kling-3.0-omni",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"contents": [
{
"type": "prompt",
"text": "A paper boat drifts on a pond."
}
],
"settings": {
"resolution": "720p",
"aspect_ratio": "16:9",
"duration": 5,
"multi_shot": false,
"audio": "off"
}
}),
},
);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const result = await response.json();
console.log(result.data.id);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/omni-video/{model}",
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([
'contents' => [
[
'type' => 'prompt',
'text' => 'A paper boat drifts on a pond.'
]
]
]),
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/omni-video/{model}"
payload := strings.NewReader("{\n \"contents\": [\n {\n \"type\": \"prompt\",\n \"text\": \"A paper boat drifts on a pond.\"\n }\n ]\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/omni-video/{model}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contents\": [\n {\n \"type\": \"prompt\",\n \"text\": \"A paper boat drifts on a pond.\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/omni-video/{model}")
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 \"contents\": [\n {\n \"type\": \"prompt\",\n \"text\": \"A paper boat drifts on a pond.\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "SUCCEED",
"data": {
"id": "example-task-id",
"status": "submitted"
}
}POST /omni-video/{model}を使用して、非同期のKling Omni動画タスクを作成します。URLにモデルIDを指定し、contentsに入力を指定します。
モデルを選択する
kling-4.0:720pまたは1080p。3〜30秒。audioフィールドなし。固定のアスペクト比に加えてadaptiveのアスペクト比をサポートし、middle_frameコンテンツを受け付けます。kling-3.0-omni:720p,1080p、または4k。3〜15秒。音声はnative、original、またはoff。kling-o1:720pまたは1080p。3〜10秒。音声はoriginalまたはoff。
kling-3.0-omniを使用します。無音の動画を作成するには、settings.audioをoffに設定します。
リクエストパラメータ
| フィールド | 必須 | 説明 |
|---|---|---|
パス model | はい | URL内のモデルID。上記のリストからIDを選択してください。リクエスト本文には追加しないでください。 |
contents | はい | 空でない動画入力の配列。テキストのみのリクエストでは、prompt項目を含めてください。 |
contents[].type | はい | prompt, first_frame, middle_frame, last_frame, refer_image, feature_video、またはbase_video。middle_frameはkling-4.0で使用できます。last_frameに必要なのは first_frame. |
contents[].text | prompt項目の場合 | 動画を説明するテキスト。 |
contents[].url | 画像または動画項目の場合 | 画像URLまたはBase64画像データ。動画項目には公開動画のURLを使用します。 |
settings.resolution | いいえ | 出力解像度。省略した場合、リクエストには720pが使用されます。使用可能な値は次によって異なります: model. |
settings.aspect_ratio | いいえ | フレームの形状:adaptiveはkling-4.0のみ、16:9、9:16、または1:1。デフォルト値は 16:9. |
settings.duration | いいえ | 動画の長さを秒単位の整数で指定します。デフォルト値は、10がkling-4.0に、5がその他のモデルに適用されます。選択したモデルの範囲内の長さを指定してください。文字列ではなく整数を送信してください。 |
settings.multi_shot | いいえ | kling-3.0-omniでは、複数のショットにはtrueを、連続した1つのショットにはfalseを設定します。次の場合はこのフィールドを含めないでください: kling-o1. |
settings.audio | いいえ | 選択したモデルと入力に応じて、native、original、またはoffを設定します。次ではサポートされません: kling-4.0. |
options.callback_url | いいえ | タスクステータスのコールバックを受信するHTTPS URL。 |
options.external_task_id | いいえ | 対応付けに使用する独自のタスク識別子。問い合わせには返されたdata.idを保持して使用してください。 |
options.watermark_info.enabled | いいえ | ウォーターマークをリクエストするには、trueに設定します。 |
kling-4.0では、base_videoコンテンツ項目は最大1つまでです。kling-3.0-omniでは、feature_video入力にsettings.multi_shot: trueとsettings.audio: offが必要です。base_video入力にはsettings.multi_shot: falseが必要で、settings.audio: nativeは使用できません。base_videoを最初または最後のフレームと組み合わせないでください。
kling-3.0-omniの公式デフォルト値はmulti_shot: trueです。ショットモードを明示的に指定する必要がある場合は、このフィールドを設定してください。kling-o1では、プロンプト(Prompt)は最大2500文字までです。リクエストにfirst_frameのみが含まれ、他の参照画像や動画がない場合は、長さを5秒または10秒にしてください。
5秒間のテキストのみの動画を作成するには、次のリクエスト本文をPOST /omni-video/kling-3.0-omniに送信します:
{
"contents": [
{
"type": "prompt",
"text": "A paper boat drifts on a pond."
}
],
"settings": {
"resolution": "720p",
"aspect_ratio": "16:9",
"duration": 5,
"multi_shot": false,
"audio": "off"
}
}
idが返されます:
{
"code": 0,
"message": "SUCCEED",
"data": {
"id": "example-task-id",
"status": "submitted"
}
}
data.idの値を指定して、 Klingタスクを取得 をタスクが完了するまで実行します。完成した動画のURLは、タスクのoutputs配列から取得します。継続的にアクセスする必要がある場合は、動画を自身のストレージに保存してください。
OpenAPIパネルには、対応するShell、Python、JavaScriptのリクエストが含まれています。入力の組み合わせについて詳しくは、次を参照してください: Kling 3.0 Omni動画APIリファレンス または Kling O1 Omni動画APIリファレンス.パスパラメータ
ボディ
application/json
Omni video request fields exposed by the CometAPI route. The model ID is a path parameter, not a body field.
最終更新日 2026年11月13日
⌘I
cURL
curl https://api.cometapi.com/omni-video/kling-3.0-omni \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'JSON'
{
"contents": [
{
"type": "prompt",
"text": "A paper boat drifts on a pond."
}
],
"settings": {
"resolution": "720p",
"aspect_ratio": "16:9",
"duration": 5,
"multi_shot": false,
"audio": "off"
}
}
JSONimport os
import requests
response = requests.post(
"https://api.cometapi.com/omni-video/kling-3.0-omni",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"contents": [
{
"type": "prompt",
"text": "A paper boat drifts on a pond.",
}
],
"settings": {
"resolution": "720p",
"aspect_ratio": "16:9",
"duration": 5,
"multi_shot": False,
"audio": "off",
},
},
)
response.raise_for_status()
result = response.json()
print(result["data"]["id"])
const response = await fetch(
"https://api.cometapi.com/omni-video/kling-3.0-omni",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"contents": [
{
"type": "prompt",
"text": "A paper boat drifts on a pond."
}
],
"settings": {
"resolution": "720p",
"aspect_ratio": "16:9",
"duration": 5,
"multi_shot": false,
"audio": "off"
}
}),
},
);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const result = await response.json();
console.log(result.data.id);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/omni-video/{model}",
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([
'contents' => [
[
'type' => 'prompt',
'text' => 'A paper boat drifts on a pond.'
]
]
]),
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/omni-video/{model}"
payload := strings.NewReader("{\n \"contents\": [\n {\n \"type\": \"prompt\",\n \"text\": \"A paper boat drifts on a pond.\"\n }\n ]\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/omni-video/{model}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contents\": [\n {\n \"type\": \"prompt\",\n \"text\": \"A paper boat drifts on a pond.\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/omni-video/{model}")
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 \"contents\": [\n {\n \"type\": \"prompt\",\n \"text\": \"A paper boat drifts on a pond.\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "SUCCEED",
"data": {
"id": "example-task-id",
"status": "submitted"
}
}