Plugin / version
livekit-plugins-xai 1.6.0, livekit-agents 1.6.0, Python 3.13
Verified on the latest release: inspected the livekit-plugins-xai 1.6.0 wheel from PyPI (uploaded 2026-06-11) and the current main branch (livekit-plugins/livekit-plugins-xai/livekit/plugins/xai/tts.py) — TTS.__init__ and _connect_ws are unchanged; none of the parameters below are exposed. Behavior was originally observed in production on 1.5.17, which is code-identical.
Problem
xAI's TTS WebSocket endpoint (wss://api.x.ai/v1/tts) accepts several connection query parameters documented in the xAI TTS docs:
optimize_streaming_latency (0/1/2) — first-chunk latency mode
speed (0.7–1.5) — speaking-rate multiplier
text_normalization (bool) — spoken-form normalization of numbers/abbreviations
The plugin's TTS.__init__ only accepts api_key, voice, language, tokenizer, http_session (keyword-only, no **kwargs), and _connect_ws sends only voice, language, codec, sample_rate. There is no way to set any of the parameters above — passing them raises TypeError: __init__() got an unexpected keyword argument.
Why it matters
optimize_streaming_latency in particular has a large effect on real-time voice agents. Measured against the live endpoint (same text, voice ara, 4 runs each):
| level |
generation TTFB |
| 0 (plugin's effective behavior) |
mean 741 ms |
| 2 |
mean 379 ms |
For a voice-agent use case this nearly halves TTS time-to-first-byte, but plugin users are stuck on the slowest setting.
Expected behavior
TTS.__init__ exposes these documented parameters (and forwards them as WS query params), similar to how other TTS plugins expose their providers' generation options.
Plugin / version
livekit-plugins-xai1.6.0,livekit-agents1.6.0, Python 3.13Verified on the latest release: inspected the
livekit-plugins-xai1.6.0 wheel from PyPI (uploaded 2026-06-11) and the currentmainbranch (livekit-plugins/livekit-plugins-xai/livekit/plugins/xai/tts.py) —TTS.__init__and_connect_wsare unchanged; none of the parameters below are exposed. Behavior was originally observed in production on 1.5.17, which is code-identical.Problem
xAI's TTS WebSocket endpoint (
wss://api.x.ai/v1/tts) accepts several connection query parameters documented in the xAI TTS docs:optimize_streaming_latency(0/1/2) — first-chunk latency modespeed(0.7–1.5) — speaking-rate multipliertext_normalization(bool) — spoken-form normalization of numbers/abbreviationsThe plugin's
TTS.__init__only acceptsapi_key,voice,language,tokenizer,http_session(keyword-only, no**kwargs), and_connect_wssends onlyvoice,language,codec,sample_rate. There is no way to set any of the parameters above — passing them raisesTypeError: __init__() got an unexpected keyword argument.Why it matters
optimize_streaming_latencyin particular has a large effect on real-time voice agents. Measured against the live endpoint (same text, voiceara, 4 runs each):For a voice-agent use case this nearly halves TTS time-to-first-byte, but plugin users are stuck on the slowest setting.
Expected behavior
TTS.__init__exposes these documented parameters (and forwards them as WS query params), similar to how other TTS plugins expose their providers' generation options.