openai-tts
Generates natural speech from text using OpenAI's TTS API.
Install
mkdir -p .claude/skills/openai-tts && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/5813" && unzip -o skill.zip -d .claude/skills/openai-tts && rm skill.zipInstalls to .claude/skills/openai-tts
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
OpenAI Text-to-Speech API for high-quality speech synthesis. Use for generating natural-sounding audio from text with customizable voices and tones.Key capabilities
- →Synthesize audio from text input
- →Support multiple voice profiles
- →Apply tone and style instructions
- →Process long documents via chunking
- →Export in various audio formats
How it works
The skill interfaces with the OpenAI TTS API to convert text into speech, providing methods to handle long-form content by splitting text into chunks and concatenating the resulting audio segments.
Inputs & outputs
When to use openai-tts
- →Convert documentation to audio
- →Generate narration for app features
- →Create spoken feedback for user interfaces
About this skill
OpenAI Text-to-Speech
Generate high-quality spoken audio from text using OpenAI's TTS API.
Authentication
The API key is available as environment variable:
OPENAI_API_KEY
Models
gpt-4o-mini-tts- Newest, most reliable. Supports tone/style instructions.tts-1- Lower latency, lower qualitytts-1-hd- Higher quality, higher latency
Voice Options
Built-in voices (English optimized):
alloy,ash,ballad,coral,echo,fablenova,onyx,sage,shimmer,versemarin,cedar- Recommended for best quality
Note: tts-1 and tts-1-hd only support: alloy, ash, coral, echo, fable, onyx, nova, sage, shimmer.
Python Example
from pathlib import Path
from openai import OpenAI
client = OpenAI() # Uses OPENAI_API_KEY env var
# Basic usage
with client.audio.speech.with_streaming_response.create(
model="gpt-4o-mini-tts",
voice="coral",
input="Hello, world!",
) as response:
response.stream_to_file("output.mp3")
# With tone instructions (gpt-4o-mini-tts only)
with client.audio.speech.with_streaming_response.create(
model="gpt-4o-mini-tts",
voice="coral",
input="Today is a wonderful day!",
instructions="Speak in a cheerful and positive tone.",
) as response:
response.stream_to_file("output.mp3")
Handling Long Text
For long documents, split into chunks and concatenate:
from openai import OpenAI
from pydub import AudioSegment
import tempfile
import re
import os
client = OpenAI()
def chunk_text(text, max_chars=4000):
"""Split text into chunks at sentence boundaries."""
sentences = re.split(r'(?<=[.!?])\s+', text)
chunks = []
current_chunk = ""
for sentence in sentences:
if len(current_chunk) + len(sentence) < max_chars:
current_chunk += sentence + " "
else:
if current_chunk:
chunks.append(current_chunk.strip())
current_chunk = sentence + " "
if current_chunk:
chunks.append(current_chunk.strip())
return chunks
def text_to_audiobook(text, output_path):
"""Convert long text to audio file."""
chunks = chunk_text(text)
audio_segments = []
for chunk in chunks:
with tempfile.NamedTemporaryFile(suffix='.mp3', delete=False) as tmp:
tmp_path = tmp.name
with client.audio.speech.with_streaming_response.create(
model="gpt-4o-mini-tts",
voice="coral",
input=chunk,
) as response:
response.stream_to_file(tmp_path)
segment = AudioSegment.from_mp3(tmp_path)
audio_segments.append(segment)
os.unlink(tmp_path)
# Concatenate all segments
combined = audio_segments[0]
for segment in audio_segments[1:]:
combined += segment
combined.export(output_path, format="mp3")
Output Formats
mp3- Default, general useopus- Low latency streamingaac- Digital compression (YouTube, iOS)flac- Lossless compressionwav- Uncompressed, low latencypcm- Raw samples (24kHz, 16-bit)
with client.audio.speech.with_streaming_response.create(
model="gpt-4o-mini-tts",
voice="coral",
input="Hello!",
response_format="wav", # Specify format
) as response:
response.stream_to_file("output.wav")
Best Practices
- Use
marinorcedarvoices for best quality - Split text at sentence boundaries for long content
- Use
wavorpcmfor lowest latency - Add
instructionsparameter to control tone/style (gpt-4o-mini-tts only)
When not to use it
- →Real-time low-latency voice interaction
Prerequisites
Limitations
- →Tone instructions only supported on gpt-4o-mini-tts model
- →Voice options vary by model
How it compares
It provides a structured approach for handling long documents and applying tone instructions, which simplifies the process compared to basic API calls.
Compared to similar skills
openai-tts side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| openai-tts (this skill) | 1 | 2mo | Review | Beginner |
| annas-archive-ebooks | 22 | 7mo | Review | Beginner |
| openai-whisper | 38 | 2mo | No flags | Beginner |
| business-document-generator | 3 | 9mo | Review | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by benchflow-ai
View all by benchflow-ai →You might also like
annas-archive-ebooks
ratacat
Use when needing to look up book content, find a book by title/author, download an ebook, or reference material from a published book. Triggers on book lookups, ebook downloads, "find the book", "get the PDF/EPUB of". Downloads produce PDF/EPUB/MOBI files - use ebook-extractor skill to convert to text.
openai-whisper
openclaw
Local speech-to-text with the Whisper CLI (no API key).
business-document-generator
ailabs-393
This skill should be used when the user requests to create professional business documents (proposals, business plans, or budgets) from templates. It provides PDF templates and a Python script for generating filled documents from user data.
xhs-note-creator
comeonzhj
小红书笔记素材创作技能。当用户需要创建小红书笔记素材时使用这个技能。技能包含:根据用户的需求和提供的资料,撰写小红书笔记内容(标题+正文),生成图片卡片(封面+正文卡片),以及发布小红书笔记。
pr-writing-review
evalstate
Extract and analyze writing improvements from GitHub PR review comments. Use when asked to show review feedback, style changes, or editorial improvements from a GitHub pull request URL. Handles both explicit suggestions and plain text feedback. Produces structured output comparing original phrasing with reviewer suggestions to help refine future writing.
x-article-publisher
wshuyi
Publish Markdown articles to X (Twitter) Articles editor with proper formatting. Use when user wants to publish a Markdown file/URL to X Articles, or mentions "publish to X", "post article to Twitter", "X article", or wants help with X Premium article publishing. Handles cover image upload and converts Markdown to rich text automatically.