The Video Generation API allows you to create videos from text prompts using advanced models like Google Veo 3.0. Generate cinematic-quality videos with customizable aspect ratios, negative prompts, and output formats for your creative or business needs.
Note: You need an API key to use this endpoint. See the Quickstart Guide to get started.
prompt
, model
, aspectRatio
, negativePrompt
, etc.).POST /v1/video/generations
All requests must include an Authorization header with a Bearer token:
Authorization: Bearer YOUR_API_KEY
1{
2 "model": "google/veo-3.0-generate-preview",
3 "prompt": "A cinematic shot of a majestic lion in the savannah.",
4 "parameters": {
5 "aspectRatio": "16:9",
6 "negativePrompt": "cartoon, drawing, low quality"
7 },
8 "response_format": "mp4"
9}
Parameter | Type | Required | Description |
---|---|---|---|
model | string | Yes | The model to use for video generation. Currently supports google/veo-3.0-generate-preview. |
prompt | string | Yes | The prompt to generate videos for. |
parameters | object | No | Additional parameters for video generation. |
parameters.aspectRatio | string | No | Aspect ratio of the video, currently only supports 16:9. |
parameters.negativePrompt | string | No | Negative prompt to avoid certain elements in the video. |
response_format | string | No | The format of the generated video. Currently only supports mp4. Defaults to mp4 if not specified. |
The initial response contains an operation ID for tracking the video generation progress:
1{
2 "id": "video-op:user123:1703123456789",
3 "operation_name": "operations/veo-3.0-generate-preview/123456789",
4 "status": "pending"
5}
GET /v1/video/generations/{id}
1{
2 "id": "video-op:user123:1703123456789",
3 "status": "pending"
4}
1{
2 "id": "video-op:user123:1703123456789",
3 "status": "completed",
4 "video_url": "https://your-r2-domain.com/user123/1703123456789-video.mp4"
5}
Direct API call for video generation:
1# Start video generation
2curl -X POST http://localhost:8787/v1/video/generations \
3 -H "Authorization: Bearer YOUR_API_KEY" \
4 -H "Content-Type: application/json" \
5 -H "X-App-ID: your-app-id" \
6 -d '{
7 "model": "google/veo-3.0-generate-preview",
8 "prompt": "A cinematic shot of a majestic lion in the savannah.",
9 "parameters": {
10 "aspectRatio": "16:9",
11 "negativePrompt": "cartoon, drawing, low quality"
12 }
13 }'
14
15# Check status (replace with actual operation ID)
16curl -X GET http://localhost:8787/v1/video/generations/video-op:user123:1703123456789 \
17 -H "Authorization: Bearer YOUR_API_KEY" \
18 -H "X-App-ID: your-app-id"
Video generation with JavaScript:
1// Start video generation
2const response = await fetch("http://localhost:8787/v1/video/generations", {
3 method: "POST",
4 headers: {
5 Authorization: "Bearer YOUR_API_KEY",
6 "Content-Type": "application/json",
7 "X-App-ID": "your-app-id",
8 },
9 body: JSON.stringify({
10 model: "google/veo-3.0-generate-preview",
11 prompt: "A cinematic shot of a majestic lion in the savannah.",
12 parameters: {
13 aspectRatio: "16:9",
14 negativePrompt: "cartoon, drawing, low quality",
15 },
16 response_format: "mp4",
17 }),
18});
19
20const result = await response.json();
21console.log("Operation ID:", result.id);
22
23// Poll for completion
24const checkStatus = async (operationId) => {
25 const statusResponse = await fetch(
26 `http://localhost:8787/v1/video/generations/${operationId}`,
27 {
28 headers: {
29 Authorization: "Bearer YOUR_API_KEY",
30 "X-App-ID": "your-app-id",
31 },
32 }
33 );
34
35 const status = await statusResponse.json();
36
37 if (status.status === "completed") {
38 console.log("Video URL:", status.video_url);
39 return status.video_url;
40 } else {
41 console.log("Still processing...");
42 // Wait 10 seconds before checking again
43 setTimeout(() => checkStatus(operationId), 10000);
44 }
45};
46
47checkStatus(result.id);
For the best developer experience, use the official Lunos library with built-in TypeScript support:
1import { LunosClient } from '@lunos/client';
2
3// Initialize the client
4const client = new LunosClient({
5 apiKey: 'YOUR_API_KEY',
6 appId: "your-app-id",
7});
8
9// Basic video generation
10const response = await client.video.generateVideo({
11 model: "google/veo-3.0-generate-preview",
12 prompt: "A cinematic shot of a majestic lion in the savannah.",
13 parameters: {
14 aspectRatio: "16:9",
15 negativePrompt: "cartoon, drawing, low quality",
16 },
17 response_format: "mp4",
18 appId: "my-video-app",
19});
20
21console.log("Operation ID:", response.id);
22console.log("Status:", response.status);
23
24// Check video generation status
25const status = await client.video.getVideoStatus(response.id, "my-video-app");
26
27if (status.status === "completed") {
28 console.log("Video URL:", status.video_url);
29}
30
31// Generate and wait for completion
32const result = await client.video.generateAndWait(
33 {
34 prompt: "A beautiful sunset over mountains with birds flying",
35 aspectRatio: "16:9",
36 negativePrompt: "cartoon, animation, low quality",
37 },
38 10000,
39 300000
40); // Poll every 10 seconds, max wait 5 minutes
41
42console.log("Video URL:", result.video_url);
43
44// Convenience methods
45const response = await client.video.generate({
46 prompt: "A futuristic city skyline at night",
47 model: "google/veo-3.0-generate-preview",
48 aspectRatio: "16:9",
49 negativePrompt: "cartoon, low quality, blurry",
50});
51
52const widescreenVideo = await client.video.generateWidescreen({
53 prompt: "A cinematic car chase scene through a busy city",
54 negativePrompt: "cartoon, animation, low quality",
55});
56
57const mp4Video = await client.video.generateMP4({
58 prompt: "A peaceful forest scene with birds chirping",
59 aspectRatio: "16:9",
60});
Installation: Install the official Lunos library with npm install @lunos/client
or yarn add @lunos/client
Video generation with Python:
1import requests
2import time
3
4# Start video generation
5response = requests.post(
6 'http://localhost:8787/v1/video/generations',
7 headers={
8 'Authorization': 'Bearer YOUR_API_KEY',
9 'Content-Type': 'application/json',
10 'X-App-ID': 'your-app-id'
11 },
12 json={
13 'model': 'google/veo-3.0-generate-preview',
14 'prompt': 'A cinematic shot of a majestic lion in the savannah.',
15 'parameters': {
16 'aspectRatio': '16:9',
17 'negativePrompt': 'cartoon, drawing, low quality'
18 },
19 'response_format': 'mp4'
20 }
21)
22
23result = response.json()
24operation_id = result['id']
25print(f"Operation ID: {operation_id}")
26
27# Poll for completion
28def check_status(operation_id):
29 while True:
30 status_response = requests.get(
31 f'http://localhost:8787/v1/video/generations/{operation_id}',
32 headers={
33 'Authorization': 'Bearer YOUR_API_KEY',
34 'X-App-ID': 'your-app-id'
35 }
36 )
37
38 status = status_response.json()
39
40 if status['status'] == 'completed':
41 print(f"Video URL: {status['video_url']}")
42 return status['video_url']
43 else:
44 print("Still processing...")
45 time.sleep(10) # Wait 10 seconds
46
47video_url = check_status(operation_id)
App Tracking: The X-App-ID
header allows you to track video generation usage per application. This helps with analytics, billing, and performance monitoring across different apps.
1{
2 "error": "Missing required fields: model and prompt"
3}
1{
2 "error": "Insufficient balance"
3}
1{
2 "error": "Model not found"
3}
1{
2 "error": "Failed to start video generation"
3}
Currently, the API supports the following video generation model:
Important: Your API key is sensitive. Never share it publicly or commit it to version control.
Video generation requests are subject to rate limiting based on your account tier and current usage. Check your account limits before making requests.
No headings found on this page.