AI 0.12.0: Streaming voice for xAI endpoints in the Playground
AI 0.12.0 adds streaming speech to the Playground. For xAI endpoints, a new panel speaks typed text back almost as soon as it is sent, instead of waiting for a whole audio file.
The Streaming Voice panel
When the selected endpoint’s provider supports realtime voice, which is xAI, the Playground shows a Streaming Voice (xAI) panel. Connect opens a connection to xAI’s realtime speech service, you type text and press Speak, and the audio comes back in small chunks that the browser plays one after another without gaps. The panel shows whether it is connected, and Disconnect closes the connection.
This is output only: you type and hear the result. There is no microphone input and no two-way voice conversation.
How it runs
Each Playground session gets its own connection process. It watches the page that opened it and closes the connection when the page goes away, so a closed tab does not leave a connection open. A session that ends is not restarted. The API key is looked up the same way as for ordinary requests. The audio is played by a new JavaScript hook that the module ships with its assets.
Known issue
The new xai package pulls in gun and cowlib for its gRPC transport, and cowlib 2.18.0 has two open advisories, one medium and one low, both in building outgoing HTTP headers and cookies. No fixed release exists yet. The module only uses xAI’s WebSocket connection, so the affected code is never run here.
Upgrading
AI 0.12 needs PhoenixKit 1.7.194 or later, which declares xAI’s realtime voice capability, and adds the xai package. No migration. Update the dependencies.
Full release notes: AI 0.12.0
0.12.0 · 14 July 2026
Added
- Streaming voice for xAI endpoints. The Playground gets a “Streaming Voice (xAI)” panel — shown only for endpoints on a provider declaring the
:realtime_voicecapability (xAI, as ofphoenix_kit ~> 1.7.194) — that connects to xAI’s realtime TTS WebSocket (via the newxaiHex package’sXai.Realtime) and streams synthesized audio back in near-real-time as PCM chunks instead of waiting for a full request/response render.PhoenixKitAI.Realtime.Session— aGenServerowning one realtime connection per Playground session; monitors the owning LiveView so the socket closes automatically when the LiveView goes away (LiveViewterminate/2isn’t reliable withouttrap_exit, so cleanup is driven from here instead), and runs under aDynamicSupervisor(restart: :temporary— a dead/ended session is never auto-restarted).- A new
XaiVoiceStreamJS hook (priv/static/assets/phoenix_kit_ai.js, wired viajs_sources/0) schedules the streamed 16-bit PCM chunks through the Web Audio API for gapless playback. OpenRouterClient.resolve_api_key/1is now public so the realtime session can resolve the endpoint’s API key the same way the REST completion path does.- Scope is streaming output only (type text, hear it spoken) — no microphone input / full-duplex voice agent.
- Depends on
phoenix_kit ~> 1.7.194(adds the xAI:realtime_voicecapability) and the newxai ~> 0.1package.
Known issues
xai’s gRPC transport pulls ingun/cowlib, which currently carries two unpatched upstream advisories (cowlib2.18.0: CVE-2026-43966 MEDIUM, CVE-2026-43969 LOW — both in outgoing HTTP header/cookie construction). No fixedcowlibrelease exists yet;xai’s own maintainers accept the same risk for the same reason. This module only usesXai.Realtime(WebSocket, viawebsockex) — the vulnerable gRPC/guncode path is never exercised at runtime here. Accepted; re-evaluate oncecowlibpatches upstream.
AI 0.12.0. Install or update: {:phoenix_kit_ai, "~> 0.12"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.