/v1/videos). You can use the official OpenAI SDK (openai in Python or Node.js) directly by configuring base_url to the Neosantara gateway.
from openai import OpenAI
import time
import os
client = OpenAI(
base_url="https://api.neosantara.xyz/v1",
api_key=os.environ["NEOSANTARA_API_KEY"]
)
# 1. Dispatch video creation job (OpenAI Sora Compatible)
video = client.videos.create(
model="luma-ray2-720p",
prompt="Drone sweep over Uluwatu coastal waves at golden hour, cinematic slow motion.",
seconds=5,
size="1280x720"
)
print(f"Video job created: {video.id}")
# 2. Poll job status until completion
while True:
job = client.videos.retrieve(video.id)
progress = getattr(job, "progress", 0)
print(f"Status: {job.status} ({progress}%)")
if job.status == "completed":
print(f"Video ready! Download URL: https://api.neosantara.xyz/v1/videos/{video.id}/content")
break
elif job.status == "failed":
print("Failed:", getattr(job, "error", "Unknown error"))
break
time.sleep(10)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.neosantara.xyz/v1",
apiKey: process.env.NEOSANTARA_API_KEY,
});
// 1. Dispatch video job
const video = await client.videos.create({
model: "luma-ray2-720p",
prompt: "Drone sweep over Uluwatu coastal waves at golden hour, cinematic slow motion.",
seconds: 5,
size: "1280x720",
});
console.log("Job Created:", video.id);
// 2. Poll completion status
let status = video.status;
while (status !== "completed" && status !== "failed") {
await new Promise((resolve) => setTimeout(resolve, 10000));
const job = await client.videos.retrieve(video.id);
status = job.status;
console.log(`Status: ${status}`);
}
if (status === "completed") {
console.log(`Video URL: https://api.neosantara.xyz/v1/videos/${video.id}/content`);
}
# 1. Create video job
curl -X POST https://api.neosantara.xyz/v1/videos \
-H "Authorization: Bearer $NEOSANTARA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "luma-ray2-720p",
"prompt": "Drone sweep over Uluwatu coastal waves at golden hour.",
"seconds": 5,
"size": "1280x720"
}'
# 2. Poll job status
curl https://api.neosantara.xyz/v1/videos/vid_123456 \
-H "Authorization: Bearer $NEOSANTARA_API_KEY"
# 3. Download final video content
curl -L https://api.neosantara.xyz/v1/videos/vid_123456/content \
-H "Authorization: Bearer $NEOSANTARA_API_KEY" \
-o generated_video.mp4
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Description of the scene, camera movement, and lighting. |
model | string | Yes | luma-ray2-720p or luma-ray2-540p. |
seconds | integer | Optional | Video clip duration in seconds (e.g. 5 or 9). Default 5. |
size | string | Optional | Output resolution: "1280x720" or "960x540". |
Video Job Status Lifecycle
| Status | Description |
|---|---|
queued | Request received and enqueued in upstream rendering workers. |
in_progress | Video generation actively rendering with 0-99% progress. |
completed | Generation finished. Media download URL is available. |
failed | Video generation failed. No balance is deducted or credits are refunded automatically. |