获取 Kling 文生视频任务状态
查询 Kling 文生视频任务的状态和结果。
GET
/kling/v1/videos/text2video/{task_id}获取 Kling 文生视频任务状态
查询 Kling 文生视频任务的状态和结果。
鉴权: 使用 Bearer Token 认证。 格式: `Authorization: Bearer sk-xxxxxx`
请求参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
task_id | string | 是 | 任务 ID 位置: path |
示例代码
curl -X GET "https://api.nodeprice.com/kling/v1/videos/text2video/string" \
-H "Authorization: Bearer <token>"const url = "https://api.nodeprice.com/kling/v1/videos/text2video/string";
const response = await fetch(url, {
method: "GET",
headers: {
"Authorization": "Bearer <token>"
}
});
console.log(await response.text());package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.nodeprice.com/kling/v1/videos/text2video/string"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer <token>")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
data, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(data))
}import requests
url = "https://api.nodeprice.com/kling/v1/videos/text2video/string"
response = requests.request("GET", url, headers={
"Authorization": "Bearer <token>"
})
print(response.text)OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.nodeprice.com/kling/v1/videos/text2video/string")
.method("GET", null)
.addHeader("Authorization", "Bearer <token>")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (curl == NULL) {
return 1;
}
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.nodeprice.com/kling/v1/videos/text2video/string");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode code = curl_easy_perform(curl);
if (code != CURLE_OK) {
fprintf(stderr, "%s\n", curl_easy_strerror(code));
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return 0;
}using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://api.nodeprice.com/kling/v1/videos/text2video/string");
request.Headers.Add("Authorization", "Bearer <token>");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}响应
200 成功获取任务状态
Content-Type: application/json
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
task_id | string | 任务 ID 示例: "abcd1234efgh" | |
status | string | 任务状态 可选值: queued, in_progress, completed, failed;示例: "completed" | |
url | string | 视频资源 URL(成功时) 示例: "https://example.com/video.mp4" | |
format | string | 视频格式 示例: "mp4" | |
metadata | object | 视频任务元数据 | |
duration | number | 实际生成的视频时长 示例: 5 | |
fps | integer | 实际帧率 示例: 30 | |
width | integer | 实际宽度 示例: 1280 | |
height | integer | 实际高度 示例: 720 | |
seed | integer | 使用的随机种子 示例: 20231234 | |
error | object | 视频任务错误信息 | |
code | integer | 错误码 | |
message | string | 错误信息 |
404 任务不存在
Content-Type: application/json
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
error | object | ||
message | string | 错误信息 | |
type | string | 错误类型 | |
param | string | null | 相关参数 | |
code | string | null | 错误代码 |