Script Generation
Script generation is a two-phase AI process: first it creates hook options (opening lines), then writes a full voiceover script based on the selected hook.
What It Does
Given a draft topic, the system generates multiple hook options (attention-grabbing opening lines) and then writes a complete voiceover script. The script is calibrated to a target duration based on speaking pace, and structured to work specifically for short-form vertical video.
How It Works
Phase 1: Hook Generation
The AI generates 3 hook options for each topic (configurable via hooks_per_topic setting).
- Model: GPT-4o-mini
- Temperature: 0.9 (high creativity for varied hooks)
- Rules: Under 15 words, triggers curiosity or emotion, works as the first thing someone sees while scrolling, no emoji, no clickbait that cannot be delivered on
Phase 2: Script Writing
The first hook is selected and a full voiceover script is generated.
- Model: GPT-4o-mini
- Temperature: 0.8 (balanced creativity)
- Word count: Calibrated to target duration multiplied by words-per-second (default: 30s at 2.5 wps = 75 words)
- Structure: Opens with the hook exactly as provided, delivers on the promise in 3-4 sentences, ends with a soft CTA
Niche Config Integration
If trend analysis has generated a niche config, the script generator uses it to inform:
- Target duration and speaking pace (WPM)
- Emotional tone (educational, shocking, funny, inspirational)
- CTA type and placement (subscribe, comment, like)
- Hook style preferences based on what performs best in the niche
Prompt Templates
Scripts are generated using customizable prompt templates stored in the prompt_templates table:
| Purpose | What It Controls |
|---|---|
hook_gen | How hooks are generated — tone, style, rules per channel |
script_gen | How scripts are written — structure, CTA, word count |
topic_filter | How topics are selected from raw sources |
Each template supports variables that are filled in at generation time:
| Variable | Description |
|---|---|
{topic} | The source headline or topic text |
{hook} | The selected hook (used in script_gen) |
{count} | Number of hooks to generate |
{duration} | Target video duration in seconds |
{word_count} | Target word count for the script |
{source_context} | Additional context from the source |
Where to Find It
- Dashboard: Channel Settings, Script tab — edit prompt templates and preview generation
- Trigger: Pipeline page, “Generate Scripts” button
- API:
POST /pipeline/generate-scripts
Configuration
| Setting | Default | Description |
|---|---|---|
hooks_per_topic | 3 | Number of hook options generated per topic |
DEFAULT_VIDEO_DURATION | 30 | Target video length in seconds |
WORDS_PER_SECOND | 2.5 | Speaking pace used to calculate word count |
Dependencies
OPENAI_API_KEY— Required for both hook generation and script writing