Example: Half-cascade with ElevenLabs
Example: Half-cascade with ElevenLabs
For the complete documentation index, see llms.txt.
Overview
This half-cascade example uses OpenAI Realtime for speech‑to‑text and reasoning, then sends OpenAI text responses to ElevenLabs Realtime TTS.
⬇️ Jump to the Full VoxEngine scenario.
Prerequisites
- Store your OpenAI API key in Voximplant Secrets under
OPENAI_API_KEY. - (Optional) Update the
ELEVENLABS_VOICE_IDconstant in the example to your preferred voice. - (Optional) Store your ElevenLabs API key in Voximplant Secrets under
ELEVENLABS_API_KEYif you want to use your own ElevenLabs account.
How it works
- OpenAI runs
gpt-realtime-2.1in text mode (output_modalities: ["text"]). - Caller audio is sent to OpenAI:
call.sendMediaTo(voiceAIClient). - Completed OpenAI text responses are sent to ElevenLabs with
append(text, true), and ElevenLabs streams the generated speech to the call. - When OpenAI detects caller speech, the scenario clears both the OpenAI and ElevenLabs output buffers.
Developer notes
- Do not set audio format parameters (for example
ulaw_8000) in half-cascade connector requests. VoxEngine’s WebSocket gateway handles media format negotiation automatically. - If no ElevenLabs API key is provided, Voximplant’s default account and billing are used.
- Custom or cloned voices are only available when using your own API key.
Full VoxEngine scenario
Notes
- The example uses
eleven_turbo_v2_5. - The example handles
ResponseOutputTextDone, so eachappend(text, true)call contains a completed OpenAI text response.
This example runs gpt-realtime-2.1 using the Realtime 2.x session shape, with input settings nested under session.audio.input.
voxeengine-openai-half-cascade-elevenlabs.js