Generate videos using OpenAI Sora models with evaluation
A promptfoo example comparing OpenAI's Sora-2 and Sora-2 Pro video generation models.
Why it matters
Enable developers to generate AI videos using OpenAI's Sora models while systematically evaluating and comparing output quality, cost, and performance across different model variants through automated testing workflows.
Outcomes
What it gets done
Compare video generation quality between sora-2 and sora-2-pro models
Configure video parameters including dimensions, duration, and polling intervals
Cache generated videos based on prompt and model parameters to avoid regeneration
View and playback generated videos with metadata in an integrated web interface
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/pfoo-openai-video | bash Steps
Steps in the chain
Overview
Openai Video
A promptfoo example comparing OpenAI's Sora-2 and Sora-2 Pro video generation models on quality, cost, and generation parameters. Use it to compare Sora model quality and cost. Video generation takes 1-5 minutes per video and results are cached by request parameters.
What it does
This promptfoo example evaluates OpenAI's Sora video generation models, comparing sora-2 (standard quality, $0.10/second) against sora-2-pro (higher quality output, $0.30/second). Generated videos are stored in promptfoo's media storage at ~/.promptfoo/media/ and displayed in the web viewer with playback controls, thumbnail, and spritesheet preview support.
When to use - and when NOT to
Use this example when you want to compare Sora model output quality and cost for a given prompt, or tune generation parameters like resolution and duration. Video generation is slow - expect 1 to 5 minutes per video - so this isn't suited to fast iteration; promptfoo caches results by request parameters (prompt, model, size, seconds) so re-running with the same inputs doesn't regenerate the video.
Inputs and outputs
Configurable parameters include size (1280x720 or 720x1280, default 1280x720), seconds (4, 8, or 12, default 8), poll_interval_ms (default 10000) and max_poll_time_ms (default 600000) for controlling how generation status is polled, and download_thumbnail/download_spritesheet (both default true) for preview assets:
npx promptfoo@latest init --example openai-video
cd openai-video
export OPENAI_API_KEY=your_api_key_here
npx promptfoo@latest eval
npx promptfoo@latest view
Integrations
Set OPENAI_API_KEY before running. The web viewer plays generated videos directly with metadata display, so comparing sora-2 and sora-2-pro outputs side by side doesn't require downloading files separately.
Who it's for
Teams evaluating OpenAI's Sora video models for quality, cost, and generation-time trade-offs before choosing one for a production video-generation workflow.
Source README
openai-video (OpenAI Sora Video Generation)
This example demonstrates how to use OpenAI's Sora video generation models with Promptfoo.
Setup
Initialize this example:
npx promptfoo@latest init --example openai-video
cd openai-video
Set your OpenAI API key:
export OPENAI_API_KEY=your_api_key_here
Usage
Run the evaluation:
npx promptfoo@latest eval
View results in the web UI:
npx promptfoo@latest view
Models
This example compares two Sora models:
| Model | Description | Cost |
|---|---|---|
| sora-2 | Standard quality | $0.10/second |
| sora-2-pro | Higher quality output | $0.30/second |
Configuration Options
| Parameter | Description | Default |
|---|---|---|
size |
Video dimensions (1280x720 or 720x1280) | 1280x720 |
seconds |
Duration in seconds (4, 8, or 12) | 8 |
poll_interval_ms |
Polling interval for job status | 10000 |
max_poll_time_ms |
Maximum wait time for generation | 600000 |
download_thumbnail |
Download thumbnail preview | true |
download_spritesheet |
Download spritesheet preview | true |
Output
Generated videos are stored in the promptfoo media storage (~/.promptfoo/media/) and displayed in the web viewer with playback controls.
Notes
- Video generation can take 1-5 minutes per video
- Videos are cached based on request parameters (prompt, model, size, seconds) to avoid regeneration
- The web viewer supports video playback with controls and metadata display
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.