OpenAI 视频兼容接口
curl --request POST \
--url https://www.token-nova.com/v1/videos \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"task_id": "<string>",
"video_id": "<string>",
"model": "<string>",
"prompt": "<string>",
"image": "<string>",
"seconds": "<string>",
"size": "<string>",
"metadata": {}
}
'import requests
url = "https://www.token-nova.com/v1/videos"
payload = {
"task_id": "<string>",
"video_id": "<string>",
"model": "<string>",
"prompt": "<string>",
"image": "<string>",
"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({
task_id: '<string>',
video_id: '<string>',
model: '<string>',
prompt: '<string>',
image: '<string>',
seconds: '<string>',
size: '<string>',
metadata: {}
})
};
fetch('https://www.token-nova.com/v1/videos', 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/videos",
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([
'task_id' => '<string>',
'video_id' => '<string>',
'model' => '<string>',
'prompt' => '<string>',
'image' => '<string>',
'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/videos"
payload := strings.NewReader("{\n \"task_id\": \"<string>\",\n \"video_id\": \"<string>\",\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image\": \"<string>\",\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/videos")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"task_id\": \"<string>\",\n \"video_id\": \"<string>\",\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image\": \"<string>\",\n \"seconds\": \"<string>\",\n \"size\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.token-nova.com/v1/videos")
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 \"task_id\": \"<string>\",\n \"video_id\": \"<string>\",\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image\": \"<string>\",\n \"seconds\": \"<string>\",\n \"size\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "sora-2",
"status": "queued",
"progress": 0,
"created_at": 1735689600,
"seconds": "5",
"size": "1280x720"
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "sora-2",
"status": "completed",
"progress": 100,
"created_at": 1735689600,
"completed_at": 1735689900,
"video_url": "https://...",
"seconds": "5",
"size": "1280x720"
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "sora-2",
"status": "failed",
"progress": 100,
"created_at": 1735689600,
"error": {
"message": "Content policy violation",
"code": "content_policy"
}
}
{
"error": {
"message": "task_origin_not_exist",
"type": "new_api_error",
"param": "",
"code": "task_not_exist"
}
}
OpenAI 视频兼容接口
使用 OpenAI Videos 风格的创建、查询、remix 和内容代理路由操作视频任务。
POST
https://www.token-nova.com
/
v1
/
videos
OpenAI 视频兼容接口
curl --request POST \
--url https://www.token-nova.com/v1/videos \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"task_id": "<string>",
"video_id": "<string>",
"model": "<string>",
"prompt": "<string>",
"image": "<string>",
"seconds": "<string>",
"size": "<string>",
"metadata": {}
}
'import requests
url = "https://www.token-nova.com/v1/videos"
payload = {
"task_id": "<string>",
"video_id": "<string>",
"model": "<string>",
"prompt": "<string>",
"image": "<string>",
"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({
task_id: '<string>',
video_id: '<string>',
model: '<string>',
prompt: '<string>',
image: '<string>',
seconds: '<string>',
size: '<string>',
metadata: {}
})
};
fetch('https://www.token-nova.com/v1/videos', 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/videos",
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([
'task_id' => '<string>',
'video_id' => '<string>',
'model' => '<string>',
'prompt' => '<string>',
'image' => '<string>',
'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/videos"
payload := strings.NewReader("{\n \"task_id\": \"<string>\",\n \"video_id\": \"<string>\",\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image\": \"<string>\",\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/videos")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"task_id\": \"<string>\",\n \"video_id\": \"<string>\",\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image\": \"<string>\",\n \"seconds\": \"<string>\",\n \"size\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.token-nova.com/v1/videos")
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 \"task_id\": \"<string>\",\n \"video_id\": \"<string>\",\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"image\": \"<string>\",\n \"seconds\": \"<string>\",\n \"size\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "sora-2",
"status": "queued",
"progress": 0,
"created_at": 1735689600,
"seconds": "5",
"size": "1280x720"
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "sora-2",
"status": "completed",
"progress": 100,
"created_at": 1735689600,
"completed_at": 1735689900,
"video_url": "https://...",
"seconds": "5",
"size": "1280x720"
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "sora-2",
"status": "failed",
"progress": 100,
"created_at": 1735689600,
"error": {
"message": "Content policy violation",
"code": "content_policy"
}
}
{
"error": {
"message": "task_origin_not_exist",
"type": "new_api_error",
"param": "",
"code": "task_not_exist"
}
}
OpenAI 视频兼容接口
这组路由对外表现为 OpenAI Videos API 风格,适合已经按video 对象读写结果的客户端。
- 创建、查询和 remix 统一使用 OpenAI 风格
video对象。 - 公开
id会映射到平台任务 ID,而不是直接暴露上游原始任务 ID。 content代理路由支持 API Key 和登录态访问。- Remix 会优先回查原视频任务并锁定到原始渠道执行。
路由清单
| Method | Path | 说明 |
|---|---|---|
POST | /v1/videos | 创建视频任务 |
GET | /v1/videos/{task_id} | 查询视频任务 |
POST | /v1/videos/{video_id}/remix | 基于已有视频任务做 remix |
GET | /v1/videos/{task_id}/content | 代理下载视频内容 |
请求示例
curl -X POST https://www.token-nova.com/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sora-2",
"prompt": "一架纸飞机穿过明亮办公室,镜头平滑跟随",
"seconds": "5",
"size": "1280x720"
}'
import requests
resp = requests.post(
"https://www.token-nova.com/v1/videos",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "sora-2",
"prompt": "一架纸飞机穿过明亮办公室,镜头平滑跟随",
"seconds": "5",
"size": "1280x720",
},
timeout=60,
)
print(resp.json())
const response = await fetch("https://www.token-nova.com/v1/videos", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "sora-2",
prompt: "一架纸飞机穿过明亮办公室,镜头平滑跟随",
seconds: "5",
size: "1280x720",
}),
});
console.log(await response.json());
响应示例
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "sora-2",
"status": "queued",
"progress": 0,
"created_at": 1735689600,
"seconds": "5",
"size": "1280x720"
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "sora-2",
"status": "completed",
"progress": 100,
"created_at": 1735689600,
"completed_at": 1735689900,
"video_url": "https://...",
"seconds": "5",
"size": "1280x720"
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "sora-2",
"status": "failed",
"progress": 100,
"created_at": 1735689600,
"error": {
"message": "Content policy violation",
"code": "content_policy"
}
}
{
"error": {
"message": "task_origin_not_exist",
"type": "new_api_error",
"param": "",
"code": "task_not_exist"
}
}
认证
创建、查询、remix 使用 Bearer Token:Authorization: Bearer YOUR_API_KEY
GET /v1/videos/{task_id}/content 同时支持:
Authorization: Bearer YOUR_API_KEY- Web 仪表盘登录态
UserAuth
Path Parameters
视频任务 ID,用于查询和内容代理。
Remix 的源视频 ID。服务端会先用它回查原任务和原渠道。
Body
视频模型名称,例如
sora-2、sora_video2 或其他渠道映射后的模型名。视频描述或 remix 指令。
图生视频输入图。是否支持取决于具体上游。
目标视频时长,常见值为
5、10、15。目标分辨率或比例,例如
1280x720、720x1280、16:9。供应商透传参数。Remix 时也可以放入上游专有字段。
Response
公开视频任务 ID。
任务状态,常见值为
queued、in_progress、completed、failed。生成完成后的可播放地址。很多情况下会指向平台代理路由。
失败任务的错误详情,仅在
status = failed 时出现。使用场景
查询任务
curl https://www.token-nova.com/v1/videos/video_abc123 \
-H "Authorization: Bearer YOUR_API_KEY"
Remix
curl -X POST https://www.token-nova.com/v1/videos/video_abc123/remix \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sora-2",
"prompt": "保持构图,把画面改成夜晚霓虹灯风格"
}'
代理下载
curl -L https://www.token-nova.com/v1/videos/video_abc123/content \
-H "Authorization: Bearer YOUR_API_KEY" \
--output output.mp4
注意事项
如果你同时接入了
/v1/video/generations 和 /v1/videos,建议前端固定选择一种返回结构使用,不要在同一套解析逻辑里混用通用任务包装和 OpenAI video 对象。相关接口
⌘I
