图生视频(可灵 3.0)
curl --request POST \
--url https://api.looprouter.com/image-to-video/{model} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "镜头缓缓推进,人物转身微笑",
"settings": {
"resolution": "1080p",
"duration": 5
},
"contents": [
{
"type": "first_frame",
"url": "https://example.com/first.jpg"
},
{
"type": "last_frame",
"url": "https://example.com/last.jpg"
}
]
}
'import requests
url = "https://api.looprouter.com/image-to-video/{model}"
payload = {
"prompt": "镜头缓缓推进,人物转身微笑",
"settings": {
"resolution": "1080p",
"duration": 5
},
"contents": [
{
"type": "first_frame",
"url": "https://example.com/first.jpg"
},
{
"type": "last_frame",
"url": "https://example.com/last.jpg"
}
]
}
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', duration: 5},
contents: [
{type: 'first_frame', url: 'https://example.com/first.jpg'},
{type: 'last_frame', url: 'https://example.com/last.jpg'}
]
})
};
fetch('https://api.looprouter.com/image-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/image-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',
'duration' => 5
],
'contents' => [
[
'type' => 'first_frame',
'url' => 'https://example.com/first.jpg'
],
[
'type' => 'last_frame',
'url' => 'https://example.com/last.jpg'
]
]
]),
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/image-to-video/{model}"
payload := strings.NewReader("{\n \"prompt\": \"镜头缓缓推进,人物转身微笑\",\n \"settings\": {\n \"resolution\": \"1080p\",\n \"duration\": 5\n },\n \"contents\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/first.jpg\"\n },\n {\n \"type\": \"last_frame\",\n \"url\": \"https://example.com/last.jpg\"\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.looprouter.com/image-to-video/{model}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"镜头缓缓推进,人物转身微笑\",\n \"settings\": {\n \"resolution\": \"1080p\",\n \"duration\": 5\n },\n \"contents\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/first.jpg\"\n },\n {\n \"type\": \"last_frame\",\n \"url\": \"https://example.com/last.jpg\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.looprouter.com/image-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 \"duration\": 5\n },\n \"contents\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/first.jpg\"\n },\n {\n \"type\": \"last_frame\",\n \"url\": \"https://example.com/last.jpg\"\n }\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 图生视频任务。contents 放 first_frame(可加 last_frame)。 模型名写在路径中(kling-3.0 / kling-3.0-turbo)。
POST
/
image-to-video
/
{model}
图生视频(可灵 3.0)
curl --request POST \
--url https://api.looprouter.com/image-to-video/{model} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "镜头缓缓推进,人物转身微笑",
"settings": {
"resolution": "1080p",
"duration": 5
},
"contents": [
{
"type": "first_frame",
"url": "https://example.com/first.jpg"
},
{
"type": "last_frame",
"url": "https://example.com/last.jpg"
}
]
}
'import requests
url = "https://api.looprouter.com/image-to-video/{model}"
payload = {
"prompt": "镜头缓缓推进,人物转身微笑",
"settings": {
"resolution": "1080p",
"duration": 5
},
"contents": [
{
"type": "first_frame",
"url": "https://example.com/first.jpg"
},
{
"type": "last_frame",
"url": "https://example.com/last.jpg"
}
]
}
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', duration: 5},
contents: [
{type: 'first_frame', url: 'https://example.com/first.jpg'},
{type: 'last_frame', url: 'https://example.com/last.jpg'}
]
})
};
fetch('https://api.looprouter.com/image-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/image-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',
'duration' => 5
],
'contents' => [
[
'type' => 'first_frame',
'url' => 'https://example.com/first.jpg'
],
[
'type' => 'last_frame',
'url' => 'https://example.com/last.jpg'
]
]
]),
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/image-to-video/{model}"
payload := strings.NewReader("{\n \"prompt\": \"镜头缓缓推进,人物转身微笑\",\n \"settings\": {\n \"resolution\": \"1080p\",\n \"duration\": 5\n },\n \"contents\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/first.jpg\"\n },\n {\n \"type\": \"last_frame\",\n \"url\": \"https://example.com/last.jpg\"\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.looprouter.com/image-to-video/{model}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"镜头缓缓推进,人物转身微笑\",\n \"settings\": {\n \"resolution\": \"1080p\",\n \"duration\": 5\n },\n \"contents\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/first.jpg\"\n },\n {\n \"type\": \"last_frame\",\n \"url\": \"https://example.com/last.jpg\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.looprouter.com/image-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 \"duration\": 5\n },\n \"contents\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/first.jpg\"\n },\n {\n \"type\": \"last_frame\",\n \"url\": \"https://example.com/last.jpg\"\n }\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