Example: Half-cascade with Inworld
Example: Half-cascade with Inworld
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 Inworld Realtime TTS.
⬇️ Jump to the Full VoxEngine scenario.
Prerequisites
- Store your OpenAI API key in Voximplant Secrets under
OPENAI_API_KEY. - Set a
voiceIdin the Inworld request (createContextParameters.create.voiceId) to choose the TTS voice used in this scenario. - (Optional) Store your Inworld API key in Voximplant Secrets under
INWORLD_API_KEYif you want to use your own Inworld 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 Inworld with
send({ send_text: { text } }), followed bysend({ flush_context: {} }); Inworld streams the generated speech to the call. - When OpenAI detects caller speech, the scenario clears both the OpenAI and Inworld output buffers.
Developer notes
- Do not set audio format parameters in half-cascade connector requests. VoxEngine’s WebSocket gateway handles media format negotiation automatically.
- If no Inworld 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 sets
voiceId: "Ashley"andmodelId: "inworld-tts-1.5-mini"increateContextParameters.create. Change these to any supported Inworld voice or model. - The example handles
ResponseOutputTextDone, so each Inworld request 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-inworld.js