文生视频(可灵 3.0)
curl --request POST \
--url https://api.looprouter.com/text-to-video/{model} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "一只柯基犬在草地上奔跑,阳光明媚,慢镜头",
"settings": {
"resolution": "1080p",
"aspect_ratio": "16:9",
"duration": 5,
"audio": "native",
"multi_shot": true
}
}
'import requests
url = "https://api.looprouter.com/text-to-video/{model}"
payload = {
"prompt": "一只柯基犬在草地上奔跑,阳光明媚,慢镜头",
"settings": {
"resolution": "1080p",
"aspect_ratio": "16:9",
"duration": 5,
"audio": "native",
"multi_shot": True
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '一只柯基犬在草地上奔跑,阳光明媚,慢镜头',
settings: {
resolution: '1080p',
aspect_ratio: '16:9',
duration: 5,
audio: 'native',
multi_shot: true
}
})
};
fetch('https://api.looprouter.com/text-to-video/{model}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.looprouter.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' => '一只柯基犬在草地上奔跑,阳光明媚,慢镜头',
'settings' => [
'resolution' => '1080p',
'aspect_ratio' => '16:9',
'duration' => 5,
'audio' => 'native',
'multi_shot' => true
]
]),
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.looprouter.com/text-to-video/{model}"
payload := strings.NewReader("{\n \"prompt\": \"一只柯基犬在草地上奔跑,阳光明媚,慢镜头\",\n \"settings\": {\n \"resolution\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"duration\": 5,\n \"audio\": \"native\",\n \"multi_shot\": true\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.looprouter.com/text-to-video/{model}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"一只柯基犬在草地上奔跑,阳光明媚,慢镜头\",\n \"settings\": {\n \"resolution\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"duration\": 5,\n \"audio\": \"native\",\n \"multi_shot\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.looprouter.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\": \"一只柯基犬在草地上奔跑,阳光明媚,慢镜头\",\n \"settings\": {\n \"resolution\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"duration\": 5,\n \"audio\": \"native\",\n \"multi_shot\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "SUCCEED",
"request_id": "<string>",
"data": {
"id": "<string>",
"status": "submitted",
"create_time": 123,
"update_time": 123,
"external_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"param": "<string>",
"type": "BadRequest"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"param": "<string>",
"type": "BadRequest"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"param": "<string>",
"type": "BadRequest"
}
}可灵系列
文生视频(可灵 3.0)
提交可灵 3.0 文生视频任务。模型名写在路径中(kling-3.0 / kling-3.0-turbo), 请求体用 prompt + settings。仅返回任务 id,成片需轮询 GET /tasks 获取。
所有可灵 3.0 端点的路径都可选加 /v1 前缀(如 /v1/text-to-video/{model}),
行为完全一致,方便 Base URL 带 /v1 的可灵 SDK 直接接入。
POST
/
text-to-video
/
{model}
文生视频(可灵 3.0)
curl --request POST \
--url https://api.looprouter.com/text-to-video/{model} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "一只柯基犬在草地上奔跑,阳光明媚,慢镜头",
"settings": {
"resolution": "1080p",
"aspect_ratio": "16:9",
"duration": 5,
"audio": "native",
"multi_shot": true
}
}
'import requests
url = "https://api.looprouter.com/text-to-video/{model}"
payload = {
"prompt": "一只柯基犬在草地上奔跑,阳光明媚,慢镜头",
"settings": {
"resolution": "1080p",
"aspect_ratio": "16:9",
"duration": 5,
"audio": "native",
"multi_shot": True
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '一只柯基犬在草地上奔跑,阳光明媚,慢镜头',
settings: {
resolution: '1080p',
aspect_ratio: '16:9',
duration: 5,
audio: 'native',
multi_shot: true
}
})
};
fetch('https://api.looprouter.com/text-to-video/{model}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.looprouter.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' => '一只柯基犬在草地上奔跑,阳光明媚,慢镜头',
'settings' => [
'resolution' => '1080p',
'aspect_ratio' => '16:9',
'duration' => 5,
'audio' => 'native',
'multi_shot' => true
]
]),
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.looprouter.com/text-to-video/{model}"
payload := strings.NewReader("{\n \"prompt\": \"一只柯基犬在草地上奔跑,阳光明媚,慢镜头\",\n \"settings\": {\n \"resolution\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"duration\": 5,\n \"audio\": \"native\",\n \"multi_shot\": true\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.looprouter.com/text-to-video/{model}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"一只柯基犬在草地上奔跑,阳光明媚,慢镜头\",\n \"settings\": {\n \"resolution\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"duration\": 5,\n \"audio\": \"native\",\n \"multi_shot\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.looprouter.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\": \"一只柯基犬在草地上奔跑,阳光明媚,慢镜头\",\n \"settings\": {\n \"resolution\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"duration\": 5,\n \"audio\": \"native\",\n \"multi_shot\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "SUCCEED",
"request_id": "<string>",
"data": {
"id": "<string>",
"status": "submitted",
"create_time": 123,
"update_time": 123,
"external_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"param": "<string>",
"type": "BadRequest"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"param": "<string>",
"type": "BadRequest"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"param": "<string>",
"type": "BadRequest"
}
}授权
LoopRouter API Key(sk- 开头),在控制台「令牌」页创建
路径参数
可灵 3.0 模型名
可用选项:
kling-3.0, kling-3.0-turbo 请求体
application/json