Sora Video Generation
Generate videos using OpenAI's Sora API.
API Reference
Endpoint: POST https://api.openai.com/v1/videos
Parameters
| Parameter |
Values |
Description |
prompt |
string |
Text description of the video (required) |
input_reference |
file |
Optional image that guides generation |
model |
sora-2, sora-2-pro |
Model to use (default: sora-2) |
seconds |
4, 8, 12 |
Video duration (default: 4) |
size |
720x1280, 1280x720, 1024x1792, 1792x1024 |
Output resolution |
Important Notes
- Image dimensions must match video size exactly - the script auto-resizes
- Video generation takes 1-3 minutes typically
- Videos expire after ~1 hour - download immediately
Usage
# Basic text-to-video
uv run ~/.clawdbot/skills/sora/scripts/generate_video.py \
--prompt "A cat playing piano" \
--filename "output.mp4"
# Image-to-video (auto-resizes image)
uv run ~/.clawdbot/skills/sora/scripts/generate_video.py \
--prompt "Slow dolly shot, steam rising, warm lighting" \
--filename "output.mp4" \
--input-image "reference.png" \
--seconds 8 \
--size 720x1280
# With specific model
uv run ~/.clawdbot/skills/sora/scripts/generate_video.py \
--prompt "Cinematic scene" \
--filename "output.mp4" \
--model sora-2-pro \
--seconds 12
Script Parameters
| Flag |
Description |
Default |
--prompt, -p |
Video description (required) |
- |
--filename, -f |
Output file path (required) |
- |
--input-image, -i |
Reference image path |
None |
--seconds, -s |
Duration: 4, 8, or 12 |
8 |
--size, -sz |
Resolution |
720x1280 |
--model, -m |
sora-2 or sora-2-pro |
sora-2 |
--api-key, -k |
OpenAI API key |
env var |
--poll-interval |
Check status every N seconds |
10 |
API Key
Set OPENAI_API_KEY environment variable or pass --api-key.
Prompt Engineering for Video
Good prompts include:
- Camera movement: dolly, pan, zoom, tracking shot
- Motion description: swirling, rising, falling, shifting
- Lighting: golden hour, candlelight, dramatic rim lighting
- Atmosphere: steam, particles, bokeh, haze
- Mood/style: cinematic, commercial, lifestyle, editorial
Example prompts:
Food commercial:
Slow dolly shot of gourmet dish, soft morning sunlight streaming through window,
subtle steam rising, warm cozy atmosphere, premium food commercial aesthetic
Lifestyle:
Golden hour light slowly shifting across mountains, gentle breeze rustling leaves,
serene morning atmosphere, premium lifestyle commercial
Product shot:
Cinematic close-up, dramatic lighting with warm highlights,
slow reveal, luxury commercial style
Workflow: Image → Video
- Generate image with Nano Banana Pro (or use existing)
- Pass image as
--input-image to Sora
- Write prompt describing desired motion/atmosphere
- Script auto-resizes image to match video dimensions
Output
- Videos saved as MP4
- Typical file size: 1.5-3MB for 8 seconds
- Resolution matches
--size parameter
1---2name: sora-33description: Generate videos using OpenAI's Sora API. Use when the user asks to generate, create, or make videos from text prompts or reference images. Supports image-to-video generation with automatic resizing.4---56# Sora Video Generation78Generate videos using OpenAI's Sora API.910## API Reference1112**Endpoint:** `POST https://api.openai.com/v1/videos`1314### Parameters1516| Parameter | Values | Description |17|-----------|--------|-------------|18| `prompt` | string | Text description of the video (required) |19| `input_reference` | file | Optional image that guides generation |20| `model` | `sora-2`, `sora-2-pro` | Model to use (default: sora-2) |21| `seconds` | `4`, `8`, `12` | Video duration (default: 4) |22| `size` | `720x1280`, `1280x720`, `1024x1792`, `1792x1024` | Output resolution |2324### Important Notes2526- **Image dimensions must match video size exactly** - the script auto-resizes27- Video generation takes 1-3 minutes typically28- Videos expire after ~1 hour - download immediately2930## Usage3132```bash33# Basic text-to-video34uv run ~/.clawdbot/skills/sora/scripts/generate_video.py \35 --prompt "A cat playing piano" \36 --filename "output.mp4"3738# Image-to-video (auto-resizes image)39uv run ~/.clawdbot/skills/sora/scripts/generate_video.py \40 --prompt "Slow dolly shot, steam rising, warm lighting" \41 --filename "output.mp4" \42 --input-image "reference.png" \43 --seconds 8 \44 --size 720x12804546# With specific model47uv run ~/.clawdbot/skills/sora/scripts/generate_video.py \48 --prompt "Cinematic scene" \49 --filename "output.mp4" \50 --model sora-2-pro \51 --seconds 1252```5354## Script Parameters5556| Flag | Description | Default |57|------|-------------|---------|58| `--prompt`, `-p` | Video description (required) | - |59| `--filename`, `-f` | Output file path (required) | - |60| `--input-image`, `-i` | Reference image path | None |61| `--seconds`, `-s` | Duration: 4, 8, or 12 | 8 |62| `--size`, `-sz` | Resolution | 720x1280 |63| `--model`, `-m` | sora-2 or sora-2-pro | sora-2 |64| `--api-key`, `-k` | OpenAI API key | env var |65| `--poll-interval` | Check status every N seconds | 10 |6667## API Key6869Set `OPENAI_API_KEY` environment variable or pass `--api-key`.7071## Prompt Engineering for Video7273### Good prompts include:74751. **Camera movement**: dolly, pan, zoom, tracking shot762. **Motion description**: swirling, rising, falling, shifting773. **Lighting**: golden hour, candlelight, dramatic rim lighting784. **Atmosphere**: steam, particles, bokeh, haze795. **Mood/style**: cinematic, commercial, lifestyle, editorial8081### Example prompts:8283**Food commercial:**84```85Slow dolly shot of gourmet dish, soft morning sunlight streaming through window, 86subtle steam rising, warm cozy atmosphere, premium food commercial aesthetic87```8889**Lifestyle:**90```91Golden hour light slowly shifting across mountains, gentle breeze rustling leaves, 92serene morning atmosphere, premium lifestyle commercial93```9495**Product shot:**96```97Cinematic close-up, dramatic lighting with warm highlights, 98slow reveal, luxury commercial style99```100101## Workflow: Image → Video1021031. Generate image with Nano Banana Pro (or use existing)1042. Pass image as `--input-image` to Sora1053. Write prompt describing desired motion/atmosphere1064. Script auto-resizes image to match video dimensions107108## Output109110- Videos saved as MP4111- Typical file size: 1.5-3MB for 8 seconds112- Resolution matches `--size` parameter