Kling Video Create Voice
curl --request POST \
--url https://api.aihubmax.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-video-create-voice",
"voice_url": "https://v3b.fal.media/files/b/0a867736/_Wo19V-XrOVYZt6jKE8t5_kling_video.wav"
}
'import requests
url = "https://api.aihubmax.com/v1/videos/generations"
payload = {
"model": "kling-video-create-voice",
"voice_url": "https://v3b.fal.media/files/b/0a867736/_Wo19V-XrOVYZt6jKE8t5_kling_video.wav"
}
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({
model: 'kling-video-create-voice',
voice_url: 'https://v3b.fal.media/files/b/0a867736/_Wo19V-XrOVYZt6jKE8t5_kling_video.wav'
})
};
fetch('https://api.aihubmax.com/v1/videos/generations', 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.aihubmax.com/v1/videos/generations",
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([
'model' => 'kling-video-create-voice',
'voice_url' => 'https://v3b.fal.media/files/b/0a867736/_Wo19V-XrOVYZt6jKE8t5_kling_video.wav'
]),
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.aihubmax.com/v1/videos/generations"
payload := strings.NewReader("{\n \"model\": \"kling-video-create-voice\",\n \"voice_url\": \"https://v3b.fal.media/files/b/0a867736/_Wo19V-XrOVYZt6jKE8t5_kling_video.wav\"\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.aihubmax.com/v1/videos/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"kling-video-create-voice\",\n \"voice_url\": \"https://v3b.fal.media/files/b/0a867736/_Wo19V-XrOVYZt6jKE8t5_kling_video.wav\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aihubmax.com/v1/videos/generations")
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 \"model\": \"kling-video-create-voice\",\n \"voice_url\": \"https://v3b.fal.media/files/b/0a867736/_Wo19V-XrOVYZt6jKE8t5_kling_video.wav\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1757165031,
"id": "task-unified-1757165031-uyujaw3d",
"model": "<string>",
"object": "video.generation.task",
"progress": 0,
"status": "pending",
"task_info": {
"can_cancel": true,
"estimated_time": 45
},
"type": "video"
}{
"error": {
"message": "请求格式错误",
"type": "invalid_request_error"
}
}{
"error": {
"message": "API密钥无效",
"type": "authentication_error"
}
}{
"error": {
"message": "账户余额不足",
"type": "insufficient_quota"
}
}{
"error": {
"message": "参数校验失败",
"type": "validation_error"
}
}{
"error": {
"message": "请求频率超限",
"type": "rate_limit_error"
}
}{
"error": {
"message": "服务器内部错误",
"type": "server_error"
}
}{
"error": {
"message": "服务暂不可用,请稍后重试",
"type": "service_unavailable"
}
}Kling
Kling 创建音色
- 将参考音频注册为可复用声音并返回
voice_id - 生成的视频主体元素可通过该
voice_id绑定声音 - 异步处理模式,使用返回的任务ID 进行查询
voice_id会在任务详情的results字段中返回
POST
/
v1
/
videos
/
generations
Kling Video Create Voice
curl --request POST \
--url https://api.aihubmax.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-video-create-voice",
"voice_url": "https://v3b.fal.media/files/b/0a867736/_Wo19V-XrOVYZt6jKE8t5_kling_video.wav"
}
'import requests
url = "https://api.aihubmax.com/v1/videos/generations"
payload = {
"model": "kling-video-create-voice",
"voice_url": "https://v3b.fal.media/files/b/0a867736/_Wo19V-XrOVYZt6jKE8t5_kling_video.wav"
}
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({
model: 'kling-video-create-voice',
voice_url: 'https://v3b.fal.media/files/b/0a867736/_Wo19V-XrOVYZt6jKE8t5_kling_video.wav'
})
};
fetch('https://api.aihubmax.com/v1/videos/generations', 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.aihubmax.com/v1/videos/generations",
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([
'model' => 'kling-video-create-voice',
'voice_url' => 'https://v3b.fal.media/files/b/0a867736/_Wo19V-XrOVYZt6jKE8t5_kling_video.wav'
]),
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.aihubmax.com/v1/videos/generations"
payload := strings.NewReader("{\n \"model\": \"kling-video-create-voice\",\n \"voice_url\": \"https://v3b.fal.media/files/b/0a867736/_Wo19V-XrOVYZt6jKE8t5_kling_video.wav\"\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.aihubmax.com/v1/videos/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"kling-video-create-voice\",\n \"voice_url\": \"https://v3b.fal.media/files/b/0a867736/_Wo19V-XrOVYZt6jKE8t5_kling_video.wav\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aihubmax.com/v1/videos/generations")
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 \"model\": \"kling-video-create-voice\",\n \"voice_url\": \"https://v3b.fal.media/files/b/0a867736/_Wo19V-XrOVYZt6jKE8t5_kling_video.wav\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1757165031,
"id": "task-unified-1757165031-uyujaw3d",
"model": "<string>",
"object": "video.generation.task",
"progress": 0,
"status": "pending",
"task_info": {
"can_cancel": true,
"estimated_time": 45
},
"type": "video"
}{
"error": {
"message": "请求格式错误",
"type": "invalid_request_error"
}
}{
"error": {
"message": "API密钥无效",
"type": "authentication_error"
}
}{
"error": {
"message": "账户余额不足",
"type": "insufficient_quota"
}
}{
"error": {
"message": "参数校验失败",
"type": "validation_error"
}
}{
"error": {
"message": "请求频率超限",
"type": "rate_limit_error"
}
}{
"error": {
"message": "服务器内部错误",
"type": "server_error"
}
}{
"error": {
"message": "服务暂不可用,请稍后重试",
"type": "service_unavailable"
}
}授权
所有接口均需要使用Bearer Token进行认证
使用时在请求头中添加:
Authorization: Bearer YOUR_API_KEY
请求体
application/json
kling-video-create-voice:上传声音参考 URL,返回可绑定到视频主体元素的 voice_id
示例:
"kling-video-create-voice"
声音参考音频的 URL
说明:
- 需为 HTTP/HTTPS 可访问地址
- 用于生成可绑定到视频主体元素的
voice_id - 支持常见音频格式,例如
mp3、ogg、wav、m4a、aac
示例:
"https://v3b.fal.media/files/b/0a867736/_Wo19V-XrOVYZt6jKE8t5_kling_video.wav"
响应
任务创建成功
任务创建时间戳
示例:
1757165031
任务ID
示例:
"task-unified-1757165031-uyujaw3d"
实际使用的模型名称
任务的具体类型
可用选项:
video.generation.task 任务进度百分比 (0-100)
必填范围:
0 <= x <= 100示例:
0
任务状态
可用选项:
pending, processing, completed, failed 示例:
"pending"
异步任务信息
Show child attributes
Show child attributes
任务的输出类型
可用选项:
video 示例:
"video"
⌘I