pipecat-slng adds STT and TTS services for Pipecat. It routes
your pipeline through the SLNG gateway, so you can use any STT or TTS model on SLNG — Deepgram,
ElevenLabs, Rime, Sarvam, and more — behind one API key. Swap the model string to switch provider; no
other code changes needed.
Tested with Pipecat v1.3.0. BYOK requires
pipecat-slng 0.4.0 or later.Prerequisites
- Python 3.11+
pipecat-ai>=1.3.0- A Pipecat project
- An SLNG API key (get one at app.slng.ai)
Installation
Credentials
You need an SLNG API key. Read it from theSLNG_API_KEY environment variable:
api_key:
Quickstart
Create an STT and TTS service, then add them to your Pipecat pipeline:SlngSTTService and SlngTTSService stream over WebSocket: low latency, with mid-utterance
interruption support. Common runtime knobs are top-level keyword arguments (language, speed,
enable_vad, enable_partials). For richer overrides, pass a SlngSTTSettings(...) or
SlngTTSSettings(...) to settings=.
Region routing
Both services support gateway region routing. Pin requests to a specific datacenter withregion_override, or constrain them to a broad geographic zone with world_part_override. When both
are set, region_override wins.
X-Region-Override and X-World-Part-Override headers; the
HTTP service (below) sends them as the region and world-part query parameters.
See the full region list and override behavior at docs.slng.ai/region-override.
Bring your own key (BYOK)
If you already have a contract with an upstream provider, pass your own provider key viaprovider_key. All three services forward it as the X-Slng-Provider-Key header — on the WebSocket
upgrade for the streaming services, on each request for SlngHttpTTSService — so the provider bills
your account directly and no SLNG audio-minute fees apply, while the SLNG cache still applies on top.
See Bring your own key for caching behavior and the supported provider list.
backend_connection_failed
error frame over WebSocket, or as the upstream 401/403 with the X-Slng-Auth-Source: client_key
response header over HTTP. Since pipecat-slng 0.4.0, WebSocket connect-rejection errors include the
server’s response body, so a misrouted BYOK request reports the reason rather than a bare HTTP 400.
Full voice agent example
A complete cascade pipeline — Speech-to-Text → LLM → Text-to-Speech — using SLNG for STT and TTS and OpenAI for the LLM. The bot introduces itself when a client connects:examples/bot.py. Run it with:
http://localhost:7860/client and start talking. It uses the SmallWebRTC transport by
default; pass -t daily to use Daily instead (requires pipecat-ai[daily]). Setting
SLNG_PROVIDER_KEY (your own Deepgram key) in .env flips the example into
BYOK mode on the external deepgram/nova:3 / deepgram/aura:2 routes.
Model identifiers
Models follow the formatprovider/model:variant. Prefix with slng/ to target an SLNG-hosted instance,
and suffix the language where the model exposes per-language variants:
slng/ prefix are external routes, proxied to the provider’s own API:
model= is
the bridge’s supported-models list — see Supported models. Not every
model accepts every option (for example speed on TTS); check the
parameter coverage table before tuning.
STT reference
SlngSTTService streams speech-to-text over WebSocket, connecting to
wss://api.slng.ai/v1/bridges/unmute/stt/{model}.
Constructor
Language is imported from pipecat.transcriptions.language.
Confidence filter
When the provider surfaces a confidence score, transcripts below0.5 are dropped before reaching your
pipeline.
Default endpoint
The plugin connects to:TTS reference (streaming)
SlngTTSService streams text-to-speech over WebSocket, connecting to
wss://api.slng.ai/v1/bridges/unmute/tts/{model}. This is the recommended path for interactive voice
agents.
Constructor
Runtime settings updates
Changingvoice, speed, or language mid-session (via Pipecat settings updates) reconnects the
WebSocket to re-run the init handshake. Expect a brief reconnect, not a silent no-op.
Default endpoint
The plugin connects to:Voice selection
Pick a voice that matches your chosen model. See the Voices pages for what’s available per provider.HTTP TTS (non-streaming fallback)
For simple request/response synthesis where streaming is not required, useSlngHttpTTSService. It
issues one HTTP POST per utterance and returns the full audio body in a single frame.
ErrorFrame — use the
streaming SlngTTSService if you need codec control. Pass aiohttp_session= to reuse a shared
aiohttp.ClientSession; otherwise one is created internally.
Region routing on the HTTP service uses the region and world-part query parameters instead of
headers. BYOK works here too: pass provider_key and it is sent as the
X-Slng-Provider-Key header on each request (external routes only).
Good to know
Both WebSocket services output
linear16 PCM by default and authenticate with api_key. The package
exports SlngSTTService, SlngTTSService, and SlngHttpTTSService, plus the SlngSTTSettings and
SlngTTSSettings settings classes.Next steps
- Browse the supported models and parameter coverage for the Unmute bridge
- Read Bring your own key for BYOK caching behavior and supported providers
- Check the Voices pages for voice options per provider
- See Voice Agents for the SLNG-managed agents API
- Using LiveKit instead? See the LiveKit plugin