SET ANTHROPIC_API_KEY FIRST
Compose calls Claude Haiku to formalize your script into a
project YAML. The console reads ANTHROPIC_API_KEY from your
environment at server start. Set it and restart STUDIO.bat
(or python -m studio.console):
set ANTHROPIC_API_KEY=sk-ant-...
The key is server-side only; never returned to the browser.
COMPOSE A NEW PROJECT
Pick a video type, pick characters, pick a scene, set style and
intensity, type or paste a script. One Haiku call (~$0.0015 cached)
formalizes it into a project YAML and writes it to tv/studio/projects/.
From there, render via the dashboard.
HOW IT WORKS
- Validate inputs — preset / scene / style / cast / intensity / length all checked against allowlists server-side.
- Build prompt — stable cast roster + scene catalog + preset structure cached via prompt caching (
cache_control: ephemeral). Volatile script appended after. Repeat calls re-price only the script delta. - Single Haiku call —
claude-haiku-4-5, structured output viaoutput_config.formatwith a JSON schema. Haiku returns a segment list with speakers, emotions, camera moves, scene names. - Validate response — every segment's enum values (speaker, emotion, scene, camera_move) checked against the same allowlists.
- Write YAML — to
tv/studio/projects/_compose_<slug>.project.yaml. Path-traversal-safe. - Render — go back to the dashboard and click Render on the new project.
Total cost per video: ~$0.0015 with cache hit, ~$0.015 cold start.
See studio/console/compose.py for the full implementation.