I’m testing the new xAI TTS integration in LiveKit Agents and consistently getting TTS failures in a normal voice-agent flow.
What I’m seeing
The agent generates text, but TTS fails with:
failed to synthesize speech: message=‘Invalid response status’, status_code=403, retryable=False
and then:
livekit.agents._exceptions.APIError: no audio frames were pushed for text: …
The runtime log identifies the TTS implementation as:
“tts”: “livekit.plugins.xai.tts.TTS”
Why I’m posting
I noticed a mismatch between the LiveKit xAI plugin source and xAI’s current public TTS streaming docs.
LiveKit plugin source
The xAI TTS plugin source uses:
XAI_WEBSOCKET_URL = “wss://api.x.ai/v1/realtime/audio/speech”
xAI public docs
xAI’s public TTS docs currently document streaming TTS at:
wss://api.x.ai/v1/tts
Docs:
https://docs.x.ai/developers/model-capabilities/audio/text-to-speech
Important detail
Unary TTS works with the same xAI API key outside LiveKit:
curl -X POST https://api.x.ai/v1/tts
-H “Authorization: Bearer $XAI_API_KEY”
-H “Content-Type: application/json”
-d ‘{“text”:“Hello world”,“voice_id”:“ara”,“language”:“en”}’
This returns 200, so the key is valid for xAI TTS at least on the REST path.
Questions
-
Is livekit.plugins.xai.tts.TTS intentionally supposed to use wss://api.x.ai/v1/realtime/audio/speech?
-
If yes, is that endpoint officially supported by xAI today, and where is it documented?
-
If no, should the plugin be using wss://api.x.ai/v1/tts instead?
-
Does the 403 + no audio frames were pushed pattern match a known issue with the new xAI TTS plugin?
Context
I’m likely running livekit-agents 1.4.6+ because the runtime is instantiating livekit.plugins.xai.tts.TTS, and xAI TTS appears to have been added in the March 16 release.
Relevant PRs:
https://github.com/livekit/agents/pull/5120
https://github.com/livekit/agents/pull/5122