livekit-plugins-slng adds STT and TTS adapters for LiveKit Agents. It lets you use any model on the SLNG platform from within a LiveKit agent.
Prerequisites
- Python 3.10+
livekit-agents>=1.5.1- A LiveKit Agents project
- An SLNG key (get one at app.slng.ai)
Installation
Credentials
You need an SLNG key. The plugin reads it from theSLNG_API_KEY environment variable automatically:
api_key:
slng.STT also accepts a legacy api_token= alias, but it is deprecated.
Use api_key in new code.Quickstart
Create an STT and TTS instance, then pass them to your LiveKit agent session:Full voice agent example
This example wires up STT, TTS, and VAD into a complete LiveKit agent that greets the user on join:Model identifiers
Models follow the formatprovider/model:variant. Prefix with slng/ to target an SLNG-hosted instance:
STT reference
slng.STT streams speech-to-text over WebSocket. It supports multi-endpoint failover.
Constructor
target_language_code="hi-IN" to override language normalization for Sarvam STT models, or enable_diarization=True for Deepgram Nova models.
Endpoint failover
Pass a list of endpoints tomodel_endpoints. If the first one fails, the plugin tries the next in order:
Default endpoint
Ifmodel_endpoint is omitted, the plugin connects to:
TTS reference
slng.TTS streams text-to-speech over WebSocket with connection pooling.
Constructor
- Rime Arcana:
modelId,segment,speakingStyle,addBreathing,addDisfluencies,phonemizeBetweenBrackets,translateTo. - Sarvam Bulbul:
pace,temperature,output_audio_bitrate,min_buffer_size,max_chunk_length,target_language_code.
Streaming vs batch
tts.stream()sends text word-by-word and returns audio chunks in real time. Use this for voice agents.tts.synthesize(text)does one-shot synthesis. Works fine for previews, butstream()is better for interactive agents.
Default endpoint
Ifmodel_endpoint is omitted, the plugin connects to:
Voice selection
Pick a voice that matches your chosen model. See the Voices pages for what’s available per provider.Provider notes
Sarvam Bulbul v3 TTS
Works out of the box. The plugin auto-normalizes language codes to BCP-47 on the wire. Passlanguage="hi", the plugin sends "hi-IN" to Sarvam. To override the normalization (e.g. force a different target language), pass target_language_code="..." in model_options.
Sarvam Saaras v3 STT
Saaras on SLNG is HTTP-only (no WebSocket endpoint) and is therefore not supported by this plugin’s realtime streaming path. For Hindi STT in a voice agent, useslng/deepgram/nova:3-hi or slng/deepgram/nova:3-multi instead.
Rime Arcana
Requires avoice (speaker) that matches the chosen language. Passing voice="default" auto-resolves to a reasonable default per language.
The plugin outputs
linear16 PCM audio internally and registers itself with
LiveKit on import. Both STT and TTS authenticate with api_key.Next steps
- Browse available Models for STT and TTS
- Check the Voices pages for voice options per provider
- See Voice Agents for the SLNG-managed agents API