Environment
- livekit-agents: 1.6.0
- Python: 3.11 (uv-managed .venv)
- Running both:
consolemodestart+connect --room test-room(real RoomIO)
- OS: Fedora Linux
- Kokoro-FastAPI running locally on
http://localhost:8880/v1
Goal
Use livekit.plugins.openai.TTS with:
- Local Kokoro-FastAPI (OpenAI-compatible endpoint)
- DeepInfra Kokoro inference TTS endpoint (OpenAI-compatible base_url)
TTS Configuration
tts=openai.TTS(
model="kokoro",
voice="af_alloy",
api_key="not-needed",
base_url="http://localhost:8880/v1",
response_format="wav",
)
For DeepInfra:
tts=openai.TTS(
model="MODEL_NAME",
api_key=os.getenv("DEEPINFRA_API_KEY"),
base_url="https://api.deepinfra.com/v1",
)
No streaming= argument (not supported in 1.6.0).
Observed Error
Consistently receiving:
livekit.agents._exceptions.APIError:
no audio frames were pushed for text: <text>
Logs show:
"streamed": false
The HTTP request does not fail. There are no 4xx or 5xx errors.
Verification Performed
1. Kokoro endpoint works via curl
curl -X POST http://localhost:8880/v1/audio/speech \
-H "Content-Type: application/json" \
-H "Authorization: Bearer not-needed" \
-d '{
"model": "kokoro",
"input": "Hello test",
"voice": "af_alloy",
"response_format": "wav"
}' \
--output test.wav
Result:
- HTTP/1.1 200 OK
- Content-Type: audio/wav
- Transfer-Encoding: chunked
- Valid 16-bit PCM WAV @ 24000 Hz
file test.wavconfirms valid audio
2. Same failure with DeepInfra
Using DeepInfra API key and base_url, same error:
no audio frames were pushed
3. Upgraded Agents
Upgraded from 1.5.17 → 1.6.0.
Same behavior.
4. Tested in both modes
consolemode → fails- Real RTC (
start+connect) → fails
So this is not console-only behavior.
Hypothesis
It appears that:
-
The OpenAI TTS plugin successfully sends the HTTP request.
-
The endpoint returns valid WAV and PCM audio.
-
However, the plugin’s stream adapter never emits decoded audio frames into the LiveKit audio pipeline.
-
This triggers the internal guard that raises:
APIError: no audio frames were pushed
This suggests one of:
- The plugin expects a slightly different OpenAI
/v1/audio/speechresponse contract (e.g., specific headers, framing, content encoding). - The adapter requires a streaming behavior that Kokoro-FastAPI and DeepInfra are not implementing exactly as OpenAI does.
- The WAV returned is valid but not being parsed by the internal TTS stream adapter.
Questions
- Is
livekit.plugins.openai.TTSguaranteed to work with third-party OpenAI-compatible/v1/audio/speechendpoints? - Are there documented requirements for:
- Content-Type
- Transfer-Encoding
- Response framing
- Streaming semantics
- Is there a minimal known-working OpenAI-compatible TTS server implementation that can be used as a reference?
- Is there a recommended way to integrate local TTS models (like Kokoro) without relying on the OpenAI compatibility layer?
Any clarification on the expected /v1/audio/speech contract would be extremely helpful. Or if someone has experimented similar issues.
I really find this weird, since kokoro is listed in LiveKit’s Docs as a plugin you can use easily. Kokoro TTS plugin guide | LiveKit Documentation
PS: I also tried PCM as format and recieve the same error.