Skip to content

Run the voice demo locally

By the end of this tutorial you will talk to the repository demo, watch the UI rearrange itself, and hear it describe what it just did.

This tutorial explicitly selects OpenAI Realtime for a server-held-key setup. Fresh visits otherwise select GPT-Live, which uses a different credential flow. The only provider key needed for this Realtime checkpoint is an OpenAI one.

This is a learning checkpoint, not a deployment. The demo mint route is development-only and is not deployable.

  • The repository cloned, with bun install already run.
  • An OPENAI_API_KEY with access to the Engine and realtime models.
  • A browser with microphone permission.
  1. Copy the root .env.example to .env. Set OPENAI_API_KEY and uncomment VITE_VOICE_PROVIDER=realtime. Leave DEMO_LOCAL_SERVER_KEY=0; authenticated local Live is a different setup. The Deepgram, Cartesia, and LiveKit values belong to the cascade tutorial.

  2. From the repository root, start the demo:

    Terminal window
    bunx nx dev demo

    This starts two processes: the Engine host and the browser app. Wait until both report ready.

Open http://localhost:3000, confirm the selector shows OpenAI Realtime, and connect voice. The browser asks for microphone permission — allow it.

Now just talk. There is no button to hold. OpenAI decides where your turn ends, so ask for something the demo can show and then stop speaking.

Three things should happen in order: your words appear as a transcript, the UI rearranges itself, and then the model describes the result out loud.

Watch that order. The model speaks after the screen changes, never before — it is describing a layout it has already been told about, rather than predicting one. That is the settle wait doing its job.

Try one more thing: start a new request while it is still speaking. Audio interruption does not cancel a UI request. Accepted voice and typed requests share a bounded FIFO: the second waits for the first to settle, then runs against the current UI. A full or expired queue reports the request as not submitted; an unknown outcome is not permission to retry automatically.

If nothing is spoken back, check the terminal running nx dev demo. A rejected mint is reported there, and an expired or unauthorized OPENAI_API_KEY is the usual cause.

You did not write any of this, but three parts of it are worth knowing before you build your own.

You selected Realtime explicitly. VITE_VOICE_PROVIDER=realtime changes the initial provider; the selector can switch it at runtime. All three providers reach the same m.useVoice() hook and Vessels.

Provider Initial selection Credential custody First endpoint and model to inspect
GPT-Live Default on fresh visits Browser-supplied key goes directly to OpenAI for voice; server-held key requires authenticated, loopback-only local mode Browser: /v1/live/sessions; local server: /api/live-session; gpt-live-1 with gpt-6-luna Responses backend
OpenAI Realtime VITE_VOICE_PROVIDER=realtime, or select it manually Local server mints a short-lived credential; browser-key mode mints directly with OpenAI Local: /api/realtime-token; browser: /v1/realtime/client_secrets; default gpt-realtime-2.1
LiveKit cascade dev-livekit sets VITE_VOICE_PROVIDER=livekit; unavailable in hosted mode Server signs room grants; LiveKit, Deepgram, and Cartesia keys stay in the server/worker Demo getLivekitToken server function and LiveKit room connection; Deepgram nova-3, Cartesia sonic-3

Browser-key mode also supplies the key separately to the Engine for planning; browser-direct voice does not mean the entire demo keeps it exclusively in the browser. For local GPT-Live, follow the demo README.

Your key never reached the browser. The browser posted to /api/realtime-token, and the server minted a short-lived credential from OPENAI_API_KEY and returned only that. The same server-held key also synthesizes the one fixed greeting through a development-only same-origin TTS route (gpt-4o-mini-tts / recommended cedar voice / WAV). Ordinary Realtime conversation audio still goes from the browser straight to OpenAI over WebRTC, so it never passed through the process you started. Both mint and greeting TTS routes are development-only — replace them before any deployment. The OpenAI Realtime guide shows the route you would deploy in place of the demo’s.

The greeting is AI-generated speech. The demo discloses that next to the voice orb. It is not a human voice recording, and it uses the same recommended built-in cedar voice as later model replies.

Nothing you said reached the Engine as structure. The model called one tool with one sentence, and the Maelstrom client attached the Chart snapshot itself. That is why speaking to the demo could not break a Vessel, and it is the subject of The voice boundary.