Speech skill

Use when the user asks for text-to-speech narration or voiceover, accessibility reads, audio prompts, or batch speech generation.

by davila7·MIT license·★ 32,299 Stars on the repo·GitHub ↗

Use now

Files of Speech

davila7/main1 file shown
SKILL.md
Show the full text154 lines

Speech Generation Skill

Generate spoken audio for the current project (narration, product demo voiceover, IVR prompts, accessibility reads). OpenAI remains the default with gpt-4o-mini-tts-2025-12-15; Atlas Cloud is available only when the user explicitly selects it. Prefer the bundled CLIs for deterministic, reproducible runs.

When to use

  • Generate a single spoken clip from text
  • Generate a batch of prompts (many lines, many files)

Decision tree (single vs batch)

  • If the user provides multiple lines/prompts or wants many outputs -> batch
  • Else -> single

Workflow

  1. Decide intent: single vs batch (see decision tree above).
  2. Collect inputs up front: exact text (verbatim), desired voice, delivery style, format, and any constraints.
  3. If batch: write a temporary JSONL under tmp/ (one job per line), run once, then delete the JSONL.
  4. Augment instructions into a short labeled spec without rewriting the input text.
  5. Run scripts/text_to_speech.py for the default OpenAI path, or scripts/atlas_text_to_speech.py only when Atlas Cloud was selected (see references/cli.md).
  6. For important clips, validate: intelligibility, pacing, pronunciation, and adherence to constraints.
  7. Iterate with a single targeted change (voice, speed, or instructions), then re-check.
  8. Save/return final outputs and note the final text + instructions + flags used.

Temp and output conventions

  • Use tmp/speech/ for intermediate files (for example JSONL batches); delete when done.
  • Write final artifacts under output/speech/ when working in this repo.
  • Use --out or --out-dir to control output paths; keep filenames stable and descriptive.

Dependencies (install if missing)

Prefer uv for dependency management.

OpenAI backend package:

uv pip install openai

If uv is unavailable:

python3 -m pip install openai

The Atlas Cloud backend uses only the Python standard library.

Environment

  • Default OpenAI calls require OPENAI_API_KEY.
  • Optional Atlas Cloud calls require ATLASCLOUD_API_KEY.

If the selected provider key is missing, give the user these steps:

  1. Create an API key in that provider's console.
  2. Set OPENAI_API_KEY or ATLASCLOUD_API_KEY as an environment variable in their system.
  3. Offer to guide them through setting the environment variable for their OS/shell if needed.
  • Keep provider credentials out of chat. Direct the user to set the selected key locally and confirm when ready.

If installation isn't possible in this environment, tell the user which dependency is missing and how to install it locally.

Defaults & rules

  • Keep OpenAI as the default provider. Do not switch to Atlas Cloud unless the user requests it.
  • Use gpt-4o-mini-tts-2025-12-15 unless the user requests another model.
  • Default voice: cedar. If the user wants a brighter tone, prefer marin.
  • Built-in voices only. Custom voices are out of scope for this skill.
  • instructions are supported for GPT-4o mini TTS models, but not for tts-1 or tts-1-hd.
  • Input length must be <= 4096 characters per request. Split longer text into chunks.
  • Enforce 50 requests/minute. The CLI caps --rpm at 50.
  • Require OPENAI_API_KEY before any live API call.
  • For Atlas Cloud, default to xai/tts-v1, voice eve, language auto, and require ATLASCLOUD_API_KEY.
  • Atlas generation submits exactly one POST. Only prediction GET requests may retry, and polling must stay finite.
  • Download Atlas outputs without an Authorization header and reject non-HTTPS or private-network targets.
  • Provide a clear disclosure to end users that the voice is AI-generated.
  • Use the OpenAI Python SDK (openai package) for default OpenAI calls; the dedicated Atlas CLI uses its asynchronous HTTP contract.
  • Prefer the matching bundled CLI over writing new one-off scripts.

Instruction augmentation

Reformat user direction into a short, labeled spec. Only make implicit details explicit; do not invent new requirements.

Quick clarification (augmentation vs invention):

  • If the user says "narration for a demo", you may add implied delivery constraints (clear, steady pacing, friendly tone).
  • Do not introduce a new persona, accent, or emotional style the user did not request.

Template (include only relevant lines):

Voice Affect: <overall character and texture of the voice>
Tone: <attitude, formality, warmth>
Pacing: <slow, steady, brisk>
Emotion: <key emotions to convey>
Pronunciation: <words to enunciate or emphasize>
Pauses: <where to add intentional pauses>
Emphasis: <key words or phrases to stress>
Delivery: <cadence or rhythm notes>

Augmentation rules:

  • Keep it short; add only details the user already implied or provided elsewhere.
  • Do not rewrite the input text.
  • If any critical detail is missing and blocks success, ask a question; otherwise proceed.

Examples

Single example (narration)
Input text: "Welcome to the demo. Today we'll show how it works."
Instructions:
Voice Affect: Warm and composed.
Tone: Friendly and confident.
Pacing: Steady and moderate.
Emphasis: Stress "demo" and "show".
Batch example (IVR prompts)
{"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"}

Instructioning best practices (short list)

  • Structure directions as: affect -> tone -> pacing -> emotion -> pronunciation/pauses -> emphasis.
  • Keep 4 to 8 short lines; avoid conflicting guidance.
  • For names/acronyms, add pronunciation hints (e.g., "enunciate A-I") or supply a phonetic spelling in the text.
  • For edits/iterations, repeat invariants (e.g., "keep pacing steady") to reduce drift.
  • Iterate with single-change follow-ups.

More principles: references/prompting.md. Copy/paste specs: references/sample-prompts.md.

Guidance by use case

Use these modules when the request is for a specific delivery style. They provide targeted defaults and templates.

  • Narration / explainer: references/narration.md
  • Product demo / voiceover: references/voiceover.md
  • IVR / phone prompts: references/ivr.md
  • Accessibility reads: references/accessibility.md

CLI + environment notes

  • CLI commands + examples: references/cli.md
  • API parameter quick reference: references/audio-api.md
  • Atlas Cloud asynchronous workflow and safeguards: references/atlas-cloud.md
  • Instruction patterns + examples: references/voice-directions.md
  • If network approvals / sandbox settings are getting in the way: references/codex-network.md

Reference map

  • references/cli.md: how to run speech generation/batches via scripts/text_to_speech.py (commands, flags, recipes).
  • references/audio-api.md: API parameters, limits, voice list.
  • references/atlas-cloud.md: optional Atlas Cloud model, CLI, polling, and download contract.
  • references/voice-directions.md: instruction patterns and examples.
  • references/prompting.md: instruction best practices (structure, constraints, iteration patterns).
  • references/sample-prompts.md: copy/paste instruction recipes (examples only; no extra theory).
  • references/narration.md: templates + defaults for narration and explainers.
  • references/voiceover.md: templates + defaults for product demo voiceovers.
  • references/ivr.md: templates + defaults for IVR/phone prompts.
  • references/accessibility.md: templates + defaults for accessibility reads.
  • references/codex-network.md: environment/sandbox/network-approval troubleshooting.
1---
2name: "speech"
3description: "Use when the user asks for text-to-speech narration or voiceover, accessibility reads, audio prompts, or batch speech generation. OpenAI remains the default; Atlas Cloud is an explicit optional backend for asynchronous multilingual speech. Custom voice creation is out of scope."
4author: openai
5---
6 
7 
8# Speech Generation Skill
9 
10Generate spoken audio for the current project (narration, product demo voiceover, IVR prompts, accessibility reads). OpenAI remains the default with `gpt-4o-mini-tts-2025-12-15`; Atlas Cloud is available only when the user explicitly selects it. Prefer the bundled CLIs for deterministic, reproducible runs.
11 
12## When to use
13- Generate a single spoken clip from text
14- Generate a batch of prompts (many lines, many files)
15 
16## Decision tree (single vs batch)
17- If the user provides multiple lines/prompts or wants many outputs -> **batch**
18- Else -> **single**
19 
20## Workflow
211. Decide intent: single vs batch (see decision tree above).
222. Collect inputs up front: exact text (verbatim), desired voice, delivery style, format, and any constraints.
233. If batch: write a temporary JSONL under tmp/ (one job per line), run once, then delete the JSONL.
244. Augment instructions into a short labeled spec without rewriting the input text.
255. Run `scripts/text_to_speech.py` for the default OpenAI path, or `scripts/atlas_text_to_speech.py` only when Atlas Cloud was selected (see `references/cli.md`).
266. For important clips, validate: intelligibility, pacing, pronunciation, and adherence to constraints.
277. Iterate with a single targeted change (voice, speed, or instructions), then re-check.
288. Save/return final outputs and note the final text + instructions + flags used.
29 
30## Temp and output conventions
31- Use `tmp/speech/` for intermediate files (for example JSONL batches); delete when done.
32- Write final artifacts under `output/speech/` when working in this repo.
33- Use `--out` or `--out-dir` to control output paths; keep filenames stable and descriptive.
34 
35## Dependencies (install if missing)
36Prefer `uv` for dependency management.
37 
38OpenAI backend package:
39```
40uv pip install openai
41```
42If `uv` is unavailable:
43```
44python3 -m pip install openai
45```
46 
47The Atlas Cloud backend uses only the Python standard library.
48 
49## Environment
50- Default OpenAI calls require `OPENAI_API_KEY`.
51- Optional Atlas Cloud calls require `ATLASCLOUD_API_KEY`.
52 
53If the selected provider key is missing, give the user these steps:
541. Create an API key in that provider's console.
552. Set `OPENAI_API_KEY` or `ATLASCLOUD_API_KEY` as an environment variable in their system.
563. Offer to guide them through setting the environment variable for their OS/shell if needed.
57- Keep provider credentials out of chat. Direct the user to set the selected key locally and confirm when ready.
58 
59If installation isn't possible in this environment, tell the user which dependency is missing and how to install it locally.
60 
61## Defaults & rules
62- Keep OpenAI as the default provider. Do not switch to Atlas Cloud unless the user requests it.
63- Use `gpt-4o-mini-tts-2025-12-15` unless the user requests another model.
64- Default voice: `cedar`. If the user wants a brighter tone, prefer `marin`.
65- Built-in voices only. Custom voices are out of scope for this skill.
66- `instructions` are supported for GPT-4o mini TTS models, but not for `tts-1` or `tts-1-hd`.
67- Input length must be <= 4096 characters per request. Split longer text into chunks.
68- Enforce 50 requests/minute. The CLI caps `--rpm` at 50.
69- Require `OPENAI_API_KEY` before any live API call.
70- For Atlas Cloud, default to `xai/tts-v1`, voice `eve`, language `auto`, and require `ATLASCLOUD_API_KEY`.
71- Atlas generation submits exactly one POST. Only prediction GET requests may retry, and polling must stay finite.
72- Download Atlas outputs without an Authorization header and reject non-HTTPS or private-network targets.
73- Provide a clear disclosure to end users that the voice is AI-generated.
74- Use the OpenAI Python SDK (`openai` package) for default OpenAI calls; the dedicated Atlas CLI uses its asynchronous HTTP contract.
75- Prefer the matching bundled CLI over writing new one-off scripts.
76 
77## Instruction augmentation
78Reformat user direction into a short, labeled spec. Only make implicit details explicit; do not invent new requirements.
79 
80Quick clarification (augmentation vs invention):
81- If the user says "narration for a demo", you may add implied delivery constraints (clear, steady pacing, friendly tone).
82- Do not introduce a new persona, accent, or emotional style the user did not request.
83 
84Template (include only relevant lines):
85```
86Voice Affect: <overall character and texture of the voice>
87Tone: <attitude, formality, warmth>
88Pacing: <slow, steady, brisk>
89Emotion: <key emotions to convey>
90Pronunciation: <words to enunciate or emphasize>
91Pauses: <where to add intentional pauses>
92Emphasis: <key words or phrases to stress>
93Delivery: <cadence or rhythm notes>
94```
95 
96Augmentation rules:
97- Keep it short; add only details the user already implied or provided elsewhere.
98- Do not rewrite the input text.
99- If any critical detail is missing and blocks success, ask a question; otherwise proceed.
100 
101## Examples
102 
103### Single example (narration)
104```
105Input text: "Welcome to the demo. Today we'll show how it works."
106Instructions:
107Voice Affect: Warm and composed.
108Tone: Friendly and confident.
109Pacing: Steady and moderate.
110Emphasis: Stress "demo" and "show".
111```
112 
113### Batch example (IVR prompts)
114```
115{"input":"Thank you for calling. Please hold.","voice":"cedar","response_format":"mp3","out":"hold.mp3"}
116{"input":"For sales, press 1. For support, press 2.","voice":"marin","instructions":"Tone: Clear and neutral. Pacing: Slow.","response_format":"wav"}
117```
118 
119## Instructioning best practices (short list)
120- Structure directions as: affect -> tone -> pacing -> emotion -> pronunciation/pauses -> emphasis.
121- Keep 4 to 8 short lines; avoid conflicting guidance.
122- For names/acronyms, add pronunciation hints (e.g., "enunciate A-I") or supply a phonetic spelling in the text.
123- For edits/iterations, repeat invariants (e.g., "keep pacing steady") to reduce drift.
124- Iterate with single-change follow-ups.
125 
126More principles: `references/prompting.md`. Copy/paste specs: `references/sample-prompts.md`.
127 
128## Guidance by use case
129Use these modules when the request is for a specific delivery style. They provide targeted defaults and templates.
130- Narration / explainer: `references/narration.md`
131- Product demo / voiceover: `references/voiceover.md`
132- IVR / phone prompts: `references/ivr.md`
133- Accessibility reads: `references/accessibility.md`
134 
135## CLI + environment notes
136- CLI commands + examples: `references/cli.md`
137- API parameter quick reference: `references/audio-api.md`
138- Atlas Cloud asynchronous workflow and safeguards: `references/atlas-cloud.md`
139- Instruction patterns + examples: `references/voice-directions.md`
140- If network approvals / sandbox settings are getting in the way: `references/codex-network.md`
141 
142## Reference map
143- **`references/cli.md`**: how to run speech generation/batches via `scripts/text_to_speech.py` (commands, flags, recipes).
144- **`references/audio-api.md`**: API parameters, limits, voice list.
145- **`references/atlas-cloud.md`**: optional Atlas Cloud model, CLI, polling, and download contract.
146- **`references/voice-directions.md`**: instruction patterns and examples.
147- **`references/prompting.md`**: instruction best practices (structure, constraints, iteration patterns).
148- **`references/sample-prompts.md`**: copy/paste instruction recipes (examples only; no extra theory).
149- **`references/narration.md`**: templates + defaults for narration and explainers.
150- **`references/voiceover.md`**: templates + defaults for product demo voiceovers.
151- **`references/ivr.md`**: templates + defaults for IVR/phone prompts.
152- **`references/accessibility.md`**: templates + defaults for accessibility reads.
153- **`references/codex-network.md`**: environment/sandbox/network-approval troubleshooting.
154 

Discussion