Text-to-Speech
Generate natural-sounding speech from text using AI voice models
Create Speech
POST /audio/speech
Convert text to natural-sounding speech audio.
Request Body
Text Input Parameters
Voice Parameters
Common Parameters
Advanced Parameters
Response
Returns an audio file in the specified format.Basic Example
Provider-Specific Examples
OpenAI Models (TTS-1, TTS-1 HD, GPT-4o Mini TTS)
ElevenLabs Models
Kokoro 82M Model
NariLabs Dia Model (Advanced)
MeloTTS Multilingual
PlayAI Dialog Models
Microsoft TTS
Available Models
OpenAI Models
TTS-1 (tts-1)
- Optimized for real-time text-to-speech
- Cost-effective for most applications
- 11 available voices: alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, verse
tts-1-hd)
- High-quality text-to-speech
- Best audio quality with slower generation
- Same 11 voices as TTS-1
gpt-4o-mini-tts)
- Advanced TTS with instruction following
- Supports voice control via instructions
- Same 11 voices as TTS-1
Premium Models
ElevenLabs (elevenlabs)
- Ultra-realistic human-like voices
- 40+ multilingual voices
- Supports English, Spanish, French, German, Arabic, Chinese, Hindi, Polish
playai-tts)
- Specialized for conversational content
- 27 expressive voices
- Optimized for dialogue and storytelling
Specialized Models
Kokoro 82M (kokoro-82m)
- Lightweight but high-quality
- 80+ voices in multiple languages
- Open-source Apache-licensed model
microsoft-tts)
- Enterprise-grade quality
- 100+ neural voices
- Extensive language support
Voice Examples
OpenAI Voices
ElevenLabs Voices
Microsoft TTS Voices
Model-Specific Parameters
Advanced Features
Speed Control
Adjust playback speed for different use cases:Audio Formats
Choose the optimal format for your application:- MP3: Standard, widely compatible
- WAV: Uncompressed, highest quality
- OGG/Opus: Efficient compression
- FLAC: Lossless compression
- AAC: Good balance of quality and size
Instruction-Based Control (GPT-4o Mini TTS)
Control voice characteristics with natural language:Microsoft TTS Advanced Controls
Microsoft TTS offers fine-grained control over speech characteristics:Speech Rate Control
Pitch Adjustment
Emotional Styles
Different voices support different emotional styles:cheerful- Happy and upbeatsad- Melancholic toneangry- Frustrated or upsetfearful- Nervous or scaredcalm- Relaxed and peacefulgentle- Soft and caringnewscast- Professional news anchorcustomerservice- Helpful and polite
Best Practices
Text Optimization
- Use clear punctuation for natural pauses
- Spell out numbers and abbreviations
- Use SSML tags for fine-grained control (model-dependent)
Voice Selection
- Customer Service: Professional voices (echo, George)
- Storytelling: Warm voices (fable, nova)
- Educational: Clear voices (alloy, shimmer)
- Gaming: Character voices (onyx, sage)
Performance Tips
- Cache generated audio when possible
- Use appropriate audio formats for your platform
- Consider real-time vs. high-quality models based on use case
Error Handling
Common error scenarios:Use Cases
- Voice Assistants: Natural conversation interfaces
- Audiobooks: Long-form content narration
- E-learning: Educational content delivery
- Accessibility: Screen reader alternatives
- Gaming: Character voice generation
- Customer Service: Automated phone systems
- Content Creation: Podcast and video narration
Authorizations
Enter your API key (starts with 'ek-')
Body
The TTS model to use for speech generation
"tts-1"
The text to convert to speech (OpenAI models)
1 - 4096"Hello, world! This is a text-to-speech example."
The voice to use for speech generation (OpenAI, Orpheus, PlayAI, ElevenLabs models)
"alloy"
The audio format for the generated speech
mp3, opus, aac, flac, wav, pcm The speed of the generated audio
0.25 <= x <= 4Temperature for randomness in speech generation
0 <= x <= 2Top-p value for nucleus sampling
0 <= x <= 1Additional instructions to control voice generation (GPT-4o Mini TTS)
Speaker transcript for Dia model
1000CFG filter top k value (Dia model)
15 <= x <= 50CFG scale value (Dia model)
1 <= x <= 5Speech rate adjustment for Microsoft TTS (-100 to 100)
-100 <= x <= 100Pitch adjustment for Microsoft TTS (-100 to 100)
-100 <= x <= 100Emotional style for Microsoft TTS (e.g., 'cheerful', 'sad', 'angry')
Response
Audio file
The response is of type file.
