获取任务状态
curl --request GET \
--url https://www.token-nova.com/v1/video/generations/{task_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"task_id": "<string>"
}
'import requests
url = "https://www.token-nova.com/v1/video/generations/{task_id}"
payload = { "task_id": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({task_id: '<string>'})
};
fetch('https://www.token-nova.com/v1/video/generations/{task_id}', 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://www.token-nova.com/v1/video/generations/{task_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'task_id' => '<string>'
]),
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://www.token-nova.com/v1/video/generations/{task_id}"
payload := strings.NewReader("{\n \"task_id\": \"<string>\"\n}")
req, _ := http.NewRequest("GET", 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.get("https://www.token-nova.com/v1/video/generations/{task_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"task_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.token-nova.com/v1/video/generations/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"task_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": "success",
"message": "",
"data": {
"task_id": "task-video-abc123",
"status": "queued",
"url": "",
"format": "mp4",
"metadata": null,
"error": null
}
}
{
"code": "success",
"message": "",
"data": {
"task_id": "task-video-abc123",
"status": "succeeded",
"url": "https://...",
"format": "mp4",
"metadata": {
"duration": 5,
"width": 1280,
"height": 720,
"fps": 24
},
"error": null
}
}
{
"code": "success",
"message": "",
"data": {
"task_id": "task-video-abc123",
"status": "failed",
"url": "",
"format": "mp4",
"metadata": null,
"error": {
"code": "content_policy",
"message": "Content policy violation"
}
}
}
{
"code": "task_not_exist",
"message": "task_not_exist",
"data": null
}
{
"code": "invalid_api_key",
"message": "无效的令牌",
"data": null
}
获取任务状态
查询统一视频任务接口的执行进度与结果,并了解对应的 OpenAI 视频兼容查询路径。
GET
https://www.token-nova.com
/
v1
/
video
/
generations
/
{task_id}
获取任务状态
curl --request GET \
--url https://www.token-nova.com/v1/video/generations/{task_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"task_id": "<string>"
}
'import requests
url = "https://www.token-nova.com/v1/video/generations/{task_id}"
payload = { "task_id": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({task_id: '<string>'})
};
fetch('https://www.token-nova.com/v1/video/generations/{task_id}', 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://www.token-nova.com/v1/video/generations/{task_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'task_id' => '<string>'
]),
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://www.token-nova.com/v1/video/generations/{task_id}"
payload := strings.NewReader("{\n \"task_id\": \"<string>\"\n}")
req, _ := http.NewRequest("GET", 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.get("https://www.token-nova.com/v1/video/generations/{task_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"task_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.token-nova.com/v1/video/generations/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"task_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": "success",
"message": "",
"data": {
"task_id": "task-video-abc123",
"status": "queued",
"url": "",
"format": "mp4",
"metadata": null,
"error": null
}
}
{
"code": "success",
"message": "",
"data": {
"task_id": "task-video-abc123",
"status": "succeeded",
"url": "https://...",
"format": "mp4",
"metadata": {
"duration": 5,
"width": 1280,
"height": 720,
"fps": 24
},
"error": null
}
}
{
"code": "success",
"message": "",
"data": {
"task_id": "task-video-abc123",
"status": "failed",
"url": "",
"format": "mp4",
"metadata": null,
"error": {
"code": "content_policy",
"message": "Content policy violation"
}
}
}
{
"code": "task_not_exist",
"message": "task_not_exist",
"data": null
}
{
"code": "invalid_api_key",
"message": "无效的令牌",
"data": null
}
获取任务状态
这个接口用于查询通过统一视频任务入口提交的异步任务状态。返回结构使用code、message、data 包装。
- 查询的是平台公开
task_id,不是上游真实任务 ID。 - 成功响应固定返回
code = success。 - 适合与
/v1/video/generations搭配使用。 - 同一任务也可能通过
/v1/videos/{task_id}以 OpenAIvideo对象格式查询。
方法与路径
GET /v1/video/generations/{task_id}
请求示例
curl https://www.token-nova.com/v1/video/generations/task-video-abc123 \
-H "Authorization: Bearer YOUR_API_KEY"
import requests
resp = requests.get(
"https://www.token-nova.com/v1/video/generations/task-video-abc123",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=30,
)
print(resp.json())
const response = await fetch(
"https://www.token-nova.com/v1/video/generations/task-video-abc123",
{
headers: { Authorization: "Bearer YOUR_API_KEY" },
}
);
console.log(await response.json());
响应示例
{
"code": "success",
"message": "",
"data": {
"task_id": "task-video-abc123",
"status": "queued",
"url": "",
"format": "mp4",
"metadata": null,
"error": null
}
}
{
"code": "success",
"message": "",
"data": {
"task_id": "task-video-abc123",
"status": "succeeded",
"url": "https://...",
"format": "mp4",
"metadata": {
"duration": 5,
"width": 1280,
"height": 720,
"fps": 24
},
"error": null
}
}
{
"code": "success",
"message": "",
"data": {
"task_id": "task-video-abc123",
"status": "failed",
"url": "",
"format": "mp4",
"metadata": null,
"error": {
"code": "content_policy",
"message": "Content policy violation"
}
}
}
{
"code": "task_not_exist",
"message": "task_not_exist",
"data": null
}
{
"code": "invalid_api_key",
"message": "无效的令牌",
"data": null
}
认证
Authorization: Bearer YOUR_API_KEY
Path Parameters
统一视频任务入口返回的公开任务 ID。
Response
业务状态码。成功时固定为
success。错误或补充信息。成功时通常为空字符串。
任务 ID。
任务状态。常见值为
queued、processing、succeeded、failed。最终视频结果地址。部分渠道会返回平台代理地址。
失败任务的错误详情。
使用场景
轮询直到完成
建议每5 到 10 秒轮询一次,直到 status 变为 succeeded 或 failed。
切换到 OpenAI 查询结构
如果客户端已经按 OpenAIvideo 对象解析结果,可以直接改查:
curl https://www.token-nova.com/v1/videos/task-video-abc123 \
-H "Authorization: Bearer YOUR_API_KEY"
注意事项
/v1/video/generations/{task_id} 和 /v1/videos/{task_id} 查询的是同一类视频任务,但返回结构不同。前者是统一任务包装,后者是 OpenAI 视频对象。相关接口
⌘I
