Text to Speech
Realtime Voice
Text to Speech
POST
Text to Speech
Introduction
Convert text into natural-sounding speech audio. The endpoint is OpenAI-compatible, so you can use the OpenAI SDK or any compatible client directly.Authentication
Bearer Token, e.g.
Bearer sk-xxxxxxxxxxRequest Parameters
Model name, e.g.
gpt-4o-mini-ttsThe text to convert to speech.
Voice to synthesize with, e.g.
alloy, echo, fable, onyx, nova, shimmerAudio output format:
mp3, opus, aac, flac, wav, or pcmPlayback speed, from
0.25 to 4.0cURL Example
Python Example
Supported Voices
| Voice | Description |
|---|---|
| alloy | Balanced and neutral |
| echo | Calm and clear |
| fable | Warm and expressive |
| onyx | Deep and authoritative |
| nova | Bright and energetic |
| shimmer | Soft and gentle |
Notes
- The response body is raw binary audio — write it to a file (e.g.
speech.mp3) rather than printing it response_formatdefaults tomp3; usewavorpcmwhen you need lossless audio- Requires
openailibrary:pip install openai
