Migrate from OpenAI Text to Speech
How-to guide · Assumes your app calls OpenAI’s Speech API (/v1/audio/speech) today.
OpenAI has deprecated its tts-1, tts-1-hd and gpt-4o-mini-tts models, including the gpt-4o-mini-tts-2025-03-20 and gpt-4o-mini-tts-2025-12-15 snapshots. They shut down on January 6, 2027. See OpenAI’s deprecations page.
OpenAI’s recommended replacement, gpt-realtime-2.1-mini, runs on the Realtime API and isn’t a supported model for /v1/audio/speech. Every integration that uses these models needs a code change before the shutdown date.
The ElevenLabs Text to Speech API keeps the same shape of work: one HTTP request that returns audio. The authentication header, parameter names, voice identifiers and model IDs are different, so you need to update each request.
Find the code to change
Search your codebase for:
- Calls to
client.audio.speech.create(...)orclient.audio.speech.with_streaming_response.create(...). - Direct requests to
POST https://api.openai.com/v1/audio/speech. - The model IDs
tts-1,tts-1-hdandgpt-4o-mini-tts.
To check which OpenAI models in your account are affected, call OpenAI’s GET /v1/models endpoint and read each model’s optional shutdown_date field.
Set up ElevenLabs
A coding agent can do this setup for you. Run npx -y @elevenlabs/cli@latest onboard init, which
needs no account or API key beforehand, and see the quickstart for
details. To give the agent ElevenLabs-specific guidance for the migration, install the agent
skills with npx skills add elevenlabs/skills.
Create an API key
Create an API key in the dashboard here, which you’ll use to securely access the API.
Store the key as a managed secret and pass it to the SDKs either as an environment variable via an .env file, or directly in your app’s configuration depending on your preference.
The SDKs read the key from the ELEVENLABS_API_KEY environment variable.
How parameters map
To change speaking speed, see Control speaking speed.
Choose a model
Use eleven_v4. It’s the flagship model, with the highest fidelity, richest emotional expression and broadest language support: 90+ languages and up to 10,000 characters per request. See the models reference for full specifications.
Choose a voice
OpenAI voices are built-in names. ElevenLabs voices are referenced by ID, and there is no built-in mapping from OpenAI voice names to ElevenLabs voices.
- Browse the voice library, which has 10,000+ voices, and listen for one that fits your use case.
- Copy its voice ID. This guide uses
JBFqnCBsd6RMkjVDRZzb(“George”). - Pass the ID as
voice_id. To list voices programmatically, use the voices endpoint.
If your app lets users pick from OpenAI voice names, replace that list with the ElevenLabs voice IDs you choose.
Update the request
The following examples generate the same sentence and save it as an MP3 file.
Before: OpenAI
After: ElevenLabs
Replace instructions
The ElevenLabs Text to Speech API has no instructions parameter. Remove it from your requests.
Delivery comes from the voice you choose and from voice_settings, which apply to that request only. With Eleven v4, set stability: lower values give a broader emotional range, and higher values are more stable between generations but can sound monotonous.
Control speaking speed
Eleven v4 doesn’t apply voice_settings.speed. If your app changes speaking speed, use eleven_multilingual_v2 or eleven_flash_v2_5, which do. 1.0 is the default; values from 0.7 to 1.0 slow speech down, and values from 1.0 to 1.2 speed it up.
Map output formats
OpenAI’s response_format defaults to mp3. ElevenLabs’ output_format defaults to mp3_44100_128.
ElevenLabs also offers μ-law (ulaw_8000) and A-law (alaw_8000), which are common in telephony.
MP3 at 192kbps requires the Creator tier or above. PCM and WAV at 44.1kHz require the Pro tier or above.
Stream audio
OpenAI streams speech with chunked transfer encoding, and so does ElevenLabs. Replace with_streaming_response.create(...) with the stream method, which takes the same parameters as convert and returns audio chunks as they are generated.
The Stream speech endpoint doesn’t accept wav_*
output formats. If you streamed wav or pcm from OpenAI for low latency, use pcm_24000.
For a complete example, see Streaming text to speech.
Pricing and limits
- Text to Speech is priced per character. See the API pricing page for current rates.
- Your subscription plan sets how many requests run at once. See concurrency and priority.
- The maximum characters per request depends on the model. See character limits.
FAQ
Is there an OpenAI-compatible Text to Speech endpoint?
No. The ElevenLabs Text to Speech API uses its own request shape, authentication header and voice IDs, so you need to update each request as shown in this guide.
Can I keep using OpenAI voice names?
No. ElevenLabs voices are referenced by ID, and there is no mapping from OpenAI voice names. Choose replacement voices from the voice library.
Do I have to migrate before January 6, 2027?
OpenAI says existing integrations can keep using the Speech API until the shutdown date. After that, requests to the deprecated models stop working.