Generate video advertisements from product pages using Claude Agent SDK and AI video generation APIs.
Examples of AI-generated video advertisements (click to play):
|
Apple Vision Pro |
Pioneer DDJ-XP2 |
Patagonia R1 Fleece |
|
Hermes Scarf |
Sony Alpha 7 V |
BMW i8 |
View all generated videos at the Video Showcase when running locally.
This tool takes a product detail page URL as input and automatically:
- Extracts product metadata (title, description, images, price, brand)
- Uses Claude to craft a compelling ad script and video prompt
- Generates a short video advertisement using AI video generation
| Provider | Model | Cost (5-sec) | Via |
|---|---|---|---|
| Kie.ai | Veo 3 Fast | ~$0.40 | Default |
| Kie.ai | Veo 3 Quality | ~$2.00 | --veo3-quality flag |
| FreePik | WAN 2.6 | ~$0.50 | --freepik flag |
- Python 3.10+
- Claude Code CLI (for authentication)
- Kie.ai API key (for Veo 3 - default model)
- FreePik API key (optional, for
--freepikflag)
- Clone the repository:
git clone <repo-url>
cd agentic-orchestration- Create and activate a virtual environment:
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate- Install dependencies:
pip install -e .- Set up environment variables:
cp .env.example .env
# Edit .env and add your API keys- Authenticate Claude Code (if not already):
claude
# Follow the prompts to authenticateStart the web server to use the browser-based interface:
ad-generator-serverThis starts a FastAPI server at http://localhost:8000 with:
- Web UI for submitting product URLs and tracking progress
- REST API at
/api/generate,/api/status/{job_id},/api/jobs - Video showcase at
/video-showcase.html
# Basic usage (Veo 3 Fast - default, 5s video)
ad-generator "https://example.com/product/123"
# With Veo 3 Quality (higher quality, slower, more expensive)
ad-generator "https://example.com/product/123" --veo3-quality
# Also generate with FreePik WAN 2.6
ad-generator "https://example.com/product/123" --freepik
# Specify duration (5, 8, 10, or 15 seconds)
ad-generator "https://example.com/product/123" -d 10
# Specify output directory
ad-generator "https://example.com/product/123" --output ./my-ads
# Force regeneration (skip duplicate check)
ad-generator "https://example.com/product/123" --forceEach generation creates a timestamped directory with the product name:
output/
└── macbook-air-13-inch-m4-2025-20260116-132438/
├── README.md # Generation details and prompt
├── freepik_<task-id>.mp4 # FreePik WAN 2.6 video
└── veo3_<task-id>.mp4 # Veo 3 video (if --veo3)
The README.md contains:
- Input product URL
- Product information
- Video generation prompt
- Links to generated videos
The tool automatically detects if a video has already been generated for a URL by scanning existing README.md files. Use --force to regenerate.
| Variable | Required | Description |
|---|---|---|
KIE_API_KEY |
Yes | Kie.ai API key for Veo 3 (default model) |
ANTHROPIC_API_KEY |
No | Anthropic API key (optional if using Claude Code auth) |
FREEPIK_API_KEY |
For --freepik | FreePik API key for WAN 2.6 |
src/ad_generator/
├── __init__.py
├── main.py # CLI entry point
├── agent.py # Claude Agent orchestration
├── metadata_extractor.py # Product page scraping
├── freepik_client.py # FreePik API client
├── kie_client.py # Kie.ai API client (Veo 3)
└── models.py # Pydantic data models
-
Metadata Extraction: Fetches the product page and extracts structured data using:
- JSON-LD (schema.org Product)
- Open Graph meta tags
- Standard HTML elements
-
Claude Agent: An AI agent analyzes the product and creates:
- Ad concept and script
- Optimized video generation prompt
-
Video Generation: The prompt is sent to configured video generation APIs
Install dev dependencies:
pip install -e ".[dev]"Run tests:
pytestFor production deployment to Vercel, see VERCEL.md for step-by-step instructions including:
- Vercel account setup
- Environment variable configuration
- Deployment process
- Testing and troubleshooting



