Text prompt to video
Example Usage
Use the Structured Outputs API for structured, validated responses.
Text-to-Video
from vlmrun.client import VLMRun
# Initialize the VLMRun client
client = VLMRun(api_key="<VLMRUN_API_KEY>")
# Generate the video
response = client.agent.completions.create(
model="vlmrun-orion-1:auto",
messages=[
{
"role": "user",
"content": "Generate a video of a serene mountain landscape with flowing clouds, cinematic wide shot, golden hour lighting, 4K, 20 seconds"
}
]
)
print(response.choices[0].message.content)
# >>> {"url": "https://.../video.mp4"}
from vlmrun.client import VLMRun
from pydantic import BaseModel, Field
# Define the response schema
class VideoGenerationResponse(BaseModel):
url: str = Field(..., description="The URL of the generated video")
# Initialize the VLMRun client
client = VLMRun(api_key="<VLMRUN_API_KEY>")
# Generate the video with structured output
response = client.agent.completions.create(
model="vlmrun-orion-1:auto",
messages=[
{
"role": "user",
"content": "Generate a video of a serene mountain landscape with flowing clouds, cinematic wide shot, golden hour lighting, 4K, 20 seconds"
}
],
response_format={"type": "json_schema", "schema": VideoGenerationResponse.model_json_schema()}
)
# Validate the response
result = VideoGenerationResponse.model_validate_json(response.choices[0].message.content)
# >>> VideoGenerationResponse(url="https://.../video.mp4")
import { VlmRun } from "vlmrun";
const client = new VlmRun({
apiKey: "<VLMRUN_API_KEY>",
baseURL: "https://api.vlm.run/v1"
});
const response = await client.agent.completions.create({
model: "vlmrun-orion-1:auto",
messages: [
{
role: "user",
content: "Generate a video of a serene mountain landscape with flowing clouds, cinematic wide shot, golden hour lighting, 4K, 20 seconds"
}
]
});
console.log(response.choices[0].message.content);
import { VlmRun } from "vlmrun";
import { z } from "zod";
import { zodToJsonSchema } from "zod-to-json-schema";
// Define the response schema with Zod
const VideoGenerationResponseSchema = z.object({
url: z.string().describe("The URL of the generated video")
});
// Initialize the VLMRun client
const client = new VlmRun({
apiKey: "<VLMRUN_API_KEY>",
baseURL: "https://api.vlm.run/v1"
});
// Generate the video with structured output
const response = await client.agent.completions.create({
model: "vlmrun-orion-1:auto",
messages: [
{
role: "user",
content: "Generate a video of a serene mountain landscape with flowing clouds, cinematic wide shot, golden hour lighting, 4K, 20 seconds"
}
],
response_format: {
type: "json_schema",
schema: zodToJsonSchema(VideoGenerationResponseSchema)
}
});
const result = VideoGenerationResponseSchema.parse(JSON.parse(response.choices[0].message.content));
FAQ
What video styles are supported for generation?
What video styles are supported for generation?
| Style | Look |
|---|---|
| Cinematic | High-end film quality with dramatic lighting and professional camera work |
| Realistic | Ultra-realistic videos with natural motion and fine details |
| Artistic | Watercolor, oil painting, sketch, and digital art styles |
| Creative | Cyberpunk, fantasy, abstract, and minimalist designs |
What are some tips for creating effective video prompts?
What are some tips for creating effective video prompts?
| Include | Specify |
|---|---|
| Scene | Setting, characters, and actions |
| Camera | Angles, movements, and framing |
| Lighting and mood | Lighting conditions and emotional tone |
| Technical | Resolution, duration, and quality |
| Motion | Motion patterns and temporal flow |
What video formats and resolutions are supported?
What video formats and resolutions are supported?
| Setting | Value |
|---|---|
| Resolution | Up to 1080p (1920x1080) |
| Frame rate | 24fps |
| Format | MP4 |
| Duration | Typically 30-60 seconds |
Try Video Generation
Run a text prompt in chat.