Skip to content

Sora Video Creation

OpenAI-compatible video generation interface, supporting high-quality video generation using Sora models.

API Details

Endpoint: POST /v1/videos

Description: Create a video generation task using Sora models. Supports text-to-video and image-to-video with controllable parameters like duration, dimensions, and frame rate.

Reference: OpenAI Videos API

Authentication: Bearer Token

http
Authorization: Bearer YOUR_API_TOKEN

Request Parameters

Body Parameters (multipart/form-data)

ParameterTypeRequiredDescriptionExample
modelstringNoModel/style IDsora-1.0, sora-turbo
promptstringNoText description promptA golden retriever running on the beach
imagestringNoImage input (URL or Base64) for image-to-videohttps://example.com/image.jpg
durationnumberNoVideo duration in seconds5.0, 10.0
widthintegerNoVideo width1920, 1280
heightintegerNoVideo height1080, 720
fpsintegerNoVideo frame rate24, 30, 60
seedintegerNoRandom seed for reproducible results12345
nintegerNoNumber of videos to generate1, 2
response_formatstringNoResponse formaturl, b64_json
userstringNoUser identifieruser-123
metadataobjectNoExtended parameters (e.g., negative_prompt, style, quality_level){"style": "cinematic"}

Response Parameters

Success Response (200)

ParameterTypeDescription
idstringVideo task ID
objectstringObject type, always video
modelstringModel name used
statusstringTask status: pending, processing, completed, failed
progressintegerProgress percentage (0-100)
created_atintegerCreation timestamp (Unix timestamp)
secondsstringVideo duration
completed_atintegerCompletion timestamp (optional)
expires_atintegerExpiration timestamp (optional)
sizestringVideo dimensions in format {width}x{height}
errorobjectError information (optional)
error.messagestringError description
error.codestringError code
metadataobjectAdditional metadata

Error Response (400)

ParameterTypeDescription
errorobjectError information object
error.messagestringError description
error.codestringError code

Code Examples

cURL

bash
curl -X POST "https://api.ezmodel.cloud/v1/videos" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sora-1.0",
    "prompt": "A cute orange cat napping in the sunlight with wind gently blowing its fur",
    "duration": 10,
    "width": 1920,
    "height": 1080,
    "fps": 30,
    "n": 1
  }'

Python

python
import requests
import json

url = "https://api.ezmodel.cloud/v1/videos"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}

data = {
    "model": "sora-1.0",
    "prompt": "A cute orange cat napping in the sunlight with wind gently blowing its fur",
    "duration": 10,
    "width": 1920,
    "height": 1080,
    "fps": 30,
    "n": 1
}

response = requests.post(url, headers=headers, json=data)
result = response.json()
print(json.dumps(result, indent=2))

JavaScript

javascript
const response = await fetch('https://api.ezmodel.cloud/v1/videos', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    model: 'sora-1.0',
    prompt: 'A cute orange cat napping in the sunlight with wind gently blowing its fur',
    duration: 10,
    width: 1920,
    height: 1080,
    fps: 30,
    n: 1
  })
});

const result = await response.json();
console.log(result);

Go

go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
)

func main() {
    url := "https://api.ezmodel.cloud/v1/videos"
    
    payload := map[string]interface{}{
        "model":    "sora-1.0",
        "prompt":   "A cute orange cat napping in the sunlight with wind gently blowing its fur",
        "duration": 10,
        "width":    1920,
        "height":   1080,
        "fps":      30,
        "n":        1,
    }
    
    jsonData, _ := json.Marshal(payload)
    req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
    req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
    req.Header.Set("Content-Type", "application/json")
    
    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()
    
    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}

Java

java
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;

public class SoraVideoExample {
    public static void main(String[] args) throws Exception {
        String url = "https://api.ezmodel.cloud/v1/videos";
        String json = """
        {
            "model": "sora-1.0",
            "prompt": "A cute orange cat napping in the sunlight with wind gently blowing its fur",
            "duration": 10,
            "width": 1920,
            "height": 1080,
            "fps": 30,
            "n": 1
        }
        """;
        
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("Authorization", "Bearer YOUR_API_KEY")
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(json))
            .build();
        
        HttpResponse<String> response = client.send(request, 
            HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}

C#

csharp
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        var client = new HttpClient();
        var url = "https://api.ezmodel.cloud/v1/videos";
        
        client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");
        
        var json = @"{
            ""model"": ""sora-1.0"",
            ""prompt"": ""A cute orange cat napping in the sunlight with wind gently blowing its fur"",
            ""duration"": 10,
            ""width"": 1920,
            ""height"": 1080,
            ""fps"": 30,
            ""n"": 1
        }";
        
        var content = new StringContent(json, Encoding.UTF8, "application/json");
        var response = await client.PostAsync(url, content);
        var result = await response.Content.ReadAsStringAsync();
        
        Console.WriteLine(result);
    }
}

Response Examples

Success Response (200)

json
{
  "id": "vid_abc123xyz456",
  "object": "video",
  "model": "sora-1.0",
  "status": "processing",
  "progress": 0,
  "created_at": 1705334400,
  "seconds": "10.0",
  "completed_at": null,
  "expires_at": 1705420800,
  "size": "1920x1080",
  "error": null,
  "metadata": {
    "fps": 30,
    "seed": 12345
  }
}

Error Response (400)

json
{
  "error": {
    "message": "Invalid parameter: duration must be between 1 and 60 seconds",
    "code": "invalid_parameter"
  }
}

Important Notes

  1. Asynchronous Processing: Video generation is an asynchronous process. After submission, use the query interface to retrieve results
  2. Parameter Limits: Different models have different limitations on video duration, dimensions, and frame rate
  3. Billing: Video generation is billed based on duration and resolution. See pricing page for details
  4. Expiration: Generated videos expire after a certain period. Download and save them promptly
  5. Concurrency Limits: Each account may have limits on the number of concurrent tasks

企业合作联系:service@ezmodel.cloud