| name | skill-openai-tts-tool |
| description | CLI tool for OpenAI text-to-speech synthesis Use when this capability is needed. |
| metadata | {"author":"dnvriend"} |
When to use
- When you need to convert text to speech using OpenAI's TTS API
- When you need to list available voices and models
- When you need to check API configuration
OpenAI TTS Tool Skill
Purpose
A comprehensive CLI utility for text-to-speech synthesis using OpenAI's advanced TTS models. Supports multiple voices, languages, and output formats with professional-grade audio quality.
When to Use This Skill
Use this skill when:
- Converting text documents to audio for accessibility
- Creating voice-overs for presentations or videos
- Generating speech samples for testing or development
- Batch processing multiple text inputs to audio
- Needing high-quality TTS with natural-sounding voices
Do NOT use this skill for:
- Real-time streaming TTS (this tool processes complete text)
- Voice cloning or custom voice creation
- Speech recognition or transcription
- Audio editing or post-processing
CLI Tool: openai-tts-tool
A modern Python CLI tool for accessing OpenAI's Text-to-Speech API with comprehensive features including multiple voice models, configurable output formats, and extensive customization options.
Installation
git clone https://github.com/dnvriend/openai-tts-tool.git
cd openai-tts-tool
mise use -g python@3.14
uv sync
uv tool install .
uv run openai-tts-tool --help
Prerequisites
- Python 3.14+ installed
- OpenAI API key (set as OPENAI_API_KEY environment variable)
mise for Python version management (recommended)
uv package manager for modern Python dependency management
Quick Start
openai-tts-tool synthesize "Hello, world!"
openai-tts-tool info
openai-tts-tool list-voices
Progressive Disclosure
📖 Core Commands (Click to expand)
synthesize - Convert Text to Speech
The primary command for converting text input into high-quality audio files using OpenAI's TTS models.
Usage:
openai-tts-tool synthesize TEXT [OPTIONS]
Arguments:
TEXT: The text content to convert to speech (required). Can be a single word, sentence, or full paragraph.
Options:
--voice VOICE / -V VOICE: Select voice model (default: alloy)
- Available voices: alloy, echo, fable, onyx, nova, shimmer
--model MODEL / -m MODEL: Choose TTS model (default: tts-1)
tts-1: Standard quality, lower latency
tts-1-hd: Higher quality, slightly higher cost
--output FILE / -o FILE: Output audio file path (default: output.mp3)
- Supports: .mp3, .wav, .ogg, .flac formats
--speed SPEED / -s SPEED: Speech playback speed (default: 1.0)
- Range: 0.25 (very slow) to 4.0 (very fast)
- Recommended: 0.8-1.2 for natural speech
Examples:
openai-tts-tool synthesize "Welcome to our presentation"
openai-tts-tool synthesize "Chapter 1: Introduction" \
--voice nova \
--output chapter1.mp3
openai-tts-tool synthesize "Important safety information" \
--model tts-1-hd \
--speed 0.8 \
--voice onyx
openai-tts-tool synthesize "In today's lecture, we will explore the fascinating world of artificial intelligence and its impact on modern society." \
--voice shimmer \
--output narration.mp3
for text in ;
openai-tts-tool synthesize --output
⚙️ Advanced Features (Click to expand)
Multi-Level Verbosity
The tool supports progressive verbosity levels for debugging and monitoring:
openai-tts-tool synthesize "Hello"
openai-tts-tool -v synthesize "Hello"
openai-tts-tool -vv synthesize "Hello"
openai-tts-tool -vvv synthesize "Hello"
Environment Configuration
Configure the tool using environment variables:
export OPENAI_API_KEY="sk-..."
export OPENAI_TTS_OUTPUT_DIR="./audio"
export OPENAI_TTS_VOICE="nova"
export OPENAI_TTS_VERBOSE=2
Output Format Support
Generate audio in multiple formats based on file extension:
openai-tts-tool synthesize "Hello" --output speech.mp3
openai-tts-tool synthesize "Hello" --output speech.wav
openai-tts-tool synthesize "Hello" --output speech.ogg
openai-tts-tool synthesize "Hello" --output speech.flac
Voice Characteristics
Different voices optimized for different use cases:
openai-tts-tool synthesize --voice alloy
openai-tts-tool synthesize --voice
openai-tts-tool synthesize --voice fable
openai-tts-tool synthesize --voice onyx
openai-tts-tool synthesize --voice nova
openai-tts-tool synthesize --voice shimmer
🔧 Troubleshooting (Click to expand)
Common Issues
Issue: Invalid OpenAI API key
Error: Invalid OpenAI API key
export OPENAI_API_KEY="sk-your-valid-api-key-here"
openai-tts-tool info
Issue: Audio file not created
Command completes but no output file
openai-tts-tool -vv synthesize "test" --output test.mp3
ls -la "$(pwd)"
touch test_write.tmp && rm test_write.tmp
Issue: Network connectivity problems
Connection timeout or network errors
openai-tts-tool -vvv synthesize "test"
curl -I https://api.openai.com/v1/models
Issue: Voice not recognized
Error: Voice 'xyz' not supported
openai-tts-tool list-voices
openai-tts-tool synthesize "test" --voice alloy
Issue: Audio quality poor
Audio sounds robotic or low quality
openai-tts-tool synthesize "test" --model tts-1-hd
openai-tts-tool synthesize "test" --speed 0.9
Getting Help
Exit Codes
0: Success - operation completed successfully
1: Client Error - invalid arguments, missing API key, file not found
2: Server Error - OpenAI API server issues, rate limiting
3: Network Error - connectivity problems, timeouts
4: Configuration Error - invalid setup, permissions issues
Output Formats
Audio Formats:
- MP3: Default format, good compression, widely supported
- WAV: Uncompressed, highest quality, larger file sizes
- OGG: Open source format, good compression quality ratio
- FLAC: Lossless compression, high quality, medium file sizes
Data Formats:
- Table: Human-readable format with aligned columns
- JSON: Machine-readable format for scripting and automation
Best Practices
-
API Key Security: Never commit API keys to version control. Use environment variables or secure credential storage.
-
Voice Selection: Test different voices with your content type - some voices work better for specific content (e.g., onyx for professional content, fable for storytelling).
-
Quality vs Speed: Use tts-1 for testing/prototyping and tts-1-hd for final production audio.
-
File Organization: Use descriptive filenames and organize output files by project or content type.
-
Batch Processing: For multiple files, use shell scripting to process efficiently and handle errors.
-
Speed Optimization: Adjust speed between 0.8-1.2 for most natural speech; extreme speeds may sound artificial.
-
Text Preparation: Clean input text of special characters and formatting for best synthesis results.
Resources
Converted and distributed by TomeVault — claim your Tome and manage your conversions.