跳转到主要内容
POST
https://llm.ai-nebula.com
/
v1
/
video
/
generations
Video Generation
curl --request POST \
  --url https://llm.ai-nebula.com/v1/video/generations \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "prompt": "<string>",
  "image": "<string>",
  "duration": 123,
  "resolution": "<string>",
  "aspect_ratio": "<string>"
}
'

Introduction

The video generation API supports text-to-video, image-to-video, video-to-video, and more. Through a unified API interface, you can call multiple mainstream video generation models including Sora 2, Veo, Ali Wanxiang, and Doubao Seedance. Important Note: Video generation is an asynchronous task. You need to first submit a task to get a task ID, then poll the task status until it succeeds.

Supported Models and Features

Model SeriesModel NameSupported Features
Sora 2sora-2Text-to-video, Image-to-video, Video-to-video (Remix mode)
Google Veoveo-3.0-fast-generate-001Text-to-video (first frame mode)
veo-3.1-fast-generate-previewText-to-video (first frame mode, first/last frame mode)
Ali Wanxiangwan2.5-t2v-previewText-to-video
wan2.5-i2v-previewImage-to-video (first frame mode)
Doubao Seedancedoubao-seedance-1-0-lite-t2v-250428Text-to-video
doubao-seedance-1-0-lite-i2v-250428Image-to-video (first frame mode, first/last frame mode, reference image mode)
doubao-seedance-1-0-pro-250528Text-to-video (first frame mode)
doubao-seedance-1-5-pro-251215Text-to-video, Image-to-video (first frame mode, first/last frame mode), with audio
doubao-seedance-1-5-pro-251215-noAudioText-to-video, Image-to-video (first frame mode, first/last frame mode), silent video
Feature Description:
  • Text-to-Video (T2V): Generate video from text prompts only
  • Image-to-Video (I2V): Generate video based on reference images
    • First Frame Mode: Use first frame image as starting scene
    • First/Last Frame Mode: Use first and last frame images to control video start and end scenes
    • Reference Image Mode: Use reference images as style reference (only supported by some models)
  • Video-to-Video (Remix): Regenerate based on existing video (only Sora 2 supports)

Authentication

Authorization
string
必填
Bearer Token, e.g. Bearer sk-xxxxxxxxxx

API Endpoints

Submit Video Task

POST /v1/video/generations Submit a video generation task and return a task ID for subsequent queries.

Query Video Task

GET /v1/video/generations/{task_id} Query the status and results of a video generation task by task ID.

Path Parameters

task_id
string
必填
Video generation task ID returned by the submit task interface

Response Examples

Task Status Description:
StatusDescriptionSuggested Action
queuedTask queued, waiting for processingContinue polling
in_progressTask being processedContinue polling
succeededTask completed successfullyDownload video
failedTask failedView error reason
Response Example (Queued):
{
  "task_id": "video_69095b4ce0048190893a01510c0c98b0",
  "status": "queued",
  "format": "mp4"
}
Response Example (In Progress):
{
  "task_id": "video_69095b4ce0048190893a01510c0c98b0",
  "status": "in_progress",
  "format": "mp4"
}
Response Example (Completed):
{
  "task_id": "video_69095b4ce0048190893a01510c0c98b0",
  "status": "succeeded",
  "format": "mp4"
}
Response Example (Failed):
{
  "task_id": "video_69095b4ce0048190893a01510c0c98b0",
  "status": "failed",
  "format": "mp4",
  "error": {
    "code": 400,
    "message": "Prompt contains inappropriate content"
  }
}

Usage Example

curl -X GET "https://llm.ai-nebula.com/v1/video/generations/video_69095b4ce0048190893a01510c0c98b0" \
  -H "Authorization: Bearer sk-xxxxxxxxxx"

Download Video

GET /v1/video/generations/download?id={videoId} Download completed video files (Sora 2 only).

Query Parameters

id
string
必填
Video ID returned by the query task interface (task_id)

Response Example

{
  "success": true,
  "generation_id": "video_69095b4ce0048190893a01510c0c98b0",
  "task_id": "video_69095b4ce0048190893a01510c0c98b0",
  "format": "mp4",
  "size": 15728640,
  "base64": "AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAB...",
  "data_url": "data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAB..."
}
Response Field Description:
FieldTypeDescription
successbooleanSuccess status
generation_idstringGeneration ID (same as videoId)
task_idstringTask ID
formatstringVideo format (fixed as "mp4")
sizenumberVideo file size (bytes)
base64stringBase64 encoded video data
data_urlstringData URL format video data, can be used directly in frontend <video> tags

Usage Example

curl -X GET "https://llm.ai-nebula.com/v1/video/generations/download?id=video_69095b4ce0048190893a01510c0c98b0" \
  -H "Authorization: Bearer sk-xxxxxxxxxx"

Submit Video Task

POST /v1/video/generations Submit a video generation task and return a task ID for subsequent queries.

Usage Examples

1. Text-to-Video (Basic Example)
curl -X POST "https://llm.ai-nebula.com/v1/video/generations" \
  -H "Authorization: Bearer sk-xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sora-2",
    "prompt": "A cute little cat playing in the garden, sunny and warm",
    "seconds": "4",
    "size": "720x1280"
  }'
2. Text-to-Video (Landscape, 8 seconds)
curl -X POST "https://llm.ai-nebula.com/v1/video/generations" \
  -H "Authorization: Bearer sk-xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sora-2",
    "prompt": "A cute little cat playing in the garden, sunny and warm",
    "seconds": "8",
    "size": "1280x720"
  }'
3. Image-to-Video (First Frame Mode)
curl -X POST "https://llm.ai-nebula.com/v1/video/generations" \
  -H "Authorization: Bearer sk-xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sora-2",
    "prompt": "A cute little cat playing in the garden, sunny and warm",
    "seconds": "4",
    "size": "720x1280",
    "input_reference": "data:image/png;base64,iVBORw0KGgoAAxxxx..."
  }'
4. Remix Mode (Video-to-Video)
curl -X POST "https://llm.ai-nebula.com/v1/video/generations" \
  -H "Authorization: Bearer sk-xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sora-2",
    "prompt": "Change the video to a night scene with stars",
    "seconds": "4",
    "size": "720x1280",
    "remix_from_video_id": "video_69095b4ce0048190893a01510c0c98b0"
  }'

Response Example

{
  "task_id": "video_69095b4ce0048190893a01510c0c98b0",
  "status": "submitted",
  "format": "mp4"
}

Request Parameters

model
string
必填
Model identifier, supported models and features:Sora 2 Series:
  • sora-2 - Supports text-to-video, image-to-video, video-to-video (Remix mode)
Google Veo Series:
  • veo-3.0-fast-generate-001 - Text-to-video (first frame mode)
  • veo-3.1-fast-generate-preview - Text-to-video (first frame mode, first/last frame mode)
Ali Wanxiang Series:
  • wan2.5-t2v-preview - Text-to-video
  • wan2.5-i2v-preview - Image-to-video (first frame mode)
Doubao Seedance Series:
  • doubao-seedance-1-0-lite-t2v-250428 - Text-to-video
  • doubao-seedance-1-0-lite-i2v-250428 - Image-to-video (first frame mode, first/last frame mode, reference image mode)
  • doubao-seedance-1-0-pro-250528 - Text-to-video (first frame mode)
  • doubao-seedance-1-5-pro-251215 - Text-to-video, Image-to-video (first frame mode, first/last frame mode), with audio, duration 4-12s, resolution 480p/720p
  • doubao-seedance-1-5-pro-251215-noAudio - Text-to-video, Image-to-video (first frame mode, first/last frame mode), silent video, duration 4-12s, resolution 480p/720p
prompt
string
Video generation prompt, describing scene actions and settings. Note: Doubao Seedance series models do not require this field, the prompt should be written directly in the text field of the metadata.content array
image
string
Reference image for image-to-video (supports Base64 or URL format)
duration
integer
默认值:"5"
Video duration (seconds), different models support different durations
resolution
string
默认值:"720p"
Video resolution: 480p, 720p, 1080p, 4k
aspect_ratio
string
默认值:"16:9"
Aspect ratio: 16:9, 9:16, 1:1, 4:3, 3:4, 21:9, adaptive (adaptive, only supported by some models)

Model-Specific Parameters

Different models support different specific parameters. Below are detailed descriptions by model series:
seconds
string|integer
默认值:"4"
Video duration (seconds), supports: 4, 8, 12
size
string
默认值:"720x1280"
Video resolution, supports: 720x1280 (portrait), 1280x720 (landscape)
input_reference
string
Reference image (supports URL or Base64 format), for image-to-video
remix_from_video_id
string
Remix mode: Regenerate based on existing video ID (must start with video_)

Complete Examples

Doubao Seedance Series

Doubao Seedance series models use a special parameter passing method: all parameters are passed through special markers in the prompt, and images are passed through the metadata.content array.

1. Text-to-Video (T2V)

curl -X POST "https://llm.ai-nebula.com/v1/video/generations" \
  -H "Authorization: Bearer sk-xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-1-0-lite-t2v-250428",
    "metadata": {
      "content": [
        {
          "type": "text",
          "text": "A cute kitten playing in a garden, sunny day --ratio 16:9 --dur 5 --rs 720p --wm false"
        }
      ]
    }
  }'

2. Image-to-Video - First Frame Mode

curl -X POST "https://llm.ai-nebula.com/v1/video/generations" \
  -H "Authorization: Bearer sk-xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-1-0-lite-i2v-250428",
    "metadata": {
      "content": [
        {
          "type": "text",
          "text": "A girl opens her eyes and looks gently at the camera --ratio adaptive --dur 5 --rs 720p --wm false"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "data:image/png;base64,iVBORw0KGgoAAxxxx..."
          }
        }
      ]
    }
  }'

3. Image-to-Video - First/Last Frame Mode (Only lite-i2v supports)

curl -X POST "https://llm.ai-nebula.com/v1/video/generations" \
  -H "Authorization: Bearer sk-xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-1-0-lite-i2v-250428",
    "metadata": {
      "content": [
        {
          "type": "text",
          "text": "A blue-green jingwei bird transforms into human form --rs 720p --dur 5 --cf false"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "data:image/png;base64,iVBORw0KGgoAAxxxx..."
          },
          "role": "first_frame"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "data:image/png;base64,iVBORw0KGgoAAyyyy..."
          },
          "role": "last_frame"
        }
      ]
    }
  }'

4. Image-to-Video - Reference Image Mode (Only lite-i2v supports)

curl -X POST "https://llm.ai-nebula.com/v1/video/generations" \
  -H "Authorization: Bearer sk-xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-1-0-lite-i2v-250428",
    "metadata": {
      "content": [
        {
          "type": "text",
          "text": "[图1] A boy wearing glasses and blue T-shirt and [图2] corgi dog, sitting on [图3] lawn, 3D cartoon style --rs 720p --dur 5"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/ref1.png"
          },
          "role": "reference_image"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/ref2.png"
          },
          "role": "reference_image"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/ref3.png"
          },
          "role": "reference_image"
        }
      ]
    }
  }'
Important Notes:
  • The content array must be placed in the metadata object
  • All parameters must be passed through special markers in the prompt (e.g., --ratio 16:9)
  • Images must be placed in the metadata.content array using image_url type
  • First/last frame mode requires two images, marked with role: "first_frame" and role: "last_frame" respectively
  • Reference image mode requires using [图1], [图2] etc. in the prompt to reference images, with images marked role: "reference_image"
  • doubao-seedance-1-0-lite-t2v-250428 does not support image input and adaptive aspect ratio
  • doubao-seedance-1-0-pro-250528 only supports first frame mode

1. Submit Video Generation Task

curl -X POST "https://llm.ai-nebula.com/v1/video/generations" \
  -H "Authorization: Bearer sk-xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sora-2",
    "prompt": "A cute kitten playing in a garden, sunny day, warm scene",
    "seconds": "4",
    "size": "720x1280"
  }'
Response Example:
{
  "task_id": "video_69095b4ce0048190893a01510c0c98b0",
  "status": "submitted",
  "format": "mp4"
}

2. Poll Task Status

curl -X GET "https://llm.ai-nebula.com/v1/video/generations/video_69095b4ce0048190893a01510c0c98b0" \
  -H "Authorization: Bearer sk-xxxxxxxxxx"
Task Status Description:
StatusDescriptionRecommended Action
queuedTask queued, waiting for processingContinue polling
in_progressTask processingContinue polling
succeededTask completed successfullyDownload video
failedTask failedCheck failure reason
Response Example (Queued):
{
  "task_id": "video_69095b4ce0048190893a01510c0c98b0",
  "status": "queued",
  "format": "mp4"
}
Response Example (Processing):
{
  "task_id": "video_69095b4ce0048190893a01510c0c98b0",
  "status": "in_progress",
  "format": "mp4"
}
Response Example (Completed):
{
  "task_id": "video_69095b4ce0048190893a01510c0c98b0",
  "status": "succeeded",
  "format": "mp4"
}
Response Example (Failed):
{
  "task_id": "video_69095b4ce0048190893a01510c0c98b0",
  "status": "failed",
  "format": "mp4",
  "error": {
    "code": 400,
    "message": "Prompt contains inappropriate content"
  }
}
Important Note:
  • When task status is queued or in_progress, you need to poll regularly (recommended every 3-5 seconds)
  • When status becomes succeeded, you can use task_id as videoId to download the video
  • When status becomes failed, you can check the error field for failure reason

3. Download Video (Sora 2 Exclusive)

Use the task_id returned after successful polling (as videoId) to download the video:
curl -X GET "https://llm.ai-nebula.com/v1/video/generations/download?id=video_69095b4ce0048190893a01510c0c98b0" \
  -H "Authorization: Bearer sk-xxxxxxxxxx"
Note: The value of the id parameter is the task_id returned after successful polling in step 2.Response Example:
{
  "success": true,
  "generation_id": "video_69095b4ce0048190893a01510c0c98b0",
  "task_id": "video_69095b4ce0048190893a01510c0c98b0",
  "format": "mp4",
  "size": 15728640,
  "base64": "AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAB...",
  "data_url": "data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAB..."
}
Response Field Description:
Field NameTypeDescription
successbooleanWhether successful
generation_idstringGeneration ID (same as videoId)
task_idstringTask ID
formatstringVideo format (fixed as "mp4")
sizenumberVideo file size (bytes)
base64stringBase64-encoded video data
data_urlstringVideo data in Data URL format, can be directly used in frontend <video> tag

Supported Models

Sora 2 Series

Model Name: sora-2 Core Capabilities:
  • ✅ Text-to-video (pure text description generates video)
  • ✅ Image-to-video (single image + text generates video)
  • ✅ Remix mode (regenerate based on existing video)
Supported Parameters:
  • seconds: Video duration (4, 8, 12 seconds), default 4 seconds
  • size: Video resolution (720x1280 portrait, 1280x720 landscape), default 720x1280
  • width / height: Video width and height (automatically converted to size parameter)
  • input_reference: Reference image (supports URL or Base64 format), for image-to-video
  • remix_from_video_id: Remix mode, regenerate based on existing video ID (must start with video_)
Notes:
  • Video generation is an asynchronous task, need to first submit task to get task_id, then poll task status
  • When task status is succeeded, use task_id as videoId to call download interface to get video
  • Download interface returns Base64-encoded video data, can be directly used for frontend playback or saved as file
  • Image input formats support JPEG, PNG, image size must exactly match size parameter for image-to-video

Veo Series

Model Names: veo-3.1-generate-preview, veo-3.1-fast-generate-preview, veo-3.0-generate-preview, veo-3.0-fast-generate-001 Core Capabilities:
  • ✅ Text-to-video
  • ✅ Image-to-video (supports first frame and last frame constraints)
  • ✅ Audio generation
Supported Parameters:
  • durationSeconds: Video duration (4, 6, 8 seconds)
  • aspectRatio: Aspect ratio (16:9, 9:16)
  • resolution: Resolution (720p, 1080p)
  • generateAudio: Whether to generate audio
  • image: First frame reference image
  • lastFrame: Last frame reference image
  • seed: Random seed

Ali Wanxiang Series

Model Name: wan2.5-i2v-preview Core Capabilities:
  • ✅ Image-to-video
  • ✅ Supports custom audio upload
  • ✅ Intelligent prompt expansion
  • ✅ Auto-generate synchronized audio with video
Supported Parameters:
  • duration: Video duration (5, 10 seconds)
  • resolution: Video resolution (480p, 720p, 1080p)
  • smart_rewrite: Whether to enable intelligent prompt expansion
  • generate_audio: Whether to generate synchronized audio with video
  • audio_url: Custom audio file URL
  • seed: Random seed

Doubao Seedance Series

Model Names:
  • doubao-seedance-1-0-pro-250528 - Pro version, supports text-to-video and image-to-video (first frame mode)
  • doubao-seedance-1-0-lite-t2v-250428 - Lite version text-to-video
  • doubao-seedance-1-0-lite-i2v-250428 - Lite version image-to-video, supports first frame, first/last frame, reference image three modes
  • doubao-seaweed-1-0-t2v-250428 - Seaweed version text-to-video
  • wan2-1-14b-i2v-250417 - Wanxiang version image-to-video
  • wan2-1-14b-flf2v-250417 - Wanxiang version first/last frame generation
Core Capabilities:
  • ✅ Text-to-video (T2V)
  • ✅ Image-to-video - First frame mode (I2V)
  • ✅ Image-to-video - First/last frame mode (only doubao-seedance-1-0-lite-i2v-250428 and wan2-1-14b-flf2v-250417 support)
  • ✅ Image-to-video - Reference image mode (only doubao-seedance-1-0-lite-i2v-250428 supports)
Supported Parameters (controlled through special markers in text prompts):
  • --rs / --resolution: Resolution (480p, 720p, 1080p)
  • --ratio: Aspect ratio (16:9, 9:16, 1:1, 4:3, 3:4, adaptive)
  • --dur / --duration: Duration (seconds, e.g. 5, 10)
  • --fps / --framespersecond: Frame rate (e.g. 24, 30)
  • --seed: Random seed
  • --wm / --watermark: Watermark toggle (true, false)
  • --cf / --camerafixed: Fixed camera (true, false, only lite models support)
Image Input Format:
  • In metadata.content array, image items can be marked via role field:
    • first_frame: First frame image
    • last_frame: Last frame image
    • reference_image: Reference image (use [图N] in prompt to reference)
Notes:
  • doubao-seedance-1-0-lite-t2v-250428 only supports text-to-video, does not support image input
  • Reference image mode of doubao-seedance-1-0-lite-i2v-250428 does not support 1080p resolution
  • doubao-seedance-1-0-lite-t2v-250428 does not support adaptive aspect ratio

Best Practices

Polling Strategy

import requests
import time

def poll_task_status(task_id, api_key, max_wait_time=300):
    """Poll task status until completion"""
    url = f"https://llm.ai-nebula.com/v1/video/generations/{task_id}"
    headers = {"Authorization": f"Bearer {api_key}"}
    
    start_time = time.time()
    while True:
        response = requests.get(url, headers=headers)
        data = response.json()
        status = data.get("status")
        
        print(f"Current status: {status}")
        
        if status == "succeeded":
            video_url = data.get("url")
            print(f"✅ Task completed! Video URL: {video_url}")
            return video_url
        elif status == "failed":
            error_msg = data.get("metadata", {}).get("output", {}).get("message", "Unknown error")
            print(f"❌ Task failed: {error_msg}")
            return None
        
        # Check timeout
        if time.time() - start_time > max_wait_time:
            print("⏰ Wait timeout")
            return None
        
        # Wait 5 seconds before querying again
        time.sleep(5)

FAQ

Usually takes 1-5 minutes, depending on video duration, resolution, and server load.
Video URLs are valid for approximately 24 hours. It is recommended to download and save immediately after receiving the response.
Supports PNG, JPEG, JPG, WEBP formats, maximum file size 10MB.