统一视频生成接口
curl --request POST \
--url https://www.token-nova.com/v1/video/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"image": "<string>",
"images": [
"<string>"
],
"input_reference": [
"<string>"
],
"duration": 123,
"seconds": "<string>",
"size": "<string>",
"metadata": {}
}
'import requests
url = "https://www.token-nova.com/v1/video/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"image": "<string>",
"images": ["<string>"],
"input_reference": ["<string>"],
"duration": 123,
"seconds": "<string>",
"size": "<string>",
"metadata": {}
}
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: '<string>',
prompt: '<string>',
image: '<string>',
images: ['<string>'],
input_reference: ['<string>'],
duration: 123,
seconds: '<string>',
size: '<string>',
metadata: {}
})
};
fetch('https://www.token-nova.com/v1/video/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://www.token-nova.com/v1/video/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' => '<string>',
'prompt' => '<string>',
'image' => '<string>',
'images' => [
'<string>'
],
'input_reference' => [
'<string>'
],
'duration' => 123,
'seconds' => '<string>',
'size' => '<string>',
'metadata' => [
]
]),
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"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"input_reference\": [\n \"<string>\"\n ],\n \"duration\": 123,\n \"seconds\": \"<string>\",\n \"size\": \"<string>\",\n \"metadata\": {}\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://www.token-nova.com/v1/video/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"input_reference\": [\n \"<string>\"\n ],\n \"duration\": 123,\n \"seconds\": \"<string>\",\n \"size\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.token-nova.com/v1/video/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\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"input_reference\": [\n \"<string>\"\n ],\n \"duration\": 123,\n \"seconds\": \"<string>\",\n \"size\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "video_task_abc123",
"task_id": "video_task_abc123",
"object": "video",
"model": "kling-v1",
"status": "queued",
"progress": 0,
"created_at": 1735689600
}
{
"error": {
"message": "prompt is required",
"type": "new_api_error",
"param": "",
"code": "invalid_request"
}
}
{
"error": {
"message": "无效的令牌",
"type": "new_api_error",
"param": "",
"code": "invalid_api_key"
}
}
{
"error": {
"message": "用户额度不足",
"type": "new_api_error",
"param": "",
"code": "insufficient_user_quota"
}
}
{
"code": "too_many_requests",
"message": "当前分组上游负载已饱和,请稍后再试",
"data": null
}
{
"error": {
"message": "copy_response_body_failed",
"type": "new_api_error",
"param": "",
"code": "bad_response"
}
}
统一视频生成接口
使用平台统一视频任务格式提交异步生成任务,适配多家视频模型和供应商。
POST
https://www.token-nova.com
/
v1
/
video
/
generations
统一视频生成接口
curl --request POST \
--url https://www.token-nova.com/v1/video/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"image": "<string>",
"images": [
"<string>"
],
"input_reference": [
"<string>"
],
"duration": 123,
"seconds": "<string>",
"size": "<string>",
"metadata": {}
}
'import requests
url = "https://www.token-nova.com/v1/video/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"image": "<string>",
"images": ["<string>"],
"input_reference": ["<string>"],
"duration": 123,
"seconds": "<string>",
"size": "<string>",
"metadata": {}
}
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: '<string>',
prompt: '<string>',
image: '<string>',
images: ['<string>'],
input_reference: ['<string>'],
duration: 123,
seconds: '<string>',
size: '<string>',
metadata: {}
})
};
fetch('https://www.token-nova.com/v1/video/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://www.token-nova.com/v1/video/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' => '<string>',
'prompt' => '<string>',
'image' => '<string>',
'images' => [
'<string>'
],
'input_reference' => [
'<string>'
],
'duration' => 123,
'seconds' => '<string>',
'size' => '<string>',
'metadata' => [
]
]),
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"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"input_reference\": [\n \"<string>\"\n ],\n \"duration\": 123,\n \"seconds\": \"<string>\",\n \"size\": \"<string>\",\n \"metadata\": {}\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://www.token-nova.com/v1/video/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"input_reference\": [\n \"<string>\"\n ],\n \"duration\": 123,\n \"seconds\": \"<string>\",\n \"size\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.token-nova.com/v1/video/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\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"input_reference\": [\n \"<string>\"\n ],\n \"duration\": 123,\n \"seconds\": \"<string>\",\n \"size\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "video_task_abc123",
"task_id": "video_task_abc123",
"object": "video",
"model": "kling-v1",
"status": "queued",
"progress": 0,
"created_at": 1735689600
}
{
"error": {
"message": "prompt is required",
"type": "new_api_error",
"param": "",
"code": "invalid_request"
}
}
{
"error": {
"message": "无效的令牌",
"type": "new_api_error",
"param": "",
"code": "invalid_api_key"
}
}
{
"error": {
"message": "用户额度不足",
"type": "new_api_error",
"param": "",
"code": "insufficient_user_quota"
}
}
{
"code": "too_many_requests",
"message": "当前分组上游负载已饱和,请稍后再试",
"data": null
}
{
"error": {
"message": "copy_response_body_failed",
"type": "new_api_error",
"param": "",
"code": "bad_response"
}
}
统一视频生成接口
这是面向多供应商的视频任务入口。请求先进入统一任务协议,再由分发层选择实际渠道执行。- 一个入口同时支持文生视频和图生视频。
- 异步处理模式,提交成功后返回公开视频任务 ID。
- 支持通过
metadata透传供应商专有参数。 - 可与
/v1/video/generations/{task_id}和/v1/videos/{task_id}组成完整任务链路。
方法与路径
POST /v1/video/generations
请求示例
curl -X POST https://www.token-nova.com/v1/video/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-v1",
"prompt": "一只金毛犬在海滩上奔跑,镜头平滑跟随",
"duration": 5,
"size": "1280x720",
"metadata": {
"style": "cinematic"
}
}'
import requests
resp = requests.post(
"https://www.token-nova.com/v1/video/generations",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "kling-v1",
"prompt": "一只金毛犬在海滩上奔跑,镜头平滑跟随",
"duration": 5,
"size": "1280x720",
"metadata": {"style": "cinematic"},
},
timeout=60,
)
print(resp.json())
const response = await fetch("https://www.token-nova.com/v1/video/generations", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "kling-v1",
prompt: "一只金毛犬在海滩上奔跑,镜头平滑跟随",
duration: 5,
size: "1280x720",
metadata: { style: "cinematic" },
}),
});
console.log(await response.json());
响应示例
{
"id": "video_task_abc123",
"task_id": "video_task_abc123",
"object": "video",
"model": "kling-v1",
"status": "queued",
"progress": 0,
"created_at": 1735689600
}
{
"error": {
"message": "prompt is required",
"type": "new_api_error",
"param": "",
"code": "invalid_request"
}
}
{
"error": {
"message": "无效的令牌",
"type": "new_api_error",
"param": "",
"code": "invalid_api_key"
}
}
{
"error": {
"message": "用户额度不足",
"type": "new_api_error",
"param": "",
"code": "insufficient_user_quota"
}
}
{
"code": "too_many_requests",
"message": "当前分组上游负载已饱和,请稍后再试",
"data": null
}
{
"error": {
"message": "copy_response_body_failed",
"type": "new_api_error",
"param": "",
"code": "bad_response"
}
}
认证
Authorization: Bearer YOUR_API_KEY
Body
计费和分发使用的模型名,例如
kling-v1、sora-2、veo-3。最终是否可用取决于当前 Token 所属分组和渠道配置。文本提示词。纯文生视频时通常必填;如果只做基于图片的轻改动,仍建议提供明确描述。
图生视频输入图片 URL 或 Base64。与
images、input_reference 一起表示存在视觉参考输入。多图参考输入。常用于兼容需要多参考图的上游。
额外参考素材。部分上游会把它当作首帧、参考图或素材集合。
目标时长,单位为秒。部分渠道也接受
seconds,若两者同时提供,具体优先级由适配器决定。OpenAI 视频兼容风格的时长字段。常见值如
5、10、15。尺寸或比例提示,例如
1280x720、720x1280、16:9。是否识别由具体渠道决定。供应商专有扩展参数,例如
style、negative_prompt、camera_control、aspectRatio、quality。Response
平台公开任务 ID。后续可直接用于查询和代理下载。
兼容旧接口保留的任务 ID 字段,通常与
id 相同。固定为
video。提交后的初始状态,常见值为
queued 或 in_progress。任务进度百分比。刚提交时通常为
0。使用场景
文生视频
curl -X POST https://www.token-nova.com/v1/video/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "veo-3",
"prompt": "一辆红色跑车在雨夜城市中穿行",
"seconds": "5"
}'
图生视频
curl -X POST https://www.token-nova.com/v1/video/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-v1",
"prompt": "让人物微笑并挥手",
"image": "https://.../portrait.png",
"duration": 5
}'
注意事项
这个路由是统一任务入口,不保证所有渠道都接受同一组参数。未在适配器中识别的字段可能被忽略,也可能只对某些模型生效。
相关接口
⌘I
