Overview
SLNG is a third-party gateway that proxies TTS requests to underlying providers (such as Deepgram and Rime) through a unified API. The plugin streams synthesized audio over WebSocket through SLNG's Unmute Bridge, and routes requests across regions using a single API key.
Installation
Install the plugin:
uv add "livekit-agents[slng]~=1.6"
Authentication
The SLNG plugin requires a SLNG API key. Sign up at slng.ai to get one.
Set SLNG_API_KEY in your .env file.
Usage
Use SLNG TTS in an AgentSession or as a standalone speech generator. For example, you can use this TTS in the Voice AI quickstart. Pass a model identifier or a connections fallback chain, along with a voice.
from livekit.plugins import slngsession = AgentSession(tts=slng.TTS(model="deepgram/aura:2",voice="aura-2-thalia-en",),# ... llm, stt, etc.)
Parameters
This section describes some of the available parameters. See the plugin reference for a complete list of all available parameters.
api_keystringEnv: SLNG_API_KEYSLNG API key. Required if the environment variable isn't set.
modelstringThe SLNG model identifier in <provider>/<model>[:variant] format. You must provide either model or connections. For a list of supported provider and model identifiers, see the SLNG documentation .
voicestringThe provider-native voice identifier to synthesize with. Valid values depend on the selected model and provider. For supported voices, see the SLNG documentation .
connectionslist[str | TTSConnectionConfig]An ordered fallback chain. Each entry is a model identifier, a bridge endpoint URL, or a TTSConnectionConfig. The plugin uses the first entry as the primary and falls back to later entries before the first audio of a segment.
provider_api_keystringForwards a provider credential to the gateway as the X-Slng-Provider-Key header, so you can use your own key with external providers.
slng_base_urlstringDefault: api.slng.aiThe SLNG gateway host. Override this only if you need to use a custom deployment.
region_overridestring | list[str]Pin requests to one or more SLNG regions, as a single region code or a priority-ordered list. Sent to the gateway as the X-Region-Override header. For the supported region codes, see the SLNG documentation .
world_part_overridestringConstrain routing to a broad geographic zone (for example, eu, na, or ap) when an exact region isn't required. Sent to the gateway as the X-World-Part-Override header. region_override takes precedence if you set both.
languagestringDefault: enLanguage code for the input text. The plugin sends this value to the model as given, so use the exact code the model expects (for example, a BCP-47 code such as es-ES). Supported values depend on the selected model.
speedfloatDefault: 1.0Speed multiplier for the generated audio.
Updating options
To change synthesis options during a session, call update_options. It accepts voice, language, and speed. Changes close the current connection pool and take effect on the next utterance:
session.tts.update_options(speed=1.25)
Plugin events
The plugin emits slng_event notifications for gateway session IDs and fallback activity. Each event is a PluginEvent with name, component, level, and data fields.
tts = slng.TTS(model="deepgram/aura:2", voice="aura-2-thalia-en")@tts.on("slng_event")def _on_slng_event(ev):print(f"{ev.component} {ev.name}: {ev.data}")
Additional resources
The following resources provide more information about using SLNG with LiveKit Agents.
Python package
The livekit-plugins-slng package on PyPI.
Plugin reference
Reference for the SLNG plugin.
GitHub repo
View the source or contribute to the LiveKit SLNG plugin.
SLNG docs
SLNG's full docs site.
Voice AI quickstart
Get started with LiveKit Agents and SLNG.
SLNG STT
Guide to the SLNG STT plugin with LiveKit Agents.