数字人提交(可灵 3.0)
curl --request POST \
--url https://api.looprouter.com/videos/avatar/image2video \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image": "https://example.com/face.png",
"audio_id": "voice-abc-123",
"prompt": "news anchor reading headlines",
"mode": "std"
}
'import requests
url = "https://api.looprouter.com/videos/avatar/image2video"
payload = {
"image": "https://example.com/face.png",
"audio_id": "voice-abc-123",
"prompt": "news anchor reading headlines",
"mode": "std"
}
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({
image: 'https://example.com/face.png',
audio_id: 'voice-abc-123',
prompt: 'news anchor reading headlines',
mode: 'std'
})
};
fetch('https://api.looprouter.com/videos/avatar/image2video', 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/videos/avatar/image2video",
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([
'image' => 'https://example.com/face.png',
'audio_id' => 'voice-abc-123',
'prompt' => 'news anchor reading headlines',
'mode' => 'std'
]),
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/videos/avatar/image2video"
payload := strings.NewReader("{\n \"image\": \"https://example.com/face.png\",\n \"audio_id\": \"voice-abc-123\",\n \"prompt\": \"news anchor reading headlines\",\n \"mode\": \"std\"\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/videos/avatar/image2video")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"image\": \"https://example.com/face.png\",\n \"audio_id\": \"voice-abc-123\",\n \"prompt\": \"news anchor reading headlines\",\n \"mode\": \"std\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.looprouter.com/videos/avatar/image2video")
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 \"image\": \"https://example.com/face.png\",\n \"audio_id\": \"voice-abc-123\",\n \"prompt\": \"news anchor reading headlines\",\n \"mode\": \"std\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "SUCCEED",
"request_id": "<string>",
"data": {
"task_id": "<string>",
"task_status": "submitted",
"task_status_msg": "<string>",
"task_result": {
"videos": [
{
"id": "<string>",
"url": "<string>",
"duration": "<string>"
}
]
},
"created_at": 123,
"updated_at": 123
}
}{
"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-avatar。输出时长跟随驱动音频(2-300 秒),提交时按最大计费时长(300 秒) 预扣、完成后回收。image 必填;音源用 sound_file(URL)或 audio_id(既有音色)二选一。
数字人用官方 ack 信封(data.task_id / task_status / task_result.videos[]),成功态为 succeed(注意与视频端点的 succeeded 不同)。查询走专属端点 GET /videos/avatar/image2video/,不走 GET /tasks。路径均可加 /v1 前缀。
POST
/
videos
/
avatar
/
image2video
数字人提交(可灵 3.0)
curl --request POST \
--url https://api.looprouter.com/videos/avatar/image2video \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image": "https://example.com/face.png",
"audio_id": "voice-abc-123",
"prompt": "news anchor reading headlines",
"mode": "std"
}
'import requests
url = "https://api.looprouter.com/videos/avatar/image2video"
payload = {
"image": "https://example.com/face.png",
"audio_id": "voice-abc-123",
"prompt": "news anchor reading headlines",
"mode": "std"
}
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({
image: 'https://example.com/face.png',
audio_id: 'voice-abc-123',
prompt: 'news anchor reading headlines',
mode: 'std'
})
};
fetch('https://api.looprouter.com/videos/avatar/image2video', 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/videos/avatar/image2video",
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([
'image' => 'https://example.com/face.png',
'audio_id' => 'voice-abc-123',
'prompt' => 'news anchor reading headlines',
'mode' => 'std'
]),
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/videos/avatar/image2video"
payload := strings.NewReader("{\n \"image\": \"https://example.com/face.png\",\n \"audio_id\": \"voice-abc-123\",\n \"prompt\": \"news anchor reading headlines\",\n \"mode\": \"std\"\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/videos/avatar/image2video")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"image\": \"https://example.com/face.png\",\n \"audio_id\": \"voice-abc-123\",\n \"prompt\": \"news anchor reading headlines\",\n \"mode\": \"std\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.looprouter.com/videos/avatar/image2video")
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 \"image\": \"https://example.com/face.png\",\n \"audio_id\": \"voice-abc-123\",\n \"prompt\": \"news anchor reading headlines\",\n \"mode\": \"std\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "SUCCEED",
"request_id": "<string>",
"data": {
"task_id": "<string>",
"task_status": "submitted",
"task_status_msg": "<string>",
"task_result": {
"videos": [
{
"id": "<string>",
"url": "<string>",
"duration": "<string>"
}
]
},
"created_at": 123,
"updated_at": 123
}
}{
"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- 开头),在控制台「令牌」页创建
请求体
application/json