Skip to main content
KugelAudio provides an official TTS service for PipeCat, enabling high-quality voice synthesis in your voice AI pipelines.
Python only. Pipecat’s pipeline and TTSService framework is Python-only; there is no JavaScript/TypeScript equivalent to subclass, so the KugelAudio JS SDK does not ship a Pipecat service. Pipecat’s JS package (@pipecat-ai/client-js) is a browser client that connects to a Python Pipecat server over WebRTC/RTVI — run the KugelAudio Pipecat service (below) on that Python server and connect your JS/TS front-end to it. For a fully server-side JS/TS voice agent, use the LiveKit integration, which the JS SDK supports natively via kugelaudio/livekit.

Why Use KugelAudio with PipeCat?

  • Native service: Drop-in TTSService for PipeCat pipelines
  • Persistent WebSocket: Connection reuse keeps the handshake off the hot path
  • Built-in metrics: Automatic TTFB and usage metrics tracking
  • Ultra-low latency: streaming TTS built for real-time agents — see Latency for current TTFA figures

Installation

This installs the KugelAudio SDK along with the required PipeCat dependency (pipecat-ai>=1.0).
The PipeCat integration requires Python 3.10 or higher. Pipecat 1.x is supported; use LLMContext + LLMContextAggregatorPair (see sdks/python/examples/pipecat_local_bot.py).

Quick Start

Basic Pipeline

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

Configuration

Service 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.

Performance Optimization

Pre-warming the Connection

Call prewarm() during pipeline setup to establish the WebSocket connection before the first synthesis request. This keeps the TCP+TLS+WebSocket handshake out of the first call — see Latency.

Turn context pre-provisioning (Pipecat 1.x)

Pipecat 1.x mints a fresh TTS context_id on every assistant turn. The service automatically calls the server’s create_context on LLMFullResponseStartFrame (when the LLM starts responding), before the first TTS text chunk arrives. That hides the WebSocket round-trip behind LLM time-to-first-token instead of adding it to measured TTFA. No configuration required — call prewarm() as usual and ensure language is set.

Setting the Language

When you know the language of your input text, always set the language parameter. Without it, the server auto-detects the language on each request, adding latency — see Latency.
For lowest latency, always set language and call prewarm() — see Latency for what each saves.

Connection Reuse

The service automatically reuses a persistent WebSocket connection across run_tts() calls. This avoids the TCP+TLS+WebSocket handshake overhead on every request. If the connection drops, a new one is established transparently on the next call. Each Pipecat 1.x turn still opens a new server-side context (required for correct turn isolation and to avoid context-cap leaks). Only the WebSocket connection is reused — not the engine KV session across turns.

TTFA logging

When KugelAudio TTFA: appears in logs, it measures text send → first audio chunk on the WebSocket (after any turn-context pre-provision). It does not include LLM or STT latency. End-to-end numbers depend heavily on network path — co-located clients see much lower numbers than remote dev machines. See Latency for reference figures and how to measure correctly.

Usage Patterns

Updating Voice and Model at Runtime

You can change the voice or model dynamically during a pipeline session:

Pipeline Frame Flow

The KugelAudioTTSService emits standard PipeCat frames:
  1. TTSStartedFrame - Audio generation has begun
  2. TTSAudioRawFrame - Raw PCM audio chunks (16-bit, mono)
  3. TTSStoppedFrame - Audio generation is complete
  4. ErrorFrame - If an error occurs during synthesis

Metrics Support

KugelAudio’s PipeCat service automatically tracks performance metrics:

Complete Voice Bot Example

Here’s a complete voice bot using PipeCat with Daily as the transport:

Running the Bot

Environment Variables

Troubleshooting

Make sure KUGELAUDIO_API_KEY is set in your environment or pass api_key directly:
KugelAudio supports these sample rates: 24000, 22050, 16000, 8000. Make sure your transport output sample rate matches:
Verify your base_url is correct and the KugelAudio API is reachable. The service connects via WebSocket (wss://) for audio streaming. If a persistent connection drops, the service automatically reconnects on the next run_tts() call.
Check in order:
  1. language unset — every request pays language auto-detection.
  2. prewarm() not called — the first request pays the WebSocket handshake.
  3. Network path — measuring from a laptop against a remote engine adds your full RTT on top of inference. Exec from the ingress pod or use the production API for apples-to-apples TTFA. See Latency for reference figures.
  4. Pipecat 1.x per-turn contexts — each turn opens a fresh server context (by design). Turn-context pre-provisioning hides the WS setup cost behind LLM latency; it does not remove engine cold-open per turn.
See Performance Optimization and Measuring TTFA correctly.
The PipeCat integration requires Python 3.10 or higher. Check your version:

Next Steps

LiveKit Integration

Use KugelAudio with LiveKit Agents

Streaming

Advanced streaming techniques