Skip to main content

Sarvam TTS integration guide

How to use the Sarvam TTS plugin for LiveKit Agents.

Overview

Sarvam provides high-quality text-to-speech technology optimized for Indian languages. With LiveKit's Sarvam integration and the Agents framework, you can build voice AI agents that sound natural in Indian languages.

Quick reference

This section provides a quick reference for the Sarvam TTS plugin. For more information, see Additional resources.

Installation

Install the plugin from PyPI:

pip install "livekit-agents[sarvam]~=1.0"

Authentication

The Sarvam plugin requires a Sarvam API key.

Set SARVAM_API_KEY in your .env file.

Usage

Use Sarvam TTS within an AgentSession or as a standalone speech generator. For example, you can use this TTS in the Voice AI quickstart.

from livekit.plugins import sarvam
session = AgentSession(
tts=sarvam.TTS(
target_language_code="hi-IN",
speaker="anushka",
)
# ... llm, stt, etc.
)

Parameters

This section describes some of the available parameters. See the plugin reference for a complete list of all available parameters.

target_language_codestringRequired

BCP-47 language code for supported Indian languages. For example: hi-IN for Hindi, en-IN for Indian English. See documentation for a complete list of supported languages.

modelstringOptionalDefault: bulbul:v2

The Sarvam TTS model to use. Currently only bulbul:v2 is supported. See documentation for a complete list of supported models.

speakerstringOptionalDefault: anushka

Voice to use for synthesis. See documentation for a complete list of supported voices.

pitchfloatOptionalDefault: 0.0

Voice pitch adjustment. Valid range: -20.0 to 20.0.

pacefloatOptionalDefault: 1.0

Speech rate multiplier. Valid range: 0.5 to 2.0.

loudnessfloatOptionalDefault: 1.0

Volume multiplier. Valid range: 0.5 to 2.0.

Additional resources

The following resources provide more information about using Sarvam with LiveKit Agents.