Skip to main content
Create and edit videos with AI-powered tools for content creation and manipulation. Perfect for content marketing, educational video creation, entertainment production, and training content generation.

Video generation example showing AI-generated videos from text prompts with creative control

Example Usage

For most video-generation examples, you can use the Structured Outputs API to ensure that the returned response can be structured with a valid pre-signed (public) video URL.

Text-to-Video

Generate videos from text descriptions with creative control over style, composition, and motion.
import openai
from pydantic import BaseModel, Field

class VideoGenerationResponse(BaseModel):
  url: str = Field(..., description="The URL of the generated video")

# Initialize the client
client = openai.OpenAI(
    base_url="https://agent.vlm.run/v1/openai",
    api_key="<VLMRUN_API_KEY>"
)

# Generate the video
response = client.chat.completions.create(
    model="vlm-agent-1",
    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()}
)

# Print the response
print(response.choices[0].message.content)
>>> {"url": "https://.../video.mp4"}

# Validate the response
print(VideoGenerationResponse.model_validate_json(response.choices[0].message.content))
>>> VideoGenerationResponse(url="https://.../video.mp4")

FAQ

  • 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
  • Scene Description: Clearly describe the setting, characters, and actions
  • Camera Movement: Specify camera angles, movements, and framing
  • Lighting & Mood: Include lighting conditions and emotional tone
  • Technical Details: Specify resolution, duration, and quality requirements
  • Motion Consistency: Describe desired motion patterns and temporal flow
  • Resolutions: Up to 1080p (1920x1080) for high-quality output
  • Frame Rates: 24fps
  • Formats: MP4
  • Duration: Typically 30-60 seconds for optimal quality and processing time

Try Video Generation

Experience video generation with live examples in our interactive chat interface