Built for voice agents that can't wait 600ms

Published by AllModels

How to Switch from OpenAI Voice to ElevenLabs

Keep the OpenAI SDK. Point it at AllModels, then replace the model and voice. Your speech-generation call stays the same.

Switch in two small edits
  1. 1
    Use your AllModels key and set the SDK base URL to https://api.allmodels.io/oai.
  2. 2
    Set elevenlabs/eleven-v3 and choose an ElevenLabs voice ID.

AllModels is an independent service and is not affiliated with, endorsed by, or sponsored by OpenAI, ElevenLabs, Fish Audio, or Cartesia.

Change the base URL, model, and voice

These examples generate a normal MP3 response. Highlighted lines are the only provider-migration changes.

JavaScript

Before — OpenAI
import OpenAI from "openai";
 
const client = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY
});
 
const speech = await client.audio.speech.create({
  model: "gpt-4o-mini-tts",
  voice: "OPENAI_VOICE",
  input: "Hello from my application",
  response_format: "mp3"
});
After — ElevenLabs through AllModelsChanged lines highlighted
import OpenAI from "openai";
 
const client = new OpenAI({
  apiKey: process.env.ALLMODELS_API_KEY,
  baseURL: "https://api.allmodels.io/oai"
});
 
const speech = await client.audio.speech.create({
  model: "elevenlabs/eleven-v3",
  voice: "ELEVENLABS_VOICE_ID",
  input: "Hello from my application",
  response_format: "mp3"
});

Python

Before — OpenAI
import os
from openai import OpenAI
 
client = OpenAI(
    api_key=os.environ["OPENAI_API_KEY"],
)
 
with client.audio.speech.with_streaming_response.create(
    model="gpt-4o-mini-tts",
    voice="OPENAI_VOICE",
    input="Hello from my application",
    response_format="mp3",
) as response:
    response.stream_to_file("speech.mp3")
After — ElevenLabs through AllModelsChanged lines highlighted
import os
from openai import OpenAI
 
client = OpenAI(
    api_key=os.environ["ALLMODELS_API_KEY"],
    base_url="https://api.allmodels.io/oai",
)
 
with client.audio.speech.with_streaming_response.create(
    model="elevenlabs/eleven-v3",
    voice="ELEVENLABS_VOICE_ID",
    input="Hello from my application",
    response_format="mp3",
) as response:
    response.stream_to_file("speech.mp3")

Keep using the OpenAI SDK

Switching providers through AllModels is intentionally simple: keep the SDK and request flow you already use, point the client at AllModels, then choose a different model and voice.

The AllModels-compatible OpenAI SDK surface supports text-to-speech and streamed speech responses, file transcription, and realtime transcription. Read the complete OpenAI SDK compatibility guide for setup details, supported methods, and current limitations.

About Eleven v3

Eleven v3 is ElevenLabs’ generally available, most advanced text-to-speech model. ElevenLabs says the production release is more stable and more accurate than the earlier alpha, especially when reading numbers, symbols, and specialized notation across languages.

In its internal benchmark across 27 categories and eight languages, ElevenLabs reports a 68% reduction in errors. That makes v3 particularly relevant for scripts containing phone numbers, currencies, formulas, scores, URLs, and other context-sensitive text.

Quick answers

Common migration questions

Do I need to replace the OpenAI SDK?

No. Keep the installed SDK and its speech method. AllModels exposes a compatible base URL for it.

Can I switch providers again later?

Yes. Keep the AllModels base URL and API key, then change the model and voice to another supported provider.

Ready to switch?

Try ElevenLabs through one API.

Browse available ElevenLabs models or continue with the complete AllModels documentation.