# Sarvam AI

> Translate and transliterate text, work with speech and voice libraries, and call Sarvam language models.

App · 20 actions. Web page: https://docs.lodol.com/docs/integrations/sarvam-ai

## Actions

### Convert text to speech

Convert text to speech.

**Inputs**

- Text (`text`, text, required): Text.
- Language code (`language_code`, text, required): The language code in BCP-47 format. One of: `bn-IN`, `en-IN`, `gu-IN`, `hi-IN`, `kn-IN`, `ml-IN`, `mr-IN`, `od-IN`, `pa-IN`, `ta-IN`, `te-IN`.
- Speaker (`speaker`, text): Speaker. One of: `anushka`, `abhilash`, `manisha`, `vidya`, `arya`, `karun`, `hitesh`, `aditya`, `ritu`, `priya`, and 256 more.
- Pace (`pace`, number): Controls the speed of the audio. Lower values result in slower speech, while higher values make it faster. Default is 1.0. **Model-specific ranges:** - **bulbul:v3:** 0.5 to 2.0 - **bulbul:v4-flash:** 0.5 to 2.0 - **bulbul:v2:** 0.3 to 3.0. From 0.3 to 3.
- Model (`model`, text): Model. One of: `bulbul:v2`, `bulbul:v3`, `bulbul:v4-flash`.
- Output audio codec (`output_audio_codec`, text): Specifies the audio codec for the output audio file. Different codecs offer various compression and quality characteristics. **Note:** On `/text-to-speech` with **bulbul:v3** and **bulbul:v4-flash**, `opus` is listed for schema compatibility but currently returns a validation error; use `wav`, `mp3`, `aac`, `flac`, or `linear16`. One of: `mp3`, `linear16`, `mulaw`, `alaw`, `opus`, `flac`, `aac`, `wav`.
- Dict ID (`dict_id`, text): Dict id.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "audios": [
      "example"
    ],
    "request_id": "example"
  }
}
```

### Create a chat completion

Create a chat completion.

**Inputs**

- Messages (`messages`, list, required): Non-empty conversation history. Roles: `system`, `developer`, `user`, `assistant`, `tool`. Content is a string or an array of parts (`text`, `image_url`). Images must use inline `data:image/…;base64,…` URLs. Inline image URLs are required.
- Model (`model`, text, required): Model. One of: `sarvam-105b`, `sarvam-105b-conversations`, `glm5.3`, `glm5.3-flash`, `gemma4`, `deepseekv4.1-flash-1017`, `deepseekv4.1-flash-1017-interactive`, `deepseekv4-pro`, `kimi-k3.1-pro`, `qwen38-27b`.
- Temperature (`temperature`, number): Sampling temperature from `0` to `2`. Higher values increase variation; lower values focus the output. Output is not guaranteed to be identical across requests, even at `0`. Prefer changing either `temperature` or `top_p`, not both. From 0 to 2.
- Top p (`top_p`, number): Nucleus sampling: greater than `0` and at most `1`. On `glm5.3`, `top_p: 0` is rejected. Prefer changing either `top_p` or `temperature`, not both. At most 1.
- Reasoning effort (`reasoning_effort`, text): Reasoning effort. One of: `none`, `low`, `medium`, `high`, `max`.
- Max tokens (`max_tokens`, number): Maximum tokens to generate in the completion, including reasoning tokens on reasoning models. Default `2048`. Set explicitly when you need longer answers. A low limit can yield `finish_reason: "length"` with little or no visible `content` if reasoning consumes the budget. At least 1.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "choices": [
      {
        "finish_reason": "stop",
        "index": 1,
        "logprobs": {},
        "message": {
          "content": "example",
          "reasoning_content": "example",
          "refusal": "example",
          "role": "assistant",
          "tool_calls": [
            {}
          ]
        }
      }
    ],
    "created": 1,
    "id": "example",
    "model": "example",
    "object": "chat.completion",
    "service_tier": "example",
    "system_fingerprint": "example",
    "usage": {
      "completion_tokens": 1,
      "completion_tokens_details": {
        "reasoning_tokens": 1
      },
      "prompt_tokens": 1,
      "prompt_tokens_details": {
        "cached_tokens": 1
      },
      "total_tokens": 1
    }
  }
}
```

### Create a custom voice

Create a custom voice.

**Inputs**

- File (`file`, text, required): Reference audio file used to create the cloned voice. Supported formats: WAV, MP3, FLAC, OPUS, AAC, MULAW, ALAW, LINEAR16. WAV is recommended. Limits: max file size 50 MB. Recommended duration is 10-15 seconds, single speaker, minimal background noise.
- Name (`name`, text, required): Display name for the cloned voice (1-100 characters).
- Language (`language`, text, required): BCP-47 language code of the reference audio (e.g. `en-IN`, `hi-IN`). The transcript is auto-generated via ASR; you do not need to pass it.
- Style (`style`, text): Optional speaking style for the cloned voice. One of: `conversational`, `audiobooks`, `entertainment`, `sales`.
- Gender (`gender`, text): Optional gender tag for the cloned voice. One of: `male`, `female`.
- Remove background noise (`remove_background_noise`, true/false): Remove background noise from the reference audio before saving. Uses ML-powered vocal extraction to isolate the speaker's voice. Defaults to `true`. Pass `false` to keep the original clip.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "data": {
      "background_noise_removed": true,
      "reference_text": "example",
      "status": "example",
      "voice_id": "example"
    },
    "status": "example"
  }
}
```

### Delete a custom voice

Delete a custom voice.

**Inputs**

- Voice (`voice_id`, text, required): ID of the cloned voice to delete.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {}
}
```

### Delete a pronunciation dictionary

Delete a pronunciation dictionary.

**Inputs**

- Dict ID (`dict_id`, text, required): ID of the dictionary to delete.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "message": "example",
    "success": true
  }
}
```

### Detect a speech watermark

Detect a speech watermark.

**Inputs**

- File (`file`, text, required): Audio clip to analyse. Supported formats include WAV, MP3, FLAC, OGG, M4A, and WebM. Max file size 10 MB. Analysis uses at most the first 120 seconds.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "data": {
      "algorithm_version": "example",
      "analysed_seconds": 1,
      "inconclusive": true,
      "n_pairs_scored": 1,
      "p_value": 1,
      "probability": 1,
      "verdict": "watermarked",
      "z_score": 1
    },
    "status": "example"
  }
}
```

### Get a language model

Get a language model.

**Inputs**

- Model (`model_id`, text, required): A model ID from `GET /v2/models`, e.g. `glm5.3`.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "access": "standard",
    "created": 1,
    "id": "example",
    "object": "model",
    "owned_by": "example"
  }
}
```

### Get a pronunciation dictionary

Get a pronunciation dictionary.

**Inputs**

- Dict ID (`dict_id`, text, required): Dict id.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "pronunciations": {}
  }
}
```

### Get a voice

Get a voice.

**Inputs**

- Voice (`voice_id`, text, required): ID of the cloned voice.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "data": {
      "accent": "example",
      "created_at": "example",
      "created_by": "example",
      "created_by_email": "example",
      "created_by_name": "example",
      "descriptor": "example",
      "gender": "example",
      "has_preview": true,
      "id": "example",
      "is_favorited": true,
      "language": "example",
      "metadata": {},
      "name": "example",
      "noise_reduction_applied": true,
      "preview_audio_url": "example",
      "previews": [
        {
          "audio_url": "example",
          "duration": 1,
          "text": "example"
        }
      ],
      "recorded_audio_url": "example",
      "reference_audio_url": "example",
      "reference_text": "example",
      "sample_duration_seconds": 1,
      "source": "example",
      "status": "example",
      "tags": [
        "example"
      ]
    },
    "status": "example"
  }
}
```

### Get document processing capabilities

Get document processing capabilities.

**Inputs**: None.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "api_contract": "example",
    "features": {},
    "input_formats": [
      "example"
    ],
    "inspection_policies": [
      "example"
    ],
    "limits": {
      "max_categories": 1,
      "max_inline_result_bytes": 1,
      "max_segments": 1,
      "max_source_bytes": 1,
      "max_source_pages": 1
    },
    "operations": [
      "example"
    ],
    "reasoning_input_modes": [
      "example"
    ],
    "retention_seconds": 1,
    "review_timeout_hours_max": 1,
    "split_methods": [
      "example"
    ]
  }
}
```

### Identify the language of text

Identify the language of text.

**Inputs**

- Input (`input`, text, required): The text input for language and script identification. Max Input Limit is 1000 characters.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "language_code": "example",
    "request_id": "example",
    "script_code": "example"
  }
}
```

### List language models

List language models.

**Inputs**: None.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "data": [
      {
        "access": "standard",
        "created": 1,
        "id": "example",
        "object": "model",
        "owned_by": "example"
      }
    ],
    "object": "list"
  }
}
```

### List pronunciation dictionaries

List pronunciation dictionaries.

**Inputs**: None.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "dictionaries": [
      "example"
    ],
    "dictionary_count": 1
  }
}
```

### List voices

List voices.

**Inputs**

- Search (`search`, text): Filter voices by name (substring match).
- Gender (`gender`, text): Filter by gender tag (`male` or `female`).
- Accent (`accent`, text): Filter by accent tag.
- Limit (`limit`, number): Page size (max 200). From 1 to 200.
- Offset (`offset`, number): Pagination offset. At least 0.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "data": {
      "total": 1,
      "voices": [
        {
          "accent": "example",
          "created_at": "example",
          "created_by": "example",
          "created_by_email": "example",
          "created_by_name": "example",
          "descriptor": "example",
          "gender": "example",
          "has_preview": true,
          "id": "example",
          "is_favorited": true,
          "language": "example",
          "name": "example",
          "sample_duration_seconds": 1,
          "source": "example",
          "status": "example"
        }
      ]
    },
    "status": "example"
  }
}
```

### Replace a pronunciation dictionary file

Replace a pronunciation dictionary file.

**Inputs**

- Dict ID (`dict_id`, text, required): ID of the dictionary to update.
- File (`file`, text, required): File.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "dictionary_id": "example",
    "updated_pronunciations": {}
  }
}
```

### Transcribe audio

Transcribe audio.

**Inputs**

- File (`file`, text, required): File.
- Model (`model`, text): Model. One of: `saaras:v3`, `saaras:v4`.
- Mode (`mode`, text): Mode. One of: `transcribe`, `translate`, `verbatim`, `translit`, `codemix`.
- Language code (`language_code`, text): Language code. One of: `unknown`, `hi-IN`, `bn-IN`, `kn-IN`, `ml-IN`, `mr-IN`, `od-IN`, `pa-IN`, `ta-IN`, `te-IN`, and 14 more.
- With timestamps (`with_timestamps`, true/false): With timestamps.
- Input audio codec (`input_audio_codec`, text): Input Audio codec/format of the input file. PCM files are supported only at 16kHz sample rate. One of: `wav`, `x-wav`, `wave`, `mp3`, `mpeg`, `mpeg3`, `x-mp3`, `x-mpeg-3`, `aac`, `x-aac`, and 14 more.
- Keyterms (`keyterms`, list): Keyterms.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "language_code": "example",
    "language_probability": 1,
    "request_id": "example",
    "timestamps": {
      "end_time_seconds": [
        1
      ],
      "start_time_seconds": [
        1
      ],
      "words": [
        "example"
      ]
    },
    "transcript": "example"
  }
}
```

### Transcribe audio into English

Transcribe audio into English.

**Inputs**

- File (`file`, text, required): File.
- Prompt (`prompt`, text): Conversation context can be passed as a prompt to boost model accuracy. However, the current system is at an experimentation stage and doesn't match the prompt performance of large language models.
- Model (`model`, text): Model. One of: `saaras:v3`, `saaras:v2.5`.
- Input audio codec (`input_audio_codec`, text): Audio codec/format of the input file. Our API automatically detects all codec formats, but for PCM files specifically (pcm_s16le, pcm_l16, pcm_raw), you must pass this parameter. PCM files are supported only at 16kHz sample rate. One of: `wav`, `x-wav`, `wave`, `mp3`, `mpeg`, `mpeg3`, `x-mp3`, `x-mpeg-3`, `aac`, `x-aac`, and 14 more.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "diarized_transcript": {
      "entries": [
        {
          "end_time_seconds": 1,
          "speaker_id": "example",
          "start_time_seconds": 1,
          "transcript": "example"
        }
      ]
    },
    "language_code": "hi-IN",
    "language_probability": 1,
    "request_id": "example",
    "transcript": "example"
  }
}
```

### Translate text

Translate text.

**Inputs**

- Input (`input`, text, required): The text you want to translate is the input text that will be processed by the translation model. The maximum is 1000 characters for Mayura:v1 and 2000 characters for Sarvam-Translate:v1.
- Source language code (`source_language_code`, text, required): Source language code. One of: `auto`, `bn-IN`, `en-IN`, `gu-IN`, `hi-IN`, `kn-IN`, `ml-IN`, `mr-IN`, `od-IN`, `pa-IN`, and 14 more.
- Target language code (`target_language_code`, text, required): Target language code. One of: `bn-IN`, `en-IN`, `gu-IN`, `hi-IN`, `kn-IN`, `ml-IN`, `mr-IN`, `od-IN`, `pa-IN`, `ta-IN`, and 13 more.
- Speaker gender (`speaker_gender`, text): Please specify the gender of the speaker for better translations. One of: `Male`, `Female`.
- Mode (`mode`, text): Specifies the tone or style of the translation. **Model Support:** - **mayura:v1**: Supports formal, classic-colloquial, modern-colloquial, and code-mixed modes - **sarvam-translate:v1**: Only formal mode is supported **Default:** formal. One of: `formal`, `modern-colloquial`, `classic-colloquial`, `code-mixed`.
- Model (`model`, text): Specifies the translation model to use. - mayura:v1: Supports 12 languages with all modes, output scripts, and automatic language detection. - sarvam-translate:v1: Supports all 22 scheduled languages of India, formal mode only. One of: `mayura:v1`, `sarvam-translate:v1`.
- Output script (`output_script`, text): Output script. One of: `roman`, `fully-native`, `spoken-form-in-native`.
- Numerals format (`numerals_format`, text): Numerals format. One of: `international`, `native`.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "request_id": "example",
    "source_language_code": "example",
    "translated_text": "example"
  }
}
```

### Transliterate text

Transliterate text.

**Inputs**

- Input (`input`, text, required): The text you want to transliterate.
- Source language code (`source_language_code`, text, required): The language code of the input text. This specifies the source language for transliteration. Note: The source language should either be an Indic language or English. As we supports both Indic-to-English and English-to-Indic transliteration. One of: `auto`, `bn-IN`, `en-IN`, `gu-IN`, `hi-IN`, `kn-IN`, `ml-IN`, `mr-IN`, `od-IN`, `pa-IN`, `ta-IN`, `te-IN`.
- Target language code (`target_language_code`, text, required): The language code of the transliteration text. This specifies the target language for transliteration. Note:The target language should either be an Indic language or English. As we supports both Indic-to-English and English-to-Indic transliteration. One of: `bn-IN`, `en-IN`, `gu-IN`, `hi-IN`, `kn-IN`, `ml-IN`, `mr-IN`, `od-IN`, `pa-IN`, `ta-IN`, `te-IN`.
- Numerals format (`numerals_format`, text): Numerals format. One of: `international`, `native`.
- Spoken form numerals language (`spoken_form_numerals_language`, text): Spoken form numerals language. One of: `english`, `native`.
- Spoken form (`spoken_form`, true/false): - Default: `False` - Converts text into a natural spoken form when `True`. - **Note:** No effect if output language is `en-IN`. ### Example: - **Input:** `मुझे कल 9:30am को appointment है` - **Output:** `मुझे कल सुबह साढ़े नौ बजे को अपॉइंटमेंट है`.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "request_id": "example",
    "source_language_code": "example",
    "transliterated_text": "example"
  }
}
```

### Upload a pronunciation dictionary

Upload a pronunciation dictionary.

**Inputs**

- File (`file`, text, required): File.

**Outputs**

- `data` (object): The response from Sarvam AI.

**Example output**

```json
{
  "data": {
    "dictionary_id": "example"
  }
}
```
