Skill 详情
speech
当用户要求文本转语音旁白或配音、无障碍朗读、音频提示,或通过 OpenAI Audio API 批量生成语音时使用;运行捆绑的 CLI(`scripts/text_to_speech.py`),使用内置语音,实时调用需要 `OPENAI_API_KEY`。自定义语音创建不在范围内。
匹配原因: 通过OpenAI Audio API使用捆绑的CLI从文本生成语音音频,涵盖旁白、配音、无障碍朗读以及使用内置音色的批量语音生成。
使用前先检查
自动化审核只检查相关性,不代表安全审查或推荐。使用前请阅读来源中的说明。
SKILL.md
这段内容是审核时保存的快照。外部来源才是完整且最新的版本。
--- name: "speech" description: "Use when the user asks for text-to-speech narration or voiceover, accessibility reads, audio prompts, or batch speech generation via the OpenAI Audio API; run the bundled CLI (`scripts/text_to_speech.py`) with built-in voices and require `OPENAI_API_KEY` for live calls. Custom voice creation is out of scope." --- # Speech Generation Skill Generate spoken audio for the current project (narration, product demo voiceover, IVR prompts, accessibility reads). Defaults to `gpt-4o-mini-tts-2025-12-15` and built-in voices, and prefers the bundled CLI 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 the bundled CLI (`scripts/text_to_speech.py`) with sensible defaults (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. Python packages: ``` uv pip install openai ``` If `uv` is unavailable: ``` python3 -m pip install openai ``` ## Environment - `OPENAI_API_KEY` must be set for live API calls. If the key is missing, give the user these steps: 1. Create an API key in the OpenAI platform UI: https://platform.openai.com/api-keys 2. Set `OPENAI_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. - Never ask the user to paste the full key in chat. Ask them to set it 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 - 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. - Provide a clear disclosure to end users that the voice is AI-generated. - Use the OpenAI Python SDK (`openai` package) for all API calls; do not use raw HTTP. - Prefer the bundled CLI (`scripts/text_to_speech.py`) over writing new one-off scripts. - Never modify `scripts/text_to_speech.py`. If something is missing, ask the user before doing anything else. ## 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. Templ在 GitHub 阅读完整来源 (打开外部页面)