curl -X POST https://www.token-nova.com/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "omni-fast-v2v",
"prompt": "Edit the attached video into a visibly new version while preserving the original camera path, timing, subject motion, and shot continuity. Add a rainy cinematic night look with neon reflections. Output a newly generated video, not the uploaded source clip or its preview.",
"video": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p"
}'
curl -X POST https://www.token-nova.com/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "omni-fast-v2v",
"prompt": "Extend this clip into a new cinematic shot with the same camera path.",
"video_url": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p"
}'
curl -X POST https://www.token-nova.com/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "omni-fast-v2v",
"prompt": "Regenerate the attached clip with brighter lighting and smoother motion.",
"input_video": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p"
}'
import requests
resp = requests.post(
"https://www.token-nova.com/v1/videos",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "omni-fast-v2v",
"prompt": "Edit the attached video into a visibly new version while preserving the original camera path. Output a newly generated video, not the uploaded source clip.",
"video": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p",
},
timeout=120,
)
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: "omni-fast-v2v",
prompt:
"Edit the attached video into a visibly new version while preserving the original camera path. Output a newly generated video, not the uploaded source clip.",
video: "https://example.com/source.mp4",
seconds: "8",
aspect_ratio: "16:9",
resolution: "720p",
}),
});
console.log(await response.json());
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload := map[string]any{
"model": "omni-fast-v2v",
"prompt": "Edit the attached video into a visibly new version while preserving the original camera path. Output a newly generated video, not the uploaded source clip.",
"video": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p",
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://www.token-nova.com/v1/videos", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
respBody, _ := io.ReadAll(resp.Body)
fmt.Println(string(respBody))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String json = """
{
"model": "omni-fast-v2v",
"prompt": "Edit the attached video into a visibly new version while preserving the original camera path. Output a newly generated video, not the uploaded source clip.",
"video": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://www.token-nova.com/v1/videos"))
.header("Authorization", "Bearer YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
<?php
$payload = [
'model' => 'omni-fast-v2v',
'prompt' => 'Edit the attached video into a visibly new version while preserving the original camera path. Output a newly generated video, not the uploaded source clip.',
'video' => 'https://example.com/source.mp4',
'seconds' => '8',
'aspect_ratio' => '16:9',
'resolution' => '720p',
];
$ch = curl_init('https://www.token-nova.com/v1/videos');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($payload, JSON_UNESCAPED_UNICODE),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "omni-fast-v2v",
"status": "queued",
"progress": 0,
"created_at": 1735689600,
"video_url": ""
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "omni-fast-v2v",
"status": "completed",
"progress": 100,
"created_at": 1735689600,
"completed_at": 1735689900,
"video_url": "https://example.com/results/omni-fast-v2v.mp4"
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "omni-fast-v2v",
"status": "failed",
"progress": 100,
"error": {
"message": "upstream task failed",
"code": "task_failed"
}
}
{
"error": {
"message": "video is required for V2V generation",
"type": "invalid_request_error",
"param": "video",
"code": "invalid_request_error"
}
}
{
"error": {
"message": "invalid token",
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}
{
"error": {
"message": "insufficient quota",
"type": "insufficient_quota",
"code": "insufficient_quota"
}
}
{
"error": {
"message": "request body too large",
"type": "invalid_request_error",
"code": "request_body_too_large"
}
}
{
"error": {
"message": "rate limit exceeded",
"type": "rate_limit_error",
"code": "rate_limit_exceeded"
}
}
{
"error": {
"message": "internal server error",
"type": "server_error",
"code": "server_error"
}
}
Omni 视频
omni-fast-v2v 参考视频生成
使用 POST /v1/videos 调用 omni-fast-v2v 做参考视频编辑、延长或重生成。
POST
https://www.token-nova.com
/
v1
/
videos
curl -X POST https://www.token-nova.com/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "omni-fast-v2v",
"prompt": "Edit the attached video into a visibly new version while preserving the original camera path, timing, subject motion, and shot continuity. Add a rainy cinematic night look with neon reflections. Output a newly generated video, not the uploaded source clip or its preview.",
"video": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p"
}'
curl -X POST https://www.token-nova.com/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "omni-fast-v2v",
"prompt": "Extend this clip into a new cinematic shot with the same camera path.",
"video_url": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p"
}'
curl -X POST https://www.token-nova.com/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "omni-fast-v2v",
"prompt": "Regenerate the attached clip with brighter lighting and smoother motion.",
"input_video": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p"
}'
import requests
resp = requests.post(
"https://www.token-nova.com/v1/videos",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "omni-fast-v2v",
"prompt": "Edit the attached video into a visibly new version while preserving the original camera path. Output a newly generated video, not the uploaded source clip.",
"video": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p",
},
timeout=120,
)
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: "omni-fast-v2v",
prompt:
"Edit the attached video into a visibly new version while preserving the original camera path. Output a newly generated video, not the uploaded source clip.",
video: "https://example.com/source.mp4",
seconds: "8",
aspect_ratio: "16:9",
resolution: "720p",
}),
});
console.log(await response.json());
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload := map[string]any{
"model": "omni-fast-v2v",
"prompt": "Edit the attached video into a visibly new version while preserving the original camera path. Output a newly generated video, not the uploaded source clip.",
"video": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p",
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://www.token-nova.com/v1/videos", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
respBody, _ := io.ReadAll(resp.Body)
fmt.Println(string(respBody))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String json = """
{
"model": "omni-fast-v2v",
"prompt": "Edit the attached video into a visibly new version while preserving the original camera path. Output a newly generated video, not the uploaded source clip.",
"video": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://www.token-nova.com/v1/videos"))
.header("Authorization", "Bearer YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
<?php
$payload = [
'model' => 'omni-fast-v2v',
'prompt' => 'Edit the attached video into a visibly new version while preserving the original camera path. Output a newly generated video, not the uploaded source clip.',
'video' => 'https://example.com/source.mp4',
'seconds' => '8',
'aspect_ratio' => '16:9',
'resolution' => '720p',
];
$ch = curl_init('https://www.token-nova.com/v1/videos');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($payload, JSON_UNESCAPED_UNICODE),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "omni-fast-v2v",
"status": "queued",
"progress": 0,
"created_at": 1735689600,
"video_url": ""
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "omni-fast-v2v",
"status": "completed",
"progress": 100,
"created_at": 1735689600,
"completed_at": 1735689900,
"video_url": "https://example.com/results/omni-fast-v2v.mp4"
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "omni-fast-v2v",
"status": "failed",
"progress": 100,
"error": {
"message": "upstream task failed",
"code": "task_failed"
}
}
{
"error": {
"message": "video is required for V2V generation",
"type": "invalid_request_error",
"param": "video",
"code": "invalid_request_error"
}
}
{
"error": {
"message": "invalid token",
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}
{
"error": {
"message": "insufficient quota",
"type": "insufficient_quota",
"code": "insufficient_quota"
}
}
{
"error": {
"message": "request body too large",
"type": "invalid_request_error",
"code": "request_body_too_large"
}
}
{
"error": {
"message": "rate limit exceeded",
"type": "rate_limit_error",
"code": "rate_limit_exceeded"
}
}
{
"error": {
"message": "internal server error",
"type": "server_error",
"code": "server_error"
}
}
omni-fast-v2v
omni-fast-v2v 使用 JSON 请求体提交异步视频任务,适合把已有 MP4 作为参考视频进行编辑、延长或重生成。
- 异步处理模式,提交后返回
id或task_id。 - 参考视频字段支持
video、video_url和input_video。 - 参考视频支持公网 MP4 URL 或
data:video/mp4;base64,...。 - 参考视频最大 15MB。
- 不需要参考视频时,优先使用
omni-fast。
方法与路径
POST /v1/videos
请求示例
curl -X POST https://www.token-nova.com/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "omni-fast-v2v",
"prompt": "Edit the attached video into a visibly new version while preserving the original camera path, timing, subject motion, and shot continuity. Add a rainy cinematic night look with neon reflections. Output a newly generated video, not the uploaded source clip or its preview.",
"video": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p"
}'
curl -X POST https://www.token-nova.com/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "omni-fast-v2v",
"prompt": "Extend this clip into a new cinematic shot with the same camera path.",
"video_url": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p"
}'
curl -X POST https://www.token-nova.com/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "omni-fast-v2v",
"prompt": "Regenerate the attached clip with brighter lighting and smoother motion.",
"input_video": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p"
}'
import requests
resp = requests.post(
"https://www.token-nova.com/v1/videos",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "omni-fast-v2v",
"prompt": "Edit the attached video into a visibly new version while preserving the original camera path. Output a newly generated video, not the uploaded source clip.",
"video": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p",
},
timeout=120,
)
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: "omni-fast-v2v",
prompt:
"Edit the attached video into a visibly new version while preserving the original camera path. Output a newly generated video, not the uploaded source clip.",
video: "https://example.com/source.mp4",
seconds: "8",
aspect_ratio: "16:9",
resolution: "720p",
}),
});
console.log(await response.json());
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload := map[string]any{
"model": "omni-fast-v2v",
"prompt": "Edit the attached video into a visibly new version while preserving the original camera path. Output a newly generated video, not the uploaded source clip.",
"video": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p",
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://www.token-nova.com/v1/videos", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
respBody, _ := io.ReadAll(resp.Body)
fmt.Println(string(respBody))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String json = """
{
"model": "omni-fast-v2v",
"prompt": "Edit the attached video into a visibly new version while preserving the original camera path. Output a newly generated video, not the uploaded source clip.",
"video": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://www.token-nova.com/v1/videos"))
.header("Authorization", "Bearer YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
<?php
$payload = [
'model' => 'omni-fast-v2v',
'prompt' => 'Edit the attached video into a visibly new version while preserving the original camera path. Output a newly generated video, not the uploaded source clip.',
'video' => 'https://example.com/source.mp4',
'seconds' => '8',
'aspect_ratio' => '16:9',
'resolution' => '720p',
];
$ch = curl_init('https://www.token-nova.com/v1/videos');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($payload, JSON_UNESCAPED_UNICODE),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
响应示例
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "omni-fast-v2v",
"status": "queued",
"progress": 0,
"created_at": 1735689600,
"video_url": ""
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "omni-fast-v2v",
"status": "completed",
"progress": 100,
"created_at": 1735689600,
"completed_at": 1735689900,
"video_url": "https://example.com/results/omni-fast-v2v.mp4"
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "omni-fast-v2v",
"status": "failed",
"progress": 100,
"error": {
"message": "upstream task failed",
"code": "task_failed"
}
}
{
"error": {
"message": "video is required for V2V generation",
"type": "invalid_request_error",
"param": "video",
"code": "invalid_request_error"
}
}
{
"error": {
"message": "invalid token",
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}
{
"error": {
"message": "insufficient quota",
"type": "insufficient_quota",
"code": "insufficient_quota"
}
}
{
"error": {
"message": "request body too large",
"type": "invalid_request_error",
"code": "request_body_too_large"
}
}
{
"error": {
"message": "rate limit exceeded",
"type": "rate_limit_error",
"code": "rate_limit_exceeded"
}
}
{
"error": {
"message": "internal server error",
"type": "server_error",
"code": "server_error"
}
}
认证
使用 Bearer Token 鉴权:Authorization: Bearer YOUR_API_KEY
Authorization Header。JSON 请求还需要携带:
Content-Type: application/json
Body
固定传
omni-fast-v2v。示例:"omni-fast-v2v"。视频编辑或生成提示词。建议说明保留哪些运动、镜头或主体,并明确要求输出新视频。示例:
"Edit the attached video into a visibly new version"。参考视频。支持公网 MP4 URL 或
data:video/mp4;base64,...。与 video_url、input_video 任选其一。示例:"https://example.com/source.mp4"。video 的兼容字段。未传 video 时可使用。示例:"https://example.com/source.mp4"。video 的兼容字段。未传 video 和 video_url 时可使用。示例:"https://example.com/source.mp4"。输出时长。建议传字符串;推荐范围为
4 到 30 秒。示例:"8"。画面比例。示例值:
"16:9"、"9:16"。分辨率字段。示例值:
"720p"、"1080p"、"2k"、"4k"。兼容
omni-fast 的首帧图字段。没有参考视频时,建议直接使用 omni-fast。示例:"https://example.com/first-frame.jpg"。兼容
omni-fast 的多参考图字段,最多 5 张。没有参考视频时,建议直接使用 omni-fast。Response
视频任务 ID。后续可用于
GET /v1/videos/{task_id} 查询。视频任务 ID 的兼容字段。通常与
id 相同。对象类型,通常为
video。本次任务使用的模型,例如
omni-fast-v2v。任务状态。常见值为
queued、in_progress、completed、failed。任务进度,常见范围为
0 到 100。完成后的视频地址。
任务失败或接口错误时返回的错误对象,通常包含
message 和 code。使用场景
公网 MP4 参考视频
{
"model": "omni-fast-v2v",
"prompt": "Extend this clip into a new cinematic shot with the same camera path.",
"video": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p"
}
本地 MP4 转 data URI
import base64
from pathlib import Path
source = Path("source.mp4")
if source.stat().st_size > 15 * 1024 * 1024:
raise ValueError("参考视频最大 15MB")
video = "data:video/mp4;base64," + base64.b64encode(source.read_bytes()).decode("ascii")
使用 input_video 别名
{
"model": "omni-fast-v2v",
"prompt": "Regenerate the attached clip with brighter lighting and smoother motion.",
"input_video": "https://example.com/source.mp4",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p"
}
注意事项
omni-fast不支持参考视频;V2V 必须使用omni-fast-v2v。- 参考视频最大 15MB,过大时建议先压缩或转为公网 URL。
video、video_url、input_video是同一类参考视频输入,推荐优先使用video。- 对于
data:video/mp4;base64,...,实际请求体会变大,请预留网络超时时间。 - 完成后从返回的
video_url获取生成的 MP4。
相关接口
⌘I
