ai-shorts generates short-form video assets from a single topic prompt. The repo
now exposes a real Python package, validates generated script JSON before any media
step runs, and supports a --dry-run mode that works without an API key.
Dry run is the safest way to validate the pipeline wiring locally. It:
- does not require
OPENAI_API_KEY - does not call OpenAI
- creates placeholder
script.json, image, audio, clip, and final video files - is ideal for CI, smoke tests, and local setup checks
Example:
python3 generate_short.py "ocean currents" --dry-run --output-dir output/demoLive mode requires OPENAI_API_KEY (or OPENAI_API) and uses:
- OpenAI for structured script generation
- OpenAI Images for scene art
gTTSfor narration audioffmpegfor clip assembly and concatenation
Example:
python3 generate_short.py "why stars explode" --output-dir output/live-runai_shorts/script.pyvalidates and normalizes script JSONai_shorts/pipeline.pyorchestrates providers and artifact creationgenerate_short.pyis the CLI entrypointdownload_music.pyremains available for optional future workflow extensions
Every script must contain:
- a non-empty
title - a non-empty
sceneslist - for each scene: non-empty
narration, non-emptyimage_prompt, and positive integerduration
This makes the pipeline fail early with clear errors instead of failing later during audio, image, or video generation.
from ai_shorts.pipeline import DryRunProvider, run_pipeline
from ai_shorts.script import parse_script_json, validate_script
script = parse_script_json('{"title": "Demo", "scenes": [{"narration": "One", "image_prompt": "Prompt", "duration": 4}]}')
result = run_pipeline("demo topic", "output/demo", DryRunProvider())
print(result.final_video_path)python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtpython3 -m pytest -qMIT. See LICENSE.