Video Generation
Generate videos from text prompts or images.
Endpoint
POST /v1/videos/generationsRequest
{
"model": "model-id",
"prompt": "A drone flyover of a tropical beach at golden hour",
"duration": 5,
"resolution": "1080p"
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Video model ID |
prompt | string | Yes | Text description |
duration | integer | No | Video duration in seconds |
resolution | string | No | Output resolution |
fps | integer | No | Frames per second |
Response
Video generation is typically asynchronous. The API returns a task ID:
{
"id": "video_abc123",
"status": "processing",
"created_at": 1709251200
}Check Status
GET /v1/videos/generations/{id}{
"id": "video_abc123",
"status": "completed",
"video_url": "https://api.yuhuanstudio.com/v1/temp-images/video_abc123.mp4"
}Available Models
For a list of available video models and their capabilities, please use the Models API with GET /v1/models?type=video_generation.
Example
import httpx
import time
# Submit generation request
response = httpx.post(
"https://api.yuhuanstudio.com/v1/videos/generations",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"model": "model-id",
"prompt": "Ocean waves crashing on a rocky shore, cinematic",
"duration": 5
}
)
task = response.json()
task_id = task["id"]
# Poll for completion
while True:
status = httpx.get(
f"https://api.yuhuanstudio.com/v1/videos/generations/{task_id}",
headers={"Authorization": "Bearer YOUR_API_KEY"}
).json()
if status["status"] == "completed":
print(f"Video ready: {status['video_url']}")
break
elif status["status"] == "failed":
print(f"Generation failed: {status.get('error')}")
break
time.sleep(5)Video generation availability depends on your subscribed providers. Check the Dashboard for available video models.
How is this guide?