For server-side / WebSocket Realtime, use the Live / Realtime API (
wss://{GATEWAY_HOST}/live/{providerAccountName}) instead.Architecture
TrueFoundry credentials never go to the browser. Because media does not pass through the gateway, live-session observability for the WebRTC media path will not appear on gateway traces the way WebSocket
/live/... sessions do.
Prerequisites
- An OpenAI (or Azure OpenAI / Azure AI Foundry) model account on TrueFoundry with a Realtime model (for example
gpt-realtimeorgpt-realtime-2.1). - Your Gateway Base URL and TrueFoundry API key.
- Call this from your backend and return only the ephemeral key (
ek_...) to the browser — do not put the TrueFoundry API key in client code.
1. Mint an ephemeral client secret (backend)
${GATEWAY_BASE_URL}, ${TFY_API_KEY}, openai-main, and gpt-realtime with your gateway URL, API key, provider account name, and realtime model id.
The response includes a short-lived key (ek_...). Return only that value to the browser. Mint it immediately before connecting — ephemeral keys expire quickly.
2. Connect WebRTC from the browser (directly to OpenAI)
Follow OpenAI’s Realtime WebRTC guide. Do not send the SDP offer to TrueFoundry.http://localhost or HTTPS so the browser can access the microphone.