curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "sora-2-official",
"prompt": "A golden retriever running on grass, sunny day",
"duration": 12,
"aspect_ratio": "16:9"
}'
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "sora-2-official",
"prompt": "Make this dog come alive, running on grass",
"image_urls": ["https://example.com/dog.jpg"],
"duration": 8,
"aspect_ratio": "16:9"
}'
import requests
response = requests.post(
"https://toapis.com/v1/videos/generations",
headers={
"Authorization": "Bearer your-ToAPIs-key",
"Content-Type": "application/json"
},
json={
"model": "sora-2-official",
"prompt": "A golden retriever running on grass, sunny day",
"duration": 12,
"aspect_ratio": "16:9"
}
)
task = response.json()
print(f"Task ID: {task['id']}")
print(f"Status: {task['status']}")
const response = await fetch('https://toapis.com/v1/videos/generations', {
method: 'POST',
headers: {
'Authorization': 'Bearer your-ToAPIs-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'sora-2-official',
prompt: 'A golden retriever running on grass, sunny day',
duration: 12,
aspect_ratio: '16:9'
})
});
const task = await response.json();
console.log(`Task ID: ${task.id}`);
console.log(`Status: ${task.status}`);
{
"id": "video_01K8SGYNNNVBQTXNR4MM964S7K",
"object": "generation.task",
"model": "sora-2-official",
"status": "queued",
"progress": 0,
"created_at": 1768380224,
"metadata": {
"size": "1280x720",
"seconds": "12"
}
}
Sora 2 Official (Azure)
Azure Sora 2 Video Generation
Generate high-quality videos using Azure Sora 2 model
POST
/
v1
/
videos
/
generations
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "sora-2-official",
"prompt": "A golden retriever running on grass, sunny day",
"duration": 12,
"aspect_ratio": "16:9"
}'
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "sora-2-official",
"prompt": "Make this dog come alive, running on grass",
"image_urls": ["https://example.com/dog.jpg"],
"duration": 8,
"aspect_ratio": "16:9"
}'
import requests
response = requests.post(
"https://toapis.com/v1/videos/generations",
headers={
"Authorization": "Bearer your-ToAPIs-key",
"Content-Type": "application/json"
},
json={
"model": "sora-2-official",
"prompt": "A golden retriever running on grass, sunny day",
"duration": 12,
"aspect_ratio": "16:9"
}
)
task = response.json()
print(f"Task ID: {task['id']}")
print(f"Status: {task['status']}")
const response = await fetch('https://toapis.com/v1/videos/generations', {
method: 'POST',
headers: {
'Authorization': 'Bearer your-ToAPIs-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'sora-2-official',
prompt: 'A golden retriever running on grass, sunny day',
duration: 12,
aspect_ratio: '16:9'
})
});
const task = await response.json();
console.log(`Task ID: ${task.id}`);
console.log(`Status: ${task.status}`);
{
"id": "video_01K8SGYNNNVBQTXNR4MM964S7K",
"object": "generation.task",
"model": "sora-2-official",
"status": "queued",
"progress": 0,
"created_at": 1768380224,
"metadata": {
"size": "1280x720",
"seconds": "12"
}
}
Note for users in mainland China: Please use
https://toapis.cn as the API endpoint (Base URL). Replace https://toapis.com with https://toapis.cn in the examples in this document.- Azure Sora 2 video generation model (official Azure OpenAI endpoint)
- Use model parameter to select
sora-2-official - Supports text-to-video, image-to-video, and remix
- Async task management, query results by task ID
Authorizations
string
required
All endpoints require Bearer Token authenticationGet your API Key from the API Key Management PageAdd to request header:
Authorization: Bearer YOUR_API_KEY
Body
string
required
Video generation model nameSupported models:
sora-2-official- Azure Sora 2 official model
"sora-2-official"string
required
Natural-language description for video generationInclude shot type, subject, action, setting, lighting, and camera motion to reduce ambiguity. Keep it single-purpose for best adherence.Example:
"A golden retriever running on grass, sunny day"integer
default:"4"
Video duration in secondsSupported values:
4- 4 seconds8- 8 seconds12- 12 seconds
4Example: 12string
default:"9:16"
Video aspect ratioSupported formats:
16:9(Landscape, 1280×720)9:16(Portrait, 720×1280)
9:16string[]
Array of reference image URLs for image-to-video generation⚠️ URL format only
- Publicly accessible image URL (http:// or https://)
- You can use the Upload Image API to upload local images and get URLs
- Only the first image will be used as reference
- Supported formats: JPEG, PNG, WebP
- Image size must be 1280×720 (16:9) or 720×1280 (9:16)
Response
string
Unique task identifier for status queries
string
Object type, always
generation.taskstring
Model name used
string
Task status
queued- Queued for processingin_progress- Processingcompleted- Successfully completedfailed- Failed
integer
Task progress percentage (0-100)
integer
Task creation timestamp (Unix timestamp)
object
Task metadata including size and duration
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "sora-2-official",
"prompt": "A golden retriever running on grass, sunny day",
"duration": 12,
"aspect_ratio": "16:9"
}'
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "sora-2-official",
"prompt": "Make this dog come alive, running on grass",
"image_urls": ["https://example.com/dog.jpg"],
"duration": 8,
"aspect_ratio": "16:9"
}'
import requests
response = requests.post(
"https://toapis.com/v1/videos/generations",
headers={
"Authorization": "Bearer your-ToAPIs-key",
"Content-Type": "application/json"
},
json={
"model": "sora-2-official",
"prompt": "A golden retriever running on grass, sunny day",
"duration": 12,
"aspect_ratio": "16:9"
}
)
task = response.json()
print(f"Task ID: {task['id']}")
print(f"Status: {task['status']}")
const response = await fetch('https://toapis.com/v1/videos/generations', {
method: 'POST',
headers: {
'Authorization': 'Bearer your-ToAPIs-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'sora-2-official',
prompt: 'A golden retriever running on grass, sunny day',
duration: 12,
aspect_ratio: '16:9'
})
});
const task = await response.json();
console.log(`Task ID: ${task.id}`);
console.log(`Status: ${task.status}`);
{
"id": "video_01K8SGYNNNVBQTXNR4MM964S7K",
"object": "generation.task",
"model": "sora-2-official",
"status": "queued",
"progress": 0,
"created_at": 1768380224,
"metadata": {
"size": "1280x720",
"seconds": "12"
}
}