/videos
| Feature | Supported |
|---|---|
| Cost Tracking | ✅ |
| Logging | ✅ |
| Fallbacks | ✅ |
| Load Balancing | ✅ |
| Supported Providers | openai, azure, gemini, vertex_ai, runwayml |
tip
haimaker follows the OpenAI Video Generation API specification
Quick Start
Python
from openai import OpenAI
import time
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.haimaker.ai/v1"
)
# Generate video
response = client.videos.create(
model="openai/sora-2",
prompt="A cat playing with a ball of yarn in a sunny garden",
seconds=8,
size="720x1280"
)
print(f"Video ID: {response.id}")
print(f"Status: {response.status}")
# Poll for completion
while response.status not in ["completed", "failed"]:
time.sleep(10)
response = client.videos.retrieve(video_id=response.id)
print(f"Current status: {response.status}")
# Download video when complete
if response.status == "completed":
video_content = client.videos.download_content(video_id=response.id)
with open("generated_video.mp4", "wb") as f:
f.write(video_content.content)
print("Video saved!")
cURL
Generate video:
curl https://api.haimaker.ai/v1/videos \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "openai/sora-2",
"prompt": "A beautiful sunset over the ocean",
"seconds": "8",
"size": "720x1280"
}'
Check video status:
curl https://api.haimaker.ai/v1/videos/{video_id} \
-H "Authorization: Bearer YOUR_API_KEY"
Download video:
curl https://api.haimaker.ai/v1/videos/{video_id}/content \
-H "Authorization: Bearer YOUR_API_KEY" \
--output video.mp4
Video Generation with Reference Image
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.haimaker.ai/v1"
)
response = client.videos.create(
model="openai/sora-2",
prompt="Add clouds to the video",
seconds=4,
input_reference=open("/path/to/your/image.jpg", "rb")
)
print(f"Video ID: {response.id}")
print(f"Status: {response.status}")
Video Remix (Editing)
Edit an existing video with new instructions:
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.haimaker.ai/v1"
)
response = client.videos.remix(
video_id="video_68fa2574bdd88190873a8af06a370ff407094ddbc4bbb91b",
prompt="Slow the cloud movement",
seconds=8
)
print(f"Remix Video ID: {response.id}")
print(f"Status: {response.status}")
List Videos
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.haimaker.ai/v1"
)
videos = client.videos.list()
for video in videos.data:
print(f"Video ID: {video.id}, Status: {video.status}")
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The video generation model to use (e.g., "openai/sora-2") |
prompt | string | Yes | Text description of the desired video |
seconds | string | No | Video duration in seconds (e.g., "8", "16") |
size | string | No | Video dimensions (e.g., "720x1280", "1280x720") |
input_reference | file | No | Reference image for video generation |
user | string | No | User identifier for tracking |
Response Format
{
"id": "video_6900378779308191a7359266e59b53fc01cd6bbd27a70763",
"object": "video",
"status": "queued",
"created_at": 1761621895,
"completed_at": null,
"expires_at": null,
"error": null,
"progress": 0,
"seconds": "4",
"size": "720x1280",
"model": "sora-2",
"usage": {
"duration_seconds": 4.0
}
}
Supported Providers
| Provider | Documentation Link |
|---|---|
| OpenAI | Usage |
| Azure | Usage |
| Gemini | Usage |
| Vertex AI | Usage |
| RunwayML | Usage |