Skip to content

DocsAPI reference

Videos

POST /v1/videos — create video clips from text with Wan 2.2 on your own GPU as asynchronous jobs, then poll and download them.

HTTP
POST https://osarai.xyz/v1/videos
GET  https://osarai.xyz/v1/videos/{id}
GET  https://osarai.xyz/v1/videos/{id}/content

Video generation takes minutes, so it runs as a job: you create it, poll its status, and download the file when it is done. Deploy one of:

ModelGPUOutput
Wan 2.2 TI2V-5B (wan2.2-ti2v-5b)RTX 5090720p, 5-second clips; good for drafts
Wan 2.2 T2V-A14B (wan2.2-t2v-a14b)RTX PRO 6000480p and 720p, production quality

1. Create a job

Terminal
curl "https://osarai.xyz/v1/videos" \
  -H "Authorization: Bearer $OSARAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan2.2-ti2v-5b",
    "prompt": "Gentle waves rolling onto a sandy beach at sunset, slow camera pan",
    "size": "1280x720",
    "seconds": "5"
  }'
FieldNotes
modelA video model id
promptThe scene and camera movement
size1280x720 (landscape), 720x1280 (portrait) or 832x480 (fastest)
secondsClip length, as a string
JSON
{ "id": "video_7c1e4b2a", "object": "video", "status": "queued", "progress": 0, "model": "wan2.2-ti2v-5b" }

2. Poll the status

Terminal
curl "https://osarai.xyz/v1/videos/video_7c1e4b2a" -H "Authorization: Bearer $OSARAI_API_KEY"

status moves from queued to in_progress (with progress from 0 to 100) and ends as completed or failed. Poll every few seconds.

3. Download

Terminal
curl "https://osarai.xyz/v1/videos/video_7c1e4b2a/content" \
  -H "Authorization: Bearer $OSARAI_API_KEY" \
  --output waves.mp4

The whole flow in Python

Python
import os, time, requests

base = "https://osarai.xyz/v1"
headers = {"Authorization": f"Bearer {os.environ['OSARAI_API_KEY']}"}

job = requests.post(f"{base}/videos", headers=headers, json={
    "model": "wan2.2-ti2v-5b",
    "prompt": "Gentle waves rolling onto a sandy beach at sunset, slow camera pan",
    "size": "1280x720",
    "seconds": "5",
}).json()

while job["status"] not in ("completed", "failed"):
    time.sleep(5)
    job = requests.get(f"{base}/videos/{job['id']}", headers=headers).json()
    print(job["status"], job.get("progress", 0))

if job["status"] == "completed":
    video = requests.get(f"{base}/videos/{job['id']}/content", headers=headers)
    open("waves.mp4", "wb").write(video.content)

Good to know

  • Only the account that created a job can read it; another account's job id answers 404.
  • Videos live on the instance that made them. Download them before you stop the instance: afterwards the job answers 410 Gone.
  • Job ids are remembered for 48 hours.