kling-v3-omni
最后更新:2026-11-14
POSThttps://www.sagelib.com/videos
kling-v3-omni 模型的视频生成接口,OpenAI 兼容,支持文生视频、图生视频、多镜头、参考素材与音色配音等。
接口鉴权方式请参考:API接入与鉴权
请求参数
请求头
| 参数名称 | 描述 |
|---|---|
*Authorization string |
鉴权令牌,格式为 Bearer ${AIGATEWAY_TOKEN} |
*Content-Type string |
可选值:application/json application/json |
Body 参数
| 参数名称 | 描述 |
|---|---|
*model string |
可选值:kling-v3-omni 模型名称,固定值 |
*prompt string |
可选值:文本描述,最大 2500 字符 正向文本提示词,描述画面、动作、镜头与风格;可用 image_1 / video_1 引用参考素材,用 << |
seconds integer |
默认值:4 可选值:3 ~ 15(整数);使用视频参考时仅支持 3 ~ 10 视频时长(秒) |
eca_aspect_ratio string |
默认值:16:9 可选值:16:9 / 9:16 / 1:1 视频长宽比;无首帧图时必填,仅视频编辑(refer_type 为 base)时可省略 |
eca_mode string |
默认值:pro 可选值:std(标准模式,720P) / pro(专业模式,1080P) 视频生成模式,影响分辨率档位与计费 |
eca_audio boolean |
默认值:false 可选值:true / false 是否生成声音;有参考视频时只能为 false |
eca_multi_shot boolean |
默认值:false 可选值:true / false 是否生成多镜头视频;为 true 时 prompt 无效且不支持设定首尾帧 |
shot_type string |
可选值:customize / intelligence 分镜方式,视 eca_multi_prompt 自动取值 |
eca_multi_prompt array |
可选值:数组,最少 1 个、最多 6 个 多镜头提示词列表,eca_multi_shot 为 true 时不能为空 |
eca_multi_prompt[].index integer |
可选值:从 1 开始 镜头序号 |
eca_multi_prompt[].prompt string |
可选值:≤512 字符 分镜提示词 |
eca_multi_prompt[].duration string |
可选值:≥1,各分镜之和等于 seconds 分镜时长(秒),字符串类型 |
eca_first_frame string |
可选值:URL 或 Base64(JPG/JPEG/PNG,≤10MB) 图生视频首帧图片,传入后进入图生视频模式 |
eca_last_frame string |
可选值:格式同首帧 图生视频尾帧图片,控制结尾画面;须与首帧成对提供 |
eca_element_list array |
可选值:数组,使用首帧或首尾帧时最多 3 个 参考主体列表 |
eca_element_list[].element_id integer |
可选值:主体库中的主体 ID 参考主体在主体库中的主体 ID |
eca_voice_list array |
可选值:数组,至多 2 个 音色列表,用于 prompt 中 << |
eca_voice_list[].voice_id string |
可选值:音色 ID 音色 ID,序号对应 prompt 中的 << |
eca_callback_url string |
可选值:可访问的 HTTP(S) 地址 任务状态变更时回调的 Webhook URL |
eca_image_reference array |
可选值:数组,元素形如 {"image": "图片URL或Base64"} 参考图片列表,也可作为首帧或尾帧生成视频 |
eca_video_reference array |
可选值:数组,元素形如 {"video": "视频URL", "refer_type": "feature"/"base", "keep_original_sound": "yes"/"no"} 参考视频列表,通过 URL 方式获取 |
eca_video_reference[].video string |
可选值:视频 URL 参考视频 URL |
eca_video_reference[].refer_type string |
可选值:feature / base 参考类型,必填;base 为视频编辑,输出时长与传入视频一致 |
eca_video_reference[].keep_original_sound string |
可选值:yes / no 是否保留原声 |
请求示例
curl -X POST 'https://www.sagelib.com/videos' \
-H "Authorization: Bearer ***" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-v3-omni",
"prompt": "A calico cat playing a piano on stage",
"eca_aspect_ratio": "16:9",
"seconds": 5
}'
import json
import requests
# Configure base variables
base_url = "https://www.sagelib.com" # 把 base_url 换成你的网关地址 https://www.sagelib.com
api_key = "***" # Replace with your Bearer token
url = f"https://www.sagelib.com/videos"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
}
data = {
"model": "kling-v3-omni",
"prompt": "A calico cat playing a piano on stage",
"eca_aspect_ratio": "16:9",
"seconds": 5
}
# Send the POST request
response = requests.post(url, headers=headers, json=data)
# Print the status code and the returned JSON data
print(f"Status Code: {response.status_code}")
try:
print(json.dumps(response.json(), indent=2, ensure_ascii=False))
except Exception:
print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LlmVideoClient {
public static void main(String[] args) {
String baseUrl = "https://www.sagelib.com";
String apiKey = "***";
String url = "https://www.sagelib.com/videos";
String jsonRequestBody = """
{
"model": "kling-v3-omni",
"prompt": "A calico cat playing a piano on stage",
"eca_aspect_ratio": "16:9",
"seconds": 5
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonRequestBody))
.build();
try {
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Status Code: " + response.statusCode());
System.out.println(response.body());
} catch (Exception e) {
e.printStackTrace();
}
}
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
baseUrl := "https://www.sagelib.com"
apiKey := "***"
url := "https://www.sagelib.com/videos"
jsonRequestBody := `
{
"model": "kling-v3-omni",
"prompt": "A calico cat playing a piano on stage",
"eca_aspect_ratio": "16:9",
"seconds": 5
}`
req, err := http.NewRequest("POST", url, bytes.NewBufferString(jsonRequestBody))
if err != nil {
fmt.Println("Failed to create request:", err)
return
}
req.Header.Set("Authorization", "Bearer "+apiKey)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Request failed:", err)
return
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
// Pretty-print the returned JSON data
var prettyBody map[string]interface{}
if err := json.Unmarshal(body, &prettyBody); err == nil {
pretty, _ := json.MarshalIndent(prettyBody, "", " ")
fmt.Println("Status Code:", resp.StatusCode)
fmt.Println(string(pretty))
} else {
fmt.Println("Status Code:", resp.StatusCode)
fmt.Println(string(body))
}
}
curl -X POST 'https://www.sagelib.com/videos' \
-H "Authorization: Bearer ***" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-v3-omni",
"prompt": "A short film with multiple scenes",
"eca_multi_prompt": [
{
"index": 1,
"prompt": "Two friends talking under a streetlight at night. Warm glow, casual poses, no dialogue.",
"duration": "2"
},
{
"index": 2,
"prompt": "A runner sprinting through a forest, leaves flying. Low-angle shot, focus on movement.",
"duration": "3"
},
{
"index": 3,
"prompt": "A woman hugging a cat, smiling. Soft sunlight, cozy home setting, emphasize warmth.",
"duration": "3"
},
{
"index": 4,
"prompt": "A door creaking open, shadowy hallway. Dark tones, minimal details, eerie mood.",
"duration": "3"
},
{
"index": 5,
"prompt": "A man slipping on a banana peel, shocked expression. Exaggerated pose, bright colors.",
"duration": "3"
},
{
"index": 6,
"prompt": "A sunset over mountains, small figure walking away. Wide angle, peaceful atmosphere.",
"duration": "1"
}
],
"eca_multi_shot": true,
"seconds": 15,
"eca_mode": "pro",
"eca_audio": true,
"eca_aspect_ratio": "9:16"
}'
import json
import requests
# Configure base variables
base_url = "https://www.sagelib.com" # 把 base_url 换成你的网关地址 https://www.sagelib.com
api_key = "***" # Replace with your Bearer token
url = f"https://www.sagelib.com/videos"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
}
data = {
"model": "kling-v3-omni",
"prompt": "A short film with multiple scenes",
"eca_multi_prompt": [{
"index": 1,
"prompt": "Two friends talking under a streetlight at night. Warm glow, casual poses, no dialogue.",
"duration": "2"
}, {
"index": 2,
"prompt": "A runner sprinting through a forest, leaves flying. Low-angle shot, focus on movement.",
"duration": "3"
}, {
"index": 3,
"prompt": "A woman hugging a cat, smiling. Soft sunlight, cozy home setting, emphasize warmth.",
"duration": "3"
}, {
"index": 4,
"prompt": "A door creaking open, shadowy hallway. Dark tones, minimal details, eerie mood.",
"duration": "3"
}, {
"index": 5,
"prompt": "A man slipping on a banana peel, shocked expression. Exaggerated pose, bright colors.",
"duration": "3"
}, {
"index": 6,
"prompt": "A sunset over mountains, small figure walking away. Wide angle, peaceful atmosphere.",
"duration": "1"
}],
"eca_multi_shot": True,
"seconds": 15,
"eca_mode": "pro",
"eca_audio": True,
"eca_aspect_ratio": "9:16"
}
# Send the POST request
response = requests.post(url, headers=headers, json=data)
# Print the status code and the returned JSON data
print(f"Status Code: {response.status_code}")
try:
print(json.dumps(response.json(), indent=2, ensure_ascii=False))
except Exception:
print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LlmVideoClient {
public static void main(String[] args) {
String baseUrl = "https://www.sagelib.com";
String apiKey = "***";
String url = "https://www.sagelib.com/videos";
String jsonRequestBody = """
{
"model": "kling-v3-omni",
"prompt": "A short film with multiple scenes",
"eca_multi_prompt": [
{
"index": 1,
"prompt": "Two friends talking under a streetlight at night. Warm glow, casual poses, no dialogue.",
"duration": "2"
},
{
"index": 2,
"prompt": "A runner sprinting through a forest, leaves flying. Low-angle shot, focus on movement.",
"duration": "3"
},
{
"index": 3,
"prompt": "A woman hugging a cat, smiling. Soft sunlight, cozy home setting, emphasize warmth.",
"duration": "3"
},
{
"index": 4,
"prompt": "A door creaking open, shadowy hallway. Dark tones, minimal details, eerie mood.",
"duration": "3"
},
{
"index": 5,
"prompt": "A man slipping on a banana peel, shocked expression. Exaggerated pose, bright colors.",
"duration": "3"
},
{
"index": 6,
"prompt": "A sunset over mountains, small figure walking away. Wide angle, peaceful atmosphere.",
"duration": "1"
}
],
"eca_multi_shot": true,
"seconds": 15,
"eca_mode": "pro",
"eca_audio": true,
"eca_aspect_ratio": "9:16"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonRequestBody))
.build();
try {
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Status Code: " + response.statusCode());
System.out.println(response.body());
} catch (Exception e) {
e.printStackTrace();
}
}
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
baseUrl := "https://www.sagelib.com"
apiKey := "***"
url := "https://www.sagelib.com/videos"
jsonRequestBody := `
{
"model": "kling-v3-omni",
"prompt": "A short film with multiple scenes",
"eca_multi_prompt": [
{
"index": 1,
"prompt": "Two friends talking under a streetlight at night. Warm glow, casual poses, no dialogue.",
"duration": "2"
},
{
"index": 2,
"prompt": "A runner sprinting through a forest, leaves flying. Low-angle shot, focus on movement.",
"duration": "3"
},
{
"index": 3,
"prompt": "A woman hugging a cat, smiling. Soft sunlight, cozy home setting, emphasize warmth.",
"duration": "3"
},
{
"index": 4,
"prompt": "A door creaking open, shadowy hallway. Dark tones, minimal details, eerie mood.",
"duration": "3"
},
{
"index": 5,
"prompt": "A man slipping on a banana peel, shocked expression. Exaggerated pose, bright colors.",
"duration": "3"
},
{
"index": 6,
"prompt": "A sunset over mountains, small figure walking away. Wide angle, peaceful atmosphere.",
"duration": "1"
}
],
"eca_multi_shot": true,
"seconds": 15,
"eca_mode": "pro",
"eca_audio": true,
"eca_aspect_ratio": "9:16"
}`
req, err := http.NewRequest("POST", url, bytes.NewBufferString(jsonRequestBody))
if err != nil {
fmt.Println("Failed to create request:", err)
return
}
req.Header.Set("Authorization", "Bearer "+apiKey)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Request failed:", err)
return
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
// Pretty-print the returned JSON data
var prettyBody map[string]interface{}
if err := json.Unmarshal(body, &prettyBody); err == nil {
pretty, _ := json.MarshalIndent(prettyBody, "", " ")
fmt.Println("Status Code:", resp.StatusCode)
fmt.Println(string(pretty))
} else {
fmt.Println("Status Code:", resp.StatusCode)
fmt.Println(string(body))
}
}
curl -X POST 'https://www.sagelib.com/videos' \
-H "Authorization: Bearer ***" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-v3-omni",
"prompt": "A fire phoenix soars into the sky and says to the man in the car via <<<voice_1>>>, \"Guess who I am.\" The man replies with <<<voice_2>>>, \"Oh my god! You are so cool.\" Then the phoenix transforms into an astronaut and waves at him.",
"eca_first_frame": "${image_url}",
"eca_last_frame": "${image_url}",
"eca_voice_list": [
{
"voice_id": "829826751244537879"
},
{
"voice_id": "829826834144964676"
}
],
"eca_audio": true,
"seconds": 9,
"eca_mode": "pro"
}'
import json
import requests
# Configure base variables
base_url = "https://www.sagelib.com" # 把 base_url 换成你的网关地址 https://www.sagelib.com
api_key = "***" # Replace with your Bearer token
url = f"https://www.sagelib.com/videos"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
}
data = {
"model": "kling-v3-omni",
"prompt": "A fire phoenix soars into the sky and says to the man in the car via <<<voice_1>>>, \"Guess who I am.\" The man replies with <<<voice_2>>>, \"Oh my god! You are so cool.\" Then the phoenix transforms into an astronaut and waves at him.",
"eca_first_frame": "${image_url}",
"eca_last_frame": "${image_url}",
"eca_voice_list": [{
"voice_id": "829826751244537879"
}, {
"voice_id": "829826834144964676"
}],
"eca_audio": True,
"seconds": 9,
"eca_mode": "pro"
}
# Send the POST request
response = requests.post(url, headers=headers, json=data)
# Print the status code and the returned JSON data
print(f"Status Code: {response.status_code}")
try:
print(json.dumps(response.json(), indent=2, ensure_ascii=False))
except Exception:
print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LlmVideoClient {
public static void main(String[] args) {
String baseUrl = "https://www.sagelib.com";
String apiKey = "***";
String url = "https://www.sagelib.com/videos";
String jsonRequestBody = """
{
"model": "kling-v3-omni",
"prompt": "A fire phoenix soars into the sky and says to the man in the car via <<<voice_1>>>, \"Guess who I am.\" The man replies with <<<voice_2>>>, \"Oh my god! You are so cool.\" Then the phoenix transforms into an astronaut and waves at him.",
"eca_first_frame": "${image_url}",
"eca_last_frame": "${image_url}",
"eca_voice_list": [
{
"voice_id": "829826751244537879"
},
{
"voice_id": "829826834144964676"
}
],
"eca_audio": true,
"seconds": 9,
"eca_mode": "pro"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonRequestBody))
.build();
try {
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Status Code: " + response.statusCode());
System.out.println(response.body());
} catch (Exception e) {
e.printStackTrace();
}
}
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
baseUrl := "https://www.sagelib.com"
apiKey := "***"
url := "https://www.sagelib.com/videos"
jsonRequestBody := `
{
"model": "kling-v3-omni",
"prompt": "A fire phoenix soars into the sky and says to the man in the car via <<<voice_1>>>, \"Guess who I am.\" The man replies with <<<voice_2>>>, \"Oh my god! You are so cool.\" Then the phoenix transforms into an astronaut and waves at him.",
"eca_first_frame": "${image_url}",
"eca_last_frame": "${image_url}",
"eca_voice_list": [
{
"voice_id": "829826751244537879"
},
{
"voice_id": "829826834144964676"
}
],
"eca_audio": true,
"seconds": 9,
"eca_mode": "pro"
}`
req, err := http.NewRequest("POST", url, bytes.NewBufferString(jsonRequestBody))
if err != nil {
fmt.Println("Failed to create request:", err)
return
}
req.Header.Set("Authorization", "Bearer "+apiKey)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Request failed:", err)
return
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
// Pretty-print the returned JSON data
var prettyBody map[string]interface{}
if err := json.Unmarshal(body, &prettyBody); err == nil {
pretty, _ := json.MarshalIndent(prettyBody, "", " ")
fmt.Println("Status Code:", resp.StatusCode)
fmt.Println(string(pretty))
} else {
fmt.Println("Status Code:", resp.StatusCode)
fmt.Println(string(body))
}
}
curl -v 'https://www.sagelib.com/videos/${video_id}' \
-H "Authorization: Bearer ***"
import json
import requests
# Configure base variables
base_url = "https://www.sagelib.com" # 把 base_url 换成你的网关地址 https://www.sagelib.com
api_key = "***" # Replace with your Bearer token
video_id = "${video_id}" # The video task ID returned when creating the task
url = f"https://www.sagelib.com/videos/{video_id}"
headers = {
"Authorization": f"Bearer {api_key}",
}
# Send the GET request to query the task status
response = requests.get(url, headers=headers)
# Print the status code and the returned JSON data
print(f"Status Code: {response.status_code}")
try:
print(json.dumps(response.json(), indent=2, ensure_ascii=False))
except Exception:
print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LlmVideoQuery {
public static void main(String[] args) {
String baseUrl = "https://www.sagelib.com";
String apiKey = "***";
String videoId = "${video_id}"; // The video task ID returned when creating the task
String url = "https://www.sagelib.com/videos/" + videoId;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer " + apiKey)
.GET()
.build();
try {
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Status Code: " + response.statusCode());
System.out.println(response.body());
} catch (Exception e) {
e.printStackTrace();
}
}
}
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
baseUrl := "https://www.sagelib.com"
apiKey := "***"
videoId := "${video_id}" // The video task ID returned when creating the task
url := "https://www.sagelib.com/videos/" + videoId
req, err := http.NewRequest("GET", url, nil)
if err != nil {
fmt.Println("Failed to create request:", err)
return
}
req.Header.Set("Authorization", "Bearer "+apiKey)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Request failed:", err)
return
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
// Pretty-print the returned JSON data
var prettyBody map[string]interface{}
if err := json.Unmarshal(body, &prettyBody); err == nil {
pretty, _ := json.MarshalIndent(prettyBody, "", " ")
fmt.Println("Status Code:", resp.StatusCode)
fmt.Println(string(pretty))
} else {
fmt.Println("Status Code:", resp.StatusCode)
fmt.Println(string(body))
}
}
curl -v 'https://www.sagelib.com/videos/${video_id}/content' \
-H "Authorization: Bearer ***" \
-o output.mp4
import requests
# Configure base variables
base_url = "https://www.sagelib.com" # 把 base_url 换成你的网关地址 https://www.sagelib.com
api_key = "***" # Replace with your Bearer token
video_id = "${video_id}" # The video task ID returned when creating the task
url = f"https://www.sagelib.com/videos/{video_id}/content"
headers = {
"Authorization": f"Bearer {api_key}",
}
# Send the GET request and stream the video content to a local file
response = requests.get(url, headers=headers, stream=True)
response.raise_for_status()
with open("output.mp4", "wb") as f:
for chunk in response.iter_content(chunk_size=8192):
f.write(chunk)
print(f"Status Code: {response.status_code}")
print("Video saved to output.mp4")
import java.io.InputStream;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
public class LlmVideoDownload {
public static void main(String[] args) {
String baseUrl = "https://www.sagelib.com";
String apiKey = "***";
String videoId = "${video_id}"; // The video task ID returned when creating the task
String url = "https://www.sagelib.com/videos/" + videoId + "/content";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer " + apiKey)
.GET()
.build();
try {
HttpResponse<InputStream> response = client.send(request, HttpResponse.BodyHandlers.ofInputStream());
System.out.println("Status Code: " + response.statusCode());
try (InputStream in = response.body()) {
Files.copy(in, Path.of("output.mp4"), StandardCopyOption.REPLACE_EXISTING);
System.out.println("Video saved to output.mp4");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
baseUrl := "https://www.sagelib.com"
apiKey := "***"
videoId := "${video_id}" // The video task ID returned when creating the task
url := "https://www.sagelib.com/videos/" + videoId + "/content"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
fmt.Println("Failed to create request:", err)
return
}
req.Header.Set("Authorization", "Bearer "+apiKey)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Request failed:", err)
return
}
defer resp.Body.Close()
fmt.Println("Status Code:", resp.StatusCode)
out, err := os.Create("output.mp4")
if err != nil {
fmt.Println("Failed to create output file:", err)
return
}
defer out.Close()
_, err = io.Copy(out, resp.Body)
if err != nil {
fmt.Println("Failed to save video:", err)
return
}
fmt.Println("Video saved to output.mp4")
}
响应参数
Body 参数
| 参数名称 | 描述 |
|---|---|
id string |
视频任务 ID |
object string |
可选值:video 固定为 video |
model string |
实际使用的模型名称 |
created_at integer |
任务创建时间戳 |
status string |
可选值:created、in_progress、completed、failed 任务状态:created / in_progress / completed / failed |
seconds string |
请求时长与实际成片时长,字符串形式(如 "5.041") |
eca_credits number |
本次计费点数(任务完成后回带) |
eca_origin_credits number |
原始计费点数(任务完成后回带) |
error object |
仅 failed 时出现,含 message 与 code |
message string |
失败原因 |
code string |
错误码 |
响应示例
{
"id": "${video_id}",
"object": "video",
"model": "kling-v3-omni",
"created_at": 1782358541,
"status": "created",
"seconds": "5.00"
}
{
"id": "${video_id}",
"object": "video",
"model": "kling-v3-omni",
"created_at": 1782358541,
"status": "in_progress",
"seconds": "5.00"
}