Pipecat
Use Svara as the TTS service in a Pipecat pipeline.
Overview
Pipecat builds voice agents as a pipeline of frame processors. Svara plugs in as the TTS service through the official Python SDK: from svara.pipecat import SvaraTTSService. Everything else — transport, STT, LLM, VAD, turn-taking — is stock.
The service streams 24 kHz, 16-bit, mono PCM by default. Set the transport’s audio_out_sample_rate to match and nothing resamples on the hot path; for telephony transports construct it with response_format="ulaw", sample_rate=8000 and the G.711 bytes drop straight onto the call leg.
The TTS service
Pipecat’s base class aggregates the LLM output into sentences and calls the service once per sentence; each sentence streams back over HTTP as it synthesizes, with TTFB metrics wired in.
pip install "svara-voice[pipecat] @ git+https://github.com/kenpath-labs/svara-python.git"pipecat-ai version. The service’s source is one small file (svara/pipecat/__init__.py) if you need to adapt it.Wiring the pipeline
Put the service where the TTS goes. Nothing else here is Svara-specific; swap STT or LLM for any other Pipecat service.
pip install 'pipecat-ai[openai,silero,webrtc]' pipecat-ai-prebuilt| Parameter | Type | Default | Description |
|---|---|---|---|
| SVARA_API_KEY | env | - | Your Svara key (the SDK reads it automatically). |
| SVARA_BASE_URL | env | https://api.kenpathlabs.com | The gateway origin; override for a regional pin (api-in, api-us, api-eu). |
| OPENAI_API_KEY | env | - | For the stock STT and LLM services. |
python bot.py starts the dev runner and serves a prebuilt WebRTC client at /client — no media account needed.
Token streaming
The service above receives whole sentences — Pipecat’s default text aggregation. To speak while the LLM is still writing, the underlying SDK client exposes the input-streaming WebSocket directly: client.speech.stream_input(token_stream, …) takes any async iterator of text deltas and yields PCM as the model speaks. Pair it with TextAggregationMode.TOKEN and append_to_audio_context() in a custom processor; a first-class eager mode for SvaraTTSService is on the SDK roadmap.
Gotchas
- Use the gateway host.
https://api.kenpathlabs.comserves the API; the console host does not. - VAD is not a transport settingin Pipecat 1.6. It moved to
LLMUserAggregatorParams(vad_analyzer=…), along withuser_turn_strategies. Passing it toTransportParamsfails validation. PipelineTaskandPipelineRunnerare deprecated in favour ofPipelineWorkerandWorkerRunner. They are drop-in.- The prebuilt UI package is
pipecat-ai-prebuilt. Install the wrong one and the server starts, prints “Bot ready”, and serves 404 at/client. - Errors surface as
ErrorFrames with Svara’s status inside (rate_limit_exceeded,too_many_concurrent_requests,insufficient_quota) — three different situations that call for three different responses. - Leave the sampling knobs alone. The server fills serving-tuned defaults; per-bot overrides are how long utterances start to ramble.