Skip to main content

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 — .env.local file:
Option C — Pass it directly in code:

Quick Start

Wire all three services together in a VoicePipelineAgent:

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

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 passing APIConnectOptions:

Error Handling

All three services raise standard LiveKit Agents exceptions:

Common HTTP Error Codes (LLM)

Retry Tips

  • STT: If you receive an error message during the handshake, reconnect with a short delay. A connecting status before connection_established is normal.
  • TTS: Retry connection failures with exponential backoff.
  • LLM: httpx.TimeoutExceptionAPITimeoutError; httpx.HTTPStatusErrorAPIConnectionError.

WebSocket Protocol Reference

Connect:
Handshake:Server → {"connection_established": true}Client → start command:
Server → {"type": "connected"}Audio: Send raw audio as binary WebSocket frames.Transcription response:
Stop:Client → {"type": "stop"}Server →
Connect:
Create context:
Send text:
Flush (trigger audio generation):
Audio response:
Followed by {"flush_completed": true} when all audio has been delivered.Close context: