# Sarvam (/en/ai/platform/models/tts/sarvam)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

> Documentation: Conversational AI.
> Documentation version: Preview.
> This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt).


Sarvam provides fast, reliable text-to-speech (TTS) with support for Indian languages and customizable voices.

## Sample configuration

The following example shows how to configure Sarvam as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent).

Sarvam supports BYOK only. It isn't available in managed mode. Store your Sarvam API subscription key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys).

**Python SDK**

```python
from agora_agent import Agent, SarvamTTS, secret_ref

# client is your configured Agora client
agent = (
    Agent(client=client)
    .with_stt(...)  # configure your ASR vendor
    .with_llm(...)  # configure your LLM vendor
    .with_tts(
        SarvamTTS(
            key=secret_ref("support_prod", "sarvam"),
            speaker="anushka",
            target_language_code="en-IN",
        )
    )
)
```

**TypeScript SDK**

```ts
import { Agent, SarvamTTS, secretRef } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(/* configure your ASR vendor */)
  .withLlm(/* configure your LLM vendor */)
  .withTts(
    new SarvamTTS({
      key: secretRef('support_prod', 'sarvam'),
      speaker: 'anushka',
      targetLanguageCode: 'en-IN',
    }),
  );
```

**Go SDK**

```go
// client is your configured Agora client
agent := agentkit.NewAgent(client).
	WithStt( /* configure your ASR vendor */ ).
	WithLlm( /* configure your LLM vendor */ ).
	WithTts(vendors.NewSarvamTTS(vendors.SarvamTTSOptions{
		Key:                agentkit.SecretRef("support_prod", "sarvam"),
		Speaker:            "anushka",
		TargetLanguageCode: "en-IN",
	}))
```

**REST API**

Set `credential.mode` to `byok` and `credential.fields.api_subscription_key` to a reference to your Sarvam API subscription key in a secret set. In the following example, the key is stored as `sarvam` in the `support_prod` set:

```json
"tts": {
  "credential": {
    "mode": "byok",
    "fields": {
      "api_subscription_key": "$secrets.support_prod.sarvam"
    }
  },
  "vendor": "sarvam",
  "params": {
    "model": "bulbul:v3",
    "speaker": "anushka",
    "target_language_code": "en-IN"
  }
}
```

## Key parameters

The `tts` block takes the following fields. In the SDKs, the Sarvam TTS class sets them from its options.

**tts**

**`vendor` (string) required**

Set to `sarvam`.

**`credential` (object) required**

Set `mode` to `byok` and `fields.api_subscription_key` to a `$secrets.<set>.<key>` reference to your Sarvam API subscription key. Get your key from the [Sarvam dashboard](https://dashboard.sarvam.ai/signin).

**`params` (object) required**

**`model` (string) required**

The Sarvam text-to-speech model. Set to `bulbul:v3`.

**`speaker` (string) required**

The voice ID to use for speech generation.

- Female voices: `anushka`, `manisha`, `vidya`, `arya`.
- Male voices: `abhilash`, `karun`, `hitesh`.

**`target_language_code` (string) required**

The language code for speech synthesis. Supported values:

- `en-IN`: English (India)
- `hi-IN`: Hindi
- `bn-IN`: Bengali
- `ta-IN`: Tamil
- `te-IN`: Telugu
- `kn-IN`: Kannada
- `ml-IN`: Malayalam
- `mr-IN`: Marathi
- `gu-IN`: Gujarati
- `pa-IN`: Punjabi
- `or-IN`: Odia

**`pitch` (number) optional**

Possible values: `[-0.75,0.75]`

The pitch adjustment for the voice. Positive values make the voice sharper; negative values make it deeper.

**`pace` (number) optional**

Possible values: `[0.3,3.0]`

The speed of speech. `1.0` is the normal speed. Values less than `1.0` slow down the speech; values greater than `1.0` speed it up.

**`loudness` (number) optional**

Possible values: `[0.1,3.0]`

The volume level of the speech. Higher values increase the loudness.

**`sample_rate` (number) optional**

Possible values: `8000, 16000, 22050, 24000`

The audio sample rate in Hz.

> **Caution**
>
> The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Sarvam without validation. For a full list of supported options, refer to the [Sarvam documentation](https://docs.sarvam.ai/api-reference-docs/text-to-speech/convert).

This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads.
