Model yolları
Modele göre Kling metinden videoya görevi oluşturma
Modele özgü bir rota kullanarak metin Prompt’undan Kling videosu oluşturun, ardından görev kimliğiyle videoyu alın.
POST
/
text-to-video
/
{model}
cURL
curl https://api.cometapi.com/text-to-video/kling-3.0-turbo \
-X POST \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
--data-raw '{
"prompt": "A paper boat drifts across a calm pond at sunrise.",
"settings": {
"resolution": "720p",
"aspect_ratio": "16:9",
"duration": 5
}
}'import os
import requests
response = requests.post(
"https://api.cometapi.com/text-to-video/kling-3.0-turbo",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"prompt": "A paper boat drifts across a calm pond at sunrise.",
"settings": {
"resolution": "720p",
"aspect_ratio": "16:9",
"duration": 5
},
},
)
response.raise_for_status()
print(response.json()["data"]["id"])
const response = await fetch(
"https://api.cometapi.com/text-to-video/kling-3.0-turbo",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
prompt: "A paper boat drifts across a calm pond at sunrise.",
settings: {
resolution: "720p",
aspect_ratio: "16:9",
duration: 5,
},
}),
},
);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log((await response.json()).data.id);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/text-to-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([
'prompt' => 'A paper boat drifts across a calm pond at sunrise.'
]),
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/text-to-video/{model}"
payload := strings.NewReader("{\n \"prompt\": \"A paper boat drifts across a calm pond at sunrise.\"\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/text-to-video/{model}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A paper boat drifts across a calm pond at sunrise.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/text-to-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 \"prompt\": \"A paper boat drifts across a calm pond at sunrise.\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "SUCCEED",
"data": {
"id": "example-task-id",
"status": "submitted"
}
}Video görevi oluşturmak için
Bu gövdeyi CometAPI API anahtarınızla
POST /text-to-video/{model} adresine bir Prompt gönderin. Yanıt, sonucu almak için kullanacağınız bir id içerir.
Model seçme
Model kimliğini URL’ye ekleyin. JSON gövdesine model alanı eklemeyin.| Model kimliği | Çözünürlük | Süre | Ses |
|---|---|---|---|
kling-4.0 | 720p, 1080p | 3 ile 30 saniye arasında bir tam sayı | Belirtmeyin audio |
kling-3.0-turbo | 720p, 1080p | 3 ile 15 saniye arasında bir tam sayı | Belirtmeyin audio |
kling-3.0 | 720p, 1080p, 4k | 3 ile 15 saniye arasında bir tam sayı | native veya off |
kling-2.6 | 720p, 1080p | 5 veya 10 saniye | native veya off; 1080p değerini şu değerle kullanın: native |
kling-2.5-turbo | 720p, 1080p | 5 veya 10 saniye | Belirtmeyin audio |
İstek parametreleri
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
Yol model | string | Evet | URL’deki model kimliği. Yukarıdaki tablodan bir kimlik seçin; bunu istek gövdesine eklemeyin. |
prompt | string | Evet | Oluşturulacak videonun açıklaması. |
settings.resolution | string | Hayır | Yukarıda seçilen modelin satırında belirtilen çıktı çözünürlüğü. Varsayılan değer: 720p. |
settings.aspect_ratio | string | Hayır | Çıktı kare oranı: 21:9 (yalnızca kling-4.0), 16:9, 9:16 veya 1:1. Varsayılan değer: 16:9. |
settings.duration | integer | Hayır | Yukarıda seçilen modelin satırında belirtilen, saniye cinsinden video uzunluğu. Varsayılan değer 10 olup kling-4.0 için geçerlidir; diğer modeller için varsayılan değer 5 şeklindedir. Bir string değil, tam sayı gönderin. |
settings.multi_shot | boolean | Hayır | Yalnızca kling-3.0 için resmi varsayılan değer true şeklindedir. Birden fazla çekim için true, tek çekim için false değerini ayarlayın ve bu alanı kullanırken değeri açıkça belirtin. |
settings.audio | string | Hayır | kling-3.0 veya kling-2.6 için ses oluşturulmasını istiyorsanız native, ses oluşturulmamasını istiyorsanız off değerini ayarlayın. Bu alanı kullanırken değeri açıkça belirtin. |
options.callback_url | string | Hayır | Görev güncellemelerini alan herkese açık URL. |
options.external_task_id | string | Hayır | Görevi uygulamanızla eşleştirmek için kullandığınız kimlik. |
options.watermark_info | object | Hayır | Çıktı için filigran yapılandırması. |
kling-4.0 için settings.audio anahtarı sunulmaz. Videoları bir ses parçası içerir; modelin yok sayacağı bir değer göndermek yerine alanı belirtmeyin.
Aşağıdaki istek, kling-3.0-turbo ile beş saniyelik bir video oluşturur:
{
"prompt": "A paper boat drifts across a calm pond at sunrise.",
"settings": {
"resolution": "720p",
"aspect_ratio": "16:9",
"duration": 5
}
}
https://api.cometapi.com/text-to-video/kling-3.0-turbo adresine gönderin. OpenAPI kod panelinde aynı gövdeyi kullanan Shell, Python ve JavaScript istekleri bulunur.
Videoyu alma
Oluşturma yanıtı şu yapıdadır:{
"code": 0,
"message": "SUCCEED",
"data": {
"id": "example-task-id",
"status": "submitted"
}
}
data.id değerini kaydedin. Bu kimlikle Kling görevi alma işlemini görev son duruma ulaşana kadar kullanın. Video URL’sini görevin outputs dizisinden alın.Yol Parametreleri
Gövde
application/json
Text-to-video request fields exposed by the CometAPI route. The model ID is a path parameter, not a body field.
Yanıt
200 - application/json
The task was created. Use data.id to retrieve its status and video output.
Son değiştirilme tarihi 13 Kasım 2026
⌘I
cURL
curl https://api.cometapi.com/text-to-video/kling-3.0-turbo \
-X POST \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
--data-raw '{
"prompt": "A paper boat drifts across a calm pond at sunrise.",
"settings": {
"resolution": "720p",
"aspect_ratio": "16:9",
"duration": 5
}
}'import os
import requests
response = requests.post(
"https://api.cometapi.com/text-to-video/kling-3.0-turbo",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"prompt": "A paper boat drifts across a calm pond at sunrise.",
"settings": {
"resolution": "720p",
"aspect_ratio": "16:9",
"duration": 5
},
},
)
response.raise_for_status()
print(response.json()["data"]["id"])
const response = await fetch(
"https://api.cometapi.com/text-to-video/kling-3.0-turbo",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
prompt: "A paper boat drifts across a calm pond at sunrise.",
settings: {
resolution: "720p",
aspect_ratio: "16:9",
duration: 5,
},
}),
},
);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log((await response.json()).data.id);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/text-to-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([
'prompt' => 'A paper boat drifts across a calm pond at sunrise.'
]),
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/text-to-video/{model}"
payload := strings.NewReader("{\n \"prompt\": \"A paper boat drifts across a calm pond at sunrise.\"\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/text-to-video/{model}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A paper boat drifts across a calm pond at sunrise.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/text-to-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 \"prompt\": \"A paper boat drifts across a calm pond at sunrise.\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "SUCCEED",
"data": {
"id": "example-task-id",
"status": "submitted"
}
}