Overview
SLNG is a third-party gateway that proxies STT requests to underlying providers (such as Deepgram and Sarvam) through a unified API. The plugin streams audio to the gateway 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 STT in an AgentSession or as a standalone transcription service. For example, you can use this STT in the Voice AI quickstart. Pass a model identifier or a connections fallback chain.
from livekit.plugins import slngsession = AgentSession(stt=slng.STT(model="deepgram/nova:3",),# ... llm, tts, 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 .
connectionslist[str | STTConnectionConfig]An ordered fallback chain. Each entry is a model identifier, a bridge endpoint URL, or an STTConnectionConfig. The plugin uses the first entry as the primary and falls back to a later entry when a connection fails, replaying buffered audio onto the new connection.
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 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 audio. The plugin sends this value to the model as given, so use the exact code the model expects (for example, BCP-47 hi-IN for Sarvam). Supported values depend on the selected model.
final_timeout_sfloat | NoneDefault: NoneSets a watchdog timeout, in seconds. If a provider stalls without returning a final transcript, the plugin recovers the stream instead of waiting indefinitely. Disabled by default. The watchdog starts only when the plugin is notified that the user stopped speaking, so it has no effect unless you configure end-of-turn finalization.
End-of-turn finalization
For the lowest turn latency, tell the plugin when the user stops speaking. It then signals the gateway to finalize immediately, so the provider returns the final transcript instead of waiting for its own endpointing. Attach the STT to your session:
stt = slng.STT(model="deepgram/nova:3")session = AgentSession(stt=stt,# ... llm, tts, etc.)stt.attach_to_session(session)
Or forward the user state change yourself:
@session.on("user_state_changed")def _on_user_state_changed(ev):stt.notify_user_state(ev.new_state)
Updating options
To change recognition options during a session, call update_options. It accepts language, enable_partial_transcripts, enable_diarization, buffer_size_seconds, and the VAD parameters (vad_threshold, vad_min_silence_duration_ms, vad_speech_pad_ms). Changes propagate to the active recognition stream:
session.stt.update_options(vad_threshold=0.6)
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.
stt = slng.STT(model="deepgram/nova:3")@stt.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 TTS
Guide to the SLNG TTS plugin with LiveKit Agents.