OpenAI Realtime API compatibility
ElevenLabs Realtime speaks the same wire protocol as OpenAI’s Realtime API: the same client and server events, over the same WebSocket transport. If you already have an app built with OpenAI’s Realtime SDK, you can point it at ElevenLabs Realtime instead of api.openai.com without switching SDKs.
This guide covers the browser-based flow, where a small server-side step mints a short-lived credential and the browser connects directly to ElevenLabs Realtime.
Available models
How it works
- Your backend requests a short-lived client secret from ElevenLabs, scoped to a specific session configuration.
- Your frontend passes that client secret to OpenAI’s Realtime SDK in place of an OpenAI API key.
- The SDK connects over WebSocket to ElevenLabs Realtime, and the conversation proceeds using the same client and server events as OpenAI’s Realtime API.
Mint a client secret
Request the client secret from your backend, not the browser, so your ElevenLabs API key never reaches the client.
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 response contains value (the ephemeral credential your frontend will use), its expiry time, and the negotiated session. Return only value to the browser.
A model string selects the agent’s behavior directly, rather than referencing an agent_id from
the dashboard. The session configuration you send when minting the client secret is the
authoritative initial session for that credential.
Connect from the browser
Pass the client secret to OpenAI’s Realtime SDK (@openai/agents-realtime) as the API key, and point the WebSocket transport at the ElevenLabs endpoint instead of the default OpenAI one.
The SDK only wires audio automatically for its WebRTC transport. Over WebSocket, capture and play PCM16 audio at 24kHz yourself, for example with wavtools, the same helper OpenAI uses in its own WebSocket examples.
Limitations
This guide covers connecting directly from a browser. Documentation for connecting from server-side OpenAI Realtime SDKs isn’t published yet.
FAQ
When should I use Realtime models?
Realtime models are the fastest way to start building voice into a product. Eleven Realtime v1 mini is optimized for price and speed; Eleven Realtime v1 max is optimized for quality and more complex tasks.
What is the architecture underlying Realtime models?
Eleven Realtime v1 mini and max use a cascaded architecture, optimized end-to-end so each component works best as part of a single system.
How do they compare to selecting the component models in ElevenAgents?
The specifics of the underlying models aren’t public. Each component uses ElevenLabs’ latest research and is optimized to work best together within Realtime models.
Are Realtime models fused models?
No. Realtime models use a cascaded architecture: each component is a distinct model, built with ElevenLabs’ latest research and optimized to work best together.