Skip to main content
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

Installation

Credentials

You need an SLNG key. The plugin reads it from the SLNG_API_KEY environment variable automatically:
You can also pass it explicitly via 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 format provider/model:variant. Prefix with slng/ to target an SLNG-hosted instance:
Examples:
See the Models page for the full list of available models.

STT reference

slng.STT streams speech-to-text over WebSocket. It supports multi-endpoint failover.

Constructor

Any additional keyword arguments are forwarded as model-specific options. For example, 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 to model_endpoints. If the first one fails, the plugin tries the next in order:

Default endpoint

If model_endpoint is omitted, the plugin connects to:

TTS reference

slng.TTS streams text-to-speech over WebSocket with connection pooling.

Constructor

Additional keyword arguments are forwarded to the chosen model’s init payload. Known keys by provider:
  • 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, but stream() is better for interactive agents.

Default endpoint

If model_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. Pass language="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, use slng/deepgram/nova:3-hi or slng/deepgram/nova:3-multi instead.

Rime Arcana

Requires a voice (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.
Most new SLNG platform models work without plugin updates, but providers with non-standard WebSocket message formats may require plugin support (for example, Sarvam Bulbul needed nested data.audio parsing).

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