Documentation Index
Fetch the complete documentation index at: https://docs.oxen.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Generate videos from text descriptions, reference images, or existing videos.
Minimal Example (Synchronous)
Note: Synchronous generation can take 5-15 minutes to complete for certain models, we recommend using the async queue and polling for long-running jobs (See Below).
import requests
response = requests.post(
"https://hub.oxen.ai/api/ai/videos/generate",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "kling-video-v2-6-pro-text-to-video",
"prompt": "A red balloon floating upward through blue sky",
"duration": 5,
},
)
data = response.json()
print("Video URL:", data["videos"][0]["url"])
Async Generation (Recommended)
For video generation, using the async queue avoids long-lived HTTP connections:
import requests
import time
API_KEY = "YOUR_API_KEY"
MODEL = "kling-video-v2-6-pro-text-to-video"
HEADERS = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
}
# 1. Enqueue
response = requests.post(
"https://hub.oxen.ai/api/ai/queue",
headers=HEADERS,
json={
"model": MODEL,
"prompt": "A sunset timelapse over the ocean",
"duration": 5,
},
)
generations = response.json()["generations"]
print(f"Enqueued {len(generations)} generation(s)")
# 2. Poll until done
while True:
status = requests.get(
"https://hub.oxen.ai/api/ai/queue",
headers=HEADERS,
params={"model": MODEL},
).json()
if status["count"] == 0:
break
print(f"Still processing: {status['count']} remaining")
time.sleep(10)
print("Done!")
What’s Next