Skip to content

AI 0.13.0: Streaming voice that plays, and a live voice picker

AI 0.13.0 makes the Playground’s xAI streaming voice work. Since 0.12, the Streaming Voice (xAI) panel received audio but played nothing, with no error, and stayed silent on iOS Safari in particular.

Sound that plays

The browser started the audio player outside a click, and its autoplay rules kept it paused. The player is now unlocked on the first click in the panel, such as Connect, and resumed before each chunk. On iOS Safari the same click also plays a short silent sound, which WebKit needs before it allows audio. The session and the Playground now log realtime events they used to drop. Those logs showed that audio had been arriving from xAI all along: the fault was entirely in the browser.

Seeing what happens

Audio played this way has no visible player, so silence and a broken pipeline looked the same. The panel now shows the state of the audio player, how many chunks were received and scheduled, and a Test speaker button that plays a tone without xAI, to rule out a muted or wrong output device.

A live voice picker

A Voice dropdown lists the voices of the xAI account, read live, so custom and cloned voices appear next to the five built-in ones (Ara, Eve, Leo, Rex and Sal). If the list cannot be read, the five built-in voices are offered. The voice is fixed once connected.

Upgrading

No migration. Update the dependency. The module now uses xai 0.2.

Full release notes: AI 0.13.0

0.13.0 · 14 July 2026

Fixed

  • Streaming voice played nothing at all, with zero errors. The XaiVoiceStream JS hook only created its AudioContext reactively when the first audio chunk arrived via push_event — not a synchronous user gesture, so browser autoplay policy silently created it suspended and nothing ever played. Now unlocked on the first click after the panel mounts (covers the “Connect” click), plus a defensive resume() before scheduling each chunk.
  • Silent on iOS Safari specifically, even after the fix above — WebKit has historically needed a sound actually played synchronously within the gesture, not just resume() alone. Now plays a zero-length silent buffer in the same click handler (the same technique Howler.js/Tone.js use); a no-op everywhere else.
  • PhoenixKitAI.Realtime.Session discarded the return value of send_text/send_text_done, and the Playground silently dropped every realtime event except "error" — both now log, which is how the two bugs above were actually found and confirmed fixed (real audio chunks were arriving from xAI the whole time; the bug was entirely client-side).

Added

  • Visual status feedback in the streaming voice panel. Audio played via the Web Audio API has no visible player at all, so there was previously no way to tell “silently not working” apart from “actually playing” short of trusting your ears. The panel now shows a live AudioContext state, a chunks received/scheduled counter, and a “Test speaker” button that plays a tone independent of xAI entirely — isolates broken audio output (wrong device, muted/silent-switch, OS-level block) from a broken xAI pipeline.
  • Live voice picker. OpenRouterClient.fetch_xai_voices/2 hits xAI’s GET /v1/tts/voices (a different endpoint/shape from fetch_voices/2’s Mistral /audio/voices) and populates a “Voice” dropdown — includes any custom/cloned voices on the account, not just the 5 built-ins (Ara/Eve/Leo/Rex/Sal), which is why this fetches live instead of hardcoding the list. Falls back to the 5 built-ins if the fetch fails. Disabled once connected — the voice is fixed at connect time, baked into the WebSocket URL by Xai.Realtime.connect_tts/1.

AI 0.13.0. Install or update: {:phoenix_kit_ai, "~> 0.13"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.