Skip to main content
KugelAudio provides an official plugin for the LiveKit Agents framework, enabling ultra-low latency text-to-speech in your voice AI agents.

Why Use KugelAudio with LiveKit?

  • Native plugin: Drop-in TTS provider for LiveKit’s AgentSession
  • Streaming support: Real-time WebSocket-based audio streaming
  • Ultra-low latency: streaming TTS built for real-time agents — see Latency for current TTFA figures
  • Simple setup: Works with VoicePipelineAgent and the new AgentSession API

Installation

This installs the KugelAudio SDK along with the required LiveKit Agents dependencies (livekit-agents>=1.0.0).

Quick Start

Minimal Voice Agent

Set the KUGELAUDIO_API_KEY environment variable or pass api_key directly to the TTS constructor.

JavaScript / TypeScript

The KugelAudio JS/TS SDK ships the same plugin for LiveKit Agents for Node.js. Import it from the kugelaudio/livekit subpath.

Installation

@livekit/agents and its peer @livekit/rtc-node are optional peer dependencies of kugelaudio — they are only required when you import kugelaudio/livekit. The core kugelaudio client never loads them.

Quick Start

Set the KUGELAUDIO_API_KEY environment variable or pass apiKey to the TTS constructor. A full runnable worker lives at sdks/js/examples/livekit_agent.ts.

TTS Options (JS/TS)

Options are camelCase and otherwise mirror the Python plugin:

Streaming, one-shot, and runtime updates (JS/TS)

Configuration

TTS Parameters

Supported Sample Rates

Use the native 24000 Hz sample rate for best quality and lowest latency. Lower rates use server-side resampling with negligible impact — see Latency.

Models

Use kugel-3 — the current production model for all use cases (voice agents, narration, brand voices). See Models for capabilities and Latency for TTFA figures. See Models for the full comparison.

Usage Patterns

Non-Streaming Synthesis

Use synthesize() for one-shot text-to-speech:

Streaming Synthesis

Use stream() for real-time text input (e.g., from an LLM):

Setting the Language

Set language to skip server-side auto-detection on every request (see Latency):
Supported languages: de, en, fr, es, it, pt, nl, pl, sv, da, no, fi, cs, hu, ro, el, uk, bg, tr, vi, ar, hi, zh, ja, ko.
Always set language when you know the output language in advance. This is especially important for real-time voice agents where every millisecond counts.

Updating Options at Runtime

You can change TTS options dynamically without creating a new instance:

Word-Level Alignment

Word timestamps are off by default (including for kugel-3), which avoids server-side post-processing errors on models where alignment is not yet supported. When you set word_timestamps=True, the server performs forced alignment on each audio chunk and delivers per-word timing alongside the audio. LiveKit’s AgentSession uses these timings for barge-in and transcript sync via the aligned_transcript capability (advertised only when timestamps are enabled).
Word alignments add no extra audio latency when supported. Timestamps are delivered shortly after each audio chunk — see Word timestamps.
If synthesis fails with “Audio post-processing failed”, keep word_timestamps=False (the default) or switch to a model that supports alignment.

Plugin Registration

You can also register KugelAudio as a LiveKit plugin namespace:

Complete Voice Agent Example

Here’s a production-ready voice agent with metrics logging:

Running the Agent

Environment Variables

Troubleshooting

Make sure KUGELAUDIO_API_KEY is set in your environment or pass api_key directly:
Verify your base_url is correct and the KugelAudio API is reachable. The plugin connects via WebSocket (wss://) for audio streaming.
  • Use the native 24000 Hz sample rate for best results
  • Try increasing cfg_scale (e.g., 2.5) for more expressive output
  • Switch to kugel-3 model for premium quality
  • Set language explicitly (e.g. language="de") to skip auto-detection — see Latency
  • Use kugel-3 for real-time conversations when latency matters more than prosody
  • Lower cfg_scale (e.g., 1.5) trades slight quality for speed
  • Reuse http_session across requests to avoid connection overhead

Next Steps

PipeCat Integration

Use KugelAudio with PipeCat pipelines

Streaming

Advanced streaming techniques