Setting the file. One moment.
Subchapter 35.3
references/cli.mdMarkdown3 KBView on GitHub
scripts/text_to_speech.py)This file contains the “command catalog” for the bundled speech generation CLI. Keep SKILL.md as overview-first; put verbose CLI details here.
Also bundled
OpenAIspeak: generate a single audio filespeak-batch: run many jobs from a JSONL file (one job per line)list-voices: list supported voicesReal API calls require network access + OPENAI_API_KEY. --dry-run does not.
Set a stable path to the skill CLI (default CODEX_HOME is ~/.codex):
export CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
export TTS_GEN="$CODEX_HOME/skills/speech/scripts/text_to_speech.py"Dry-run (no API call; no network required; does not require the openai package):
python "$TTS_GEN" speak --input "Test" --dry-runGenerate (requires OPENAI_API_KEY + network):
uv run --with openai python "$TTS_GEN" speak \
--input "Today is a wonderful day to build something people love!" \
--voice cedar \
--instructions "Voice Affect: Warm and composed. Tone: upbeat and encouraging." \
--response-format mp3 \
--out speech.mp3No uv installed? Use your active Python env:
python "$TTS_GEN" speak --input "Hello" --voice cedar --out speech.mp3python "$TTS_GEN" ... (or equivalent full path) for all TTS work.gen_audio.py) unless the user explicitly asks.scripts/text_to_speech.py. If something is missing, ask the user before doing anything else.gpt-4o-mini-tts-2025-12-15cedarmp31.050instructions are supported for GPT-4o mini TTS models.tts-1 and tts-1-hd ignore instructions (the CLI will warn and drop them).List voices:
python "$TTS_GEN" list-voicesGenerate with explicit pacing:
python "$TTS_GEN" speak \
--input "Welcome to the demo. We'll show how it works." \
--instructions "Tone: friendly and confident. Pacing: steady and moderate." \
--out demo.mp3Batch generation (JSONL):
mkdir -p tmp/speech
cat > tmp/speech/jobs.jsonl << 'JSONL'
{"input":"Thank you for calling. Please hold.","voice":"cedar","response_format":"mp3","out":"hold.mp3"}
{"input":"For sales, press 1. For support, press 2.","voice":"marin","instructions":"Tone: clear and neutral. Pacing: slow.","response_format":"wav"}
JSONL
python "$TTS_GEN" speak-batch --input tmp/speech/jobs.jsonl --out-dir out --rpm 50
# Cleanup (recommended)
rm -f tmp/speech/jobs.jsonlNotes:
--rpm to control rate limiting (default 50, max 50).model, voice, response_format, speed, instructions, out).tmp/ and delete it after the run (do not commit it).references/audio-api.mdreferences/voice-directions.md