Skip to main content
GET
https://llm.ai-nebula.com
/
v1
/
video
/
generations
/
download
Download Video
curl --request GET \
  --url https://llm.ai-nebula.com/v1/video/generations/download \
  --header 'Authorization: <authorization>'

Introduction

The download video API is used to retrieve completed video file data. Note: This API is only supported for Sora 2 models. For other models (Veo, Ali Wanxiang, Doubao Seedance), the video URL is directly included in the query task API response after the task succeeds, and no additional download step is required.

Authentication

Authorization
string
required
Bearer Token, e.g. Bearer sk-xxxxxxxxxx

Query Parameters

id
string
required
Video ID, which is the task_id returned by the query task API

Usage Example

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

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 Instructions

Frontend Usage with data_url

The data_url field can be used directly in HTML <video> tags:
<video src="data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAB..." controls></video>

Download and Save File

Use the base64 field to save the video as a file:

JavaScript Example

// Get base64 data from response
const response = await fetch('https://llm.ai-nebula.com/v1/video/generations/download?id=video_xxx', {
  headers: {
    'Authorization': 'Bearer sk-xxxxxxxxxx'
  }
});
const data = await response.json();

// Convert base64 to Blob
const binaryString = atob(data.base64);
const bytes = new Uint8Array(binaryString.length);
for (let i = 0; i < binaryString.length; i++) {
  bytes[i] = binaryString.charCodeAt(i);
}
const blob = new Blob([bytes], { type: 'video/mp4' });

// Create download link
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'video.mp4';
a.click();
URL.revokeObjectURL(url);

Python Example

import requests
import base64

def download_video(video_id, api_key):
    """Download video and save as file"""
    url = f"https://llm.ai-nebula.com/v1/video/generations/download?id={video_id}"
    headers = {"Authorization": f"Bearer {api_key}"}
    
    response = requests.get(url, headers=headers)
    data = response.json()
    
    if data.get("success"):
        # Decode base64 data
        video_data = base64.b64decode(data["base64"])
        
        # Save as file
        with open("video.mp4", "wb") as f:
            f.write(video_data)
        
        print(f"✅ Video saved: video.mp4 (size: {data['size']} bytes)")
        return True
    else:
        print("❌ Download failed")
        return False

Complete Workflow Example (Sora 2)

  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 little cat playing in the garden",
        "seconds": "4",
        "size": "720x1280"
      }'
    
    Response:
    {
      "task_id": "video_69095b4ce0048190893a01510c0c98b0",
      "status": "submitted",
      "format": "mp4"
    }
    
  2. Query Task Status (poll until success)
    curl -X GET "https://llm.ai-nebula.com/v1/video/generations/video_69095b4ce0048190893a01510c0c98b0" \
      -H "Authorization: Bearer sk-xxxxxxxxxx"
    
    When status is succeeded, proceed to next step.
  3. Download Video File
    curl -X GET "https://llm.ai-nebula.com/v1/video/generations/download?id=video_69095b4ce0048190893a01510c0c98b0" \
      -H "Authorization: Bearer sk-xxxxxxxxxx"