Videos
Generate videos from text prompts using the video_generate capability
Turn a text prompt into a video with a single function call.
Quick Start
- Generate a video
Omit
modelto use the canonical defaultopenai/sora-2.python from praisonai.capabilities import video_generate result = video_generate("A cat playing with yarn") print(result.url) - Async generation
python import asyncio from praisonai.capabilities import avideo_generate async def main(): result = await avideo_generate("A sunset over the ocean") print(result.url) asyncio.run(main())
How It Works
The prompt is sent to a LiteLLM video route, and a VideoResult is returned with the video URL or job ID.
| Step | What happens |
|---|---|
| Prompt | You describe the video in plain text |
| Route | The model string selects the provider (default openai/sora-2) |
| Result | A VideoResult with url, id, status, and model |
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
prompt | str | Required | Text description of the video |
model | str | "openai/sora-2" | Provider-prefixed LiteLLM route |
duration | int | 5 | Video length in seconds |
aspect_ratio | str | "16:9" | Aspect ratio ("16:9", "9:16", "1:1") |
timeout | float | 600.0 | Request timeout in seconds |
api_key | str | None | Optional API key override |
api_base | str | None | Optional API base URL override |
metadata | dict | None | Optional metadata for tracing |
The VideoResult object exposes url, id, status, model, and metadata.
Common Patterns
Choose a specific model:
from praisonai.capabilities import video_generate
result = video_generate("A city skyline at night", model="openai/sora-2-pro")
print(result.url)Portrait orientation with a longer duration:
from praisonai.capabilities import video_generate
result = video_generate(
"A waterfall in a forest",
duration=10,
aspect_ratio="9:16",
)
print(result.url)Give large videos more time:
from praisonai.capabilities import video_generate
result = video_generate("A slow timelapse of clouds", timeout=1200.0)
print(result.status)Best Practices
Rely on the default model
Omit model to use openai/sora-2, the canonical default shared by every video surface (SDK, capability, MCP, CLI). Only set model when you need a different provider route.
Raise the timeout for long videos
Longer duration values take more time to render. Increase timeout (e.g. 1200.0) to avoid premature timeouts.
Use provider-prefixed routes
Always pass a full LiteLLM route such as openai/sora-2. Bare names like sora are not valid routes and cause routing errors.
Prefer async for batches
Use avideo_generate inside asyncio when generating multiple videos so requests do not block each other.