LiveKit Integration
Build real-time voice agents with LiveKit Agents powered by 60db’s speech and language services — STT, TTS, and LLM all in one plugin.Speech-to-Text
Real-time streaming transcription via WebSocket with interim results
Text-to-Speech
Low-latency streaming synthesis with chunked audio delivery
LLM Chat
OpenAI-compatible chat completions with tool-call support
Installation
1
Install the plugin
Requires Python 3.10+.
2
Set your API key
Choose one of the following methods:Option A — Environment variable (recommended):Option B — Option C — Pass it directly in code:
.env.local file:Quick Start
Wire all three services together in aVoicePipelineAgent:
Configuration
Environment Variables
All services read from the same environment variables by default. You only need to override them if you use a custom deployment.
Each service also accepts a direct
ws_url (or api_url) constructor argument which takes precedence over environment variables.
Services
- STT
- TTS
- LLM
Speech-to-Text
The STT service streams audio to 60db over WebSocket and returns transcriptions in real time — including interim (partial) results as the speaker is still talking.Parameters
Example
Audio Formats
The plugin automatically handles audio conversion for you — no manual preprocessing needed.Timeouts
Control timeouts per-request by passingAPIConnectOptions:
Error Handling
All three services raise standard LiveKit Agents exceptions:Common HTTP Error Codes (LLM)
Retry Tips
- STT: If you receive an
errormessage during the handshake, reconnect with a short delay. Aconnectingstatus beforeconnection_establishedis normal. - TTS: Retry connection failures with exponential backoff.
- LLM:
httpx.TimeoutException→APITimeoutError;httpx.HTTPStatusError→APIConnectionError.
WebSocket Protocol Reference
STT WebSocket Protocol
STT WebSocket Protocol
Connect:Handshake:Server → Server → Stop:Client →
{"connection_established": true}Client → start command:{"type": "connected"}Audio: Send raw audio as binary WebSocket frames.Transcription response:{"type": "stop"}Server →TTS WebSocket Protocol
TTS WebSocket Protocol
Connect:Create context:Send text:Flush (trigger audio generation):Audio response:Followed by
{"flush_completed": true} when all audio has been delivered.Close context: