Skip to navigation

OpenAI

Text-to-speech

View as MarkdownOpen in Claude

OpenAI offers versatile multilingual voices balancing low latency and good quality. While voices are optimized for English, they perform well across all supported languages.

Consult OpenAI’s Text-to-Speech documentation for more information and audio samples for available voices.

Models

OpenAI offers two TTS models with different quality and latency characteristics:

ModelDescription
tts-1Default - Standard quality, optimized for speed
tts-1-hdHigh-definition quality, improved audio fidelity

Voices

Press play to audition any OpenAI voice, then copy config to grab the value for SWML or your SDK.

OpenAI provides 6 fully multilingual voices optimized for natural-sounding speech:

VoiceDescription
alloyNeutral, balanced voice
echoWarm, expressive voice
fableBritish accent, articulate
onyxDeep, authoritative voice
novaEnergetic, friendly voice
shimmerSoft, gentle voice

Languages

All OpenAI voices are fully multilingual and automatically adapt to the input text language.

Consult OpenAI’s supported languages resource for an up-to-date list.

Usage

OpenAI voice IDs conform to the following format:

openai.<voice>:<model>

Parameters:

  • voice (required): One of: alloy, echo, fable, onyx, nova, shimmer
  • model (optional): tts-1 (default) or tts-1-hd

Examples:

openai.alloy
openai.nova:tts-1-hd
openai.fable:tts-1

Examples

Learn how to use OpenAI voices on the SignalWire platform.

Use the languages SWML method to set one or more voices for an AI agent.

# Install: python -m pip install signalwire-sdk==3.4.1
# Save as openai_ai_agent.py and run: python openai_ai_agent.py
from signalwire import SWMLBuilder, SWMLService
service = SWMLService(
name="openai-ai-agent",
route="/swml",
port=3000,
basic_auth=("signalwire", "<YOUR_BASIC_AUTH_PASSWORD>"),
)
SWMLBuilder(service).ai(
prompt_text="Have an open-ended conversation about flowers.",
languages=[{
"name": "English",
"code": "en-US",
"voice": "openai.alloy",
}],
)
service.serve()

Alternatively, use the say_voice parameter of the play SWML method to select a voice for basic TTS.

# Install: python -m pip install signalwire-sdk==3.4.1
# Save as openai_tts.py and run: python openai_tts.py
from signalwire import SWMLBuilder, SWMLService
service = SWMLService(
name="openai-tts",
route="/swml",
port=3000,
basic_auth=("signalwire", "<YOUR_BASIC_AUTH_PASSWORD>"),
)
builder = SWMLBuilder(service)
builder.set(say_voice="openai.alloy")
builder.play(url="say:Greetings. This is the Alloy voice from OpenAI's text-to-speech model.")
service.serve()

The Server SDKs build each document and serve it at /swml on port 3000. The server answers only requests that carry the username signalwire and the password you set in place of <YOUR_BASIC_AUTH_PASSWORD>. To send calls from your phone number to the server, follow Answer a call via SWML.