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",
"prompt": "Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight",
"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",
"prompt": "The scene comes alive with gentle wind and drifting clouds",
"first_image_url": "https://example.com/first-frame.jpg",
"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",
"prompt": "Create a smooth transition from the first frame to the last frame.",
"first_image_url": "https://example.com/first-frame.jpg",
"last_image_url": "https://example.com/last-frame.jpg",
"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",
"prompt": "Use the first image as the character reference and the second image as the visual style reference. Create a cozy cafe conversation scene.",
"images": [
"https://example.com/character.jpg",
"https://example.com/style.jpg"
],
"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",
"prompt": "Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight",
"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",
prompt:
"Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight",
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",
"prompt": "Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight",
"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",
"prompt": "Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight",
"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',
'prompt' => 'Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight',
'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",
"status": "queued",
"progress": 0,
"created_at": 1735689600,
"video_url": ""
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "omni-fast",
"status": "completed",
"progress": 100,
"created_at": 1735689600,
"completed_at": 1735689900,
"video_url": "https://example.com/results/omni-fast.mp4"
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "omni-fast",
"status": "failed",
"progress": 100,
"error": {
"message": "upstream task failed",
"code": "task_failed"
}
}
{
"error": {
"message": "field model is required",
"type": "invalid_request_error",
"param": "model",
"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": "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 视频生成
使用 POST /v1/videos 调用 omni-fast 生成文生视频、图生视频、首尾帧和多参考图视频。
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",
"prompt": "Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight",
"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",
"prompt": "The scene comes alive with gentle wind and drifting clouds",
"first_image_url": "https://example.com/first-frame.jpg",
"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",
"prompt": "Create a smooth transition from the first frame to the last frame.",
"first_image_url": "https://example.com/first-frame.jpg",
"last_image_url": "https://example.com/last-frame.jpg",
"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",
"prompt": "Use the first image as the character reference and the second image as the visual style reference. Create a cozy cafe conversation scene.",
"images": [
"https://example.com/character.jpg",
"https://example.com/style.jpg"
],
"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",
"prompt": "Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight",
"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",
prompt:
"Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight",
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",
"prompt": "Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight",
"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",
"prompt": "Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight",
"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',
'prompt' => 'Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight',
'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",
"status": "queued",
"progress": 0,
"created_at": 1735689600,
"video_url": ""
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "omni-fast",
"status": "completed",
"progress": 100,
"created_at": 1735689600,
"completed_at": 1735689900,
"video_url": "https://example.com/results/omni-fast.mp4"
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "omni-fast",
"status": "failed",
"progress": 100,
"error": {
"message": "upstream task failed",
"code": "task_failed"
}
}
{
"error": {
"message": "field model is required",
"type": "invalid_request_error",
"param": "model",
"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": "rate limit exceeded",
"type": "rate_limit_error",
"code": "rate_limit_exceeded"
}
}
{
"error": {
"message": "internal server error",
"type": "server_error",
"code": "server_error"
}
}
omni-fast
omni-fast 使用 JSON 请求体提交异步视频任务,适合文生视频、首帧图生视频、首尾帧和多参考图视频。
- 异步处理模式,提交后返回
id或task_id。 - 文生视频只需要
model、prompt、seconds和画面比例字段。 - 首帧图生视频使用
first_image_url。 - 首尾帧使用
first_image_url和last_image_url。 - 多参考图使用
images,最多 5 张;参考视频请使用omni-fast-v2v。
方法与路径
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",
"prompt": "Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight",
"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",
"prompt": "The scene comes alive with gentle wind and drifting clouds",
"first_image_url": "https://example.com/first-frame.jpg",
"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",
"prompt": "Create a smooth transition from the first frame to the last frame.",
"first_image_url": "https://example.com/first-frame.jpg",
"last_image_url": "https://example.com/last-frame.jpg",
"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",
"prompt": "Use the first image as the character reference and the second image as the visual style reference. Create a cozy cafe conversation scene.",
"images": [
"https://example.com/character.jpg",
"https://example.com/style.jpg"
],
"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",
"prompt": "Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight",
"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",
prompt:
"Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight",
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",
"prompt": "Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight",
"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",
"prompt": "Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight",
"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',
'prompt' => 'Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight',
'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",
"status": "queued",
"progress": 0,
"created_at": 1735689600,
"video_url": ""
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "omni-fast",
"status": "completed",
"progress": 100,
"created_at": 1735689600,
"completed_at": 1735689900,
"video_url": "https://example.com/results/omni-fast.mp4"
}
{
"id": "video_abc123",
"task_id": "video_abc123",
"object": "video",
"model": "omni-fast",
"status": "failed",
"progress": 100,
"error": {
"message": "upstream task failed",
"code": "task_failed"
}
}
{
"error": {
"message": "field model is required",
"type": "invalid_request_error",
"param": "model",
"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": "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。示例:"omni-fast"。视频提示词。示例:
"Ocean waves gently rolling onto a sandy beach at golden hour"。视频时长。建议传字符串;推荐范围为
4 到 30 秒。示例:"8"。画面比例。示例值:
"16:9"、"9:16"。分辨率字段。示例值:
"720p"、"1080p"、"2k"、"4k"。首帧图。传入后进入首帧图生视频模式。支持公网 URL 或
data:image/...;base64,...。示例:"https://example.com/first-frame.jpg"。尾帧图。需要配合
first_image_url 使用。示例:"https://example.com/last-frame.jpg"。多参考图列表,最多 5 张。支持公网 URL 或
data:image/...;base64,...。示例:["https://example.com/character.jpg"]。Response
视频任务 ID。后续可用于
GET /v1/videos/{task_id} 查询。视频任务 ID 的兼容字段。通常与
id 相同。对象类型,通常为
video。本次任务使用的模型,例如
omni-fast。任务状态。常见值为
queued、in_progress、completed、failed。任务进度,常见范围为
0 到 100。完成后的视频地址。
任务失败或接口错误时返回的错误对象,通常包含
message 和 code。使用场景
竖屏文生视频
{
"model": "omni-fast",
"prompt": "A woman walking through a neon-lit Tokyo street at night, rain reflections, cinematic",
"seconds": "8",
"aspect_ratio": "9:16",
"resolution": "720p"
}
首帧图生视频
{
"model": "omni-fast",
"prompt": "The scene comes alive with gentle wind and drifting clouds",
"first_image_url": "https://example.com/first-frame.jpg",
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p"
}
多参考图视频
{
"model": "omni-fast",
"prompt": "Use the first image as the character reference and the second image as the visual style reference.",
"images": [
"https://example.com/character.jpg",
"https://example.com/style.jpg"
],
"seconds": "8",
"aspect_ratio": "16:9",
"resolution": "720p"
}
注意事项
omni-fast不支持video、video_url、input_video参考视频字段。images最多 5 张。- 图片字段使用 JSON,不需要 multipart。
- 建议轮询
GET /v1/videos/{task_id},完成后从返回的video_url获取生成的 MP4。 - 参考视频编辑或延长必须使用
omni-fast-v2v。
相关接口
⌘I
