> This page is for Model APIs.

> For clean Markdown of any page, append `.md` to the page URL.
> For a complete documentation index, see https://docs.sarvam.ai/llms.txt. For a section index, append `/llms.txt` to any section URL (for example https://docs.sarvam.ai/voice-agents/llms.txt).
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server.

# Sarvam Models

> Sarvam's own models for 22 Indian languages and English: Saaras for speech to text, Bulbul for text to speech, Sarvam Translate for formal translation, Mayura for conversational translation, and Sarvam Vision for documents. Pick a model, hear the voices, and make your first call.

Sarvam Models hear, speak, translate, and read across 22 Indian languages and English, including
code-mixed input such as Hinglish, the way people actually talk and write. Use them to power voice
agents, transcribe calls and meetings, give your product a natural voice, localize content, and
turn scanned documents into structured data.

This page covers one model per section. Each section says what the model is for, shows what it
returns, and ends with a first call you can copy in Python, JavaScript, or cURL.

> **Prices on this page are pay-as-you-go rates**
>
> Pro, Growth, and Business plans have their own per-unit rates. See
> [Pricing, Credits & Rate Limits](/api/getting-started/pricing) for every plan, or compare and
> switch plans on the [Sarvam Dashboard](https://indus.sarvam.ai/pricing/?ref=docs).

## Start here

Pick a task to jump to its model. Click a model ID to copy it.

#### One API key

The same key and credits work for every model on the platform.

#### One SDK

The `sarvamai` package for Python and JavaScript covers every model.

#### One field to switch

Change `model` and keep the rest of your code as it is.

### Set up once

Every example on this page assumes the SDK is installed and your key is in `SARVAM_API_KEY`.
Get a key from [Key Management](https://indus.sarvam.ai/key-management?ref=docs) on the Sarvam Dashboard.

#### Python

```bash
pip install -U sarvamai
export SARVAM_API_KEY="your-api-key"
```

#### JavaScript

```bash
npm install sarvamai@latest
export SARVAM_API_KEY="your-api-key"
```

#### cURL

```bash
export SARVAM_API_KEY="your-api-key"
```

## Speech to text

**Saaras v4** turns speech into text, from a 5-second voice note to a 2-hour call recording. It
detects the spoken language for you, and it's tuned for 8 kHz telephony audio, so it fits voice
agents and contact centres as well as recorded media.

### One recording, five outputs

The `mode` parameter picks the kind of text you get back. The audio and the endpoint stay the same.
These are live outputs for a Hindi recording of *"मेरा फोन नंबर है 9840950950"*:

| `mode`                 | You get                                             | Output                                                                              |
| ---------------------- | --------------------------------------------------- | ----------------------------------------------------------------------------------- |
| `transcribe` (default) | Text in the spoken language, with numbers as digits | मेरा फ़ोन नंबर है 9840950950।                                                       |
| `translate`            | English text                                        | My phone number is 9840950950.                                                      |
| `verbatim`             | Every word exactly as spoken                        | मेरा फ़ोन नंबर है नौ आठ चार शून्य नौ पाँच शून्य नौ पाँच शून्य।                      |
| `translit`             | Every word as spoken, in Roman script               | Mera phone number hai nau aath chaar shoonya nau paanch shoonya nau paanch shoonya. |
| `codemix`              | English words in English, the rest in native script | मेरा phone number है 9840950950.                                                    |

### Choose how to send audio

All three APIs run Saaras v4 with the same five modes. Pick by how the audio reaches you.

|              | [REST](/api/api-guides-tutorials/speech-to-text/rest-api) | [Realtime streaming](/api/api-guides-tutorials/speech-to-text/realtime-streaming) | [Batch](/api/api-guides-tutorials/speech-to-text/batch-api) |
| ------------ | --------------------------------------------------------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------- |
| **Audio**    | A clip up to 30 s                                         | A live stream over WebSocket                                                      | Files up to 2 hours, 20 per job                             |
| **Results**  | The transcript in the response                            | Partial transcripts while the user speaks, then a final one per turn              | Downloaded when the job completes                           |
| **Extras**   | Word timestamps                                           | Turn detection with voice activity detection                                      | Speaker diarization, word timestamps                        |
| **Best for** | Voice notes, commands                                     | Voice agents, live captions                                                       | Calls, meetings, bulk pipelines                             |

See [Which API to Use](/api/api-guides-tutorials/speech-to-text/which-api-to-use) for the full comparison.

### Transcribe your first clip

#### Python

```python
import os
from sarvamai import SarvamAI

client = SarvamAI(api_subscription_key=os.environ["SARVAM_API_KEY"])

response = client.speech_to_text.transcribe(
    file=open("audio.wav", "rb"),  # up to 30 s
    model="saaras:v4",
    mode="transcribe",  # or translate, verbatim, translit, codemix
)
print(response.transcript)
```

#### JavaScript

```javascript
import { SarvamAIClient } from "sarvamai";
import fs from "fs";

const client = new SarvamAIClient({ apiSubscriptionKey: process.env.SARVAM_API_KEY });

const response = await client.speechToText.transcribe({
    file: fs.createReadStream("audio.wav"), // up to 30 s
    model: "saaras:v4",
    mode: "transcribe", // or translate, verbatim, translit, codemix
});
console.log(response.transcript);
```

#### cURL

```bash
curl -X POST https://api.sarvam.ai/speech-to-text \
  -H "api-subscription-key: $SARVAM_API_KEY" \
  -F model="saaras:v4" \
  -F mode="transcribe" \
  -F file=@audio.wav
```

The response holds the transcript and the detected language. `language_probability` is included
when you leave `language_code` unset and Saaras detects the language:

```json
{
  "request_id": "20261203_531f4cbb-8af3-413c-9cc6-6c4f1db194ba",
  "transcript": "मेरा फ़ोन नंबर है 9840950950।",
  "language_code": "hi-IN",
  "language_probability": 1.0
}
```

> **Tip**
>
> **Good to know**
>
> * Send WAV, MP3, AAC, FLAC, OGG, and more. The format is detected for you.
> * Set `language_code` when you know the language, or leave it unset for automatic detection.
> * Pass up to 50 names, brands, or domain terms as `keyterms` to help Saaras spell them right. See [Keyterm Prompting](/api/api-guides-tutorials/speech-to-text/how-to/keyterms).

#### Languages: 22 Indian languages and English

Hindi `hi-IN` · Bengali `bn-IN` · Tamil `ta-IN` · Telugu `te-IN` · Kannada `kn-IN` · Malayalam `ml-IN` ·
Marathi `mr-IN` · Gujarati `gu-IN` · Punjabi `pa-IN` · Odia `od-IN` · English `en-IN` · Assamese `as-IN` ·
Urdu `ur-IN` · Nepali `ne-IN` · Konkani `kok-IN` · Kashmiri `ks-IN` · Sindhi `sd-IN` · Sanskrit `sa-IN` ·
Santali `sat-IN` · Manipuri `mni-IN` · Bodo `brx-IN` · Maithili `mai-IN` · Dogri `doi-IN`

Saaras also recognizes Global English alongside Indian English.

## Text to speech

**Bulbul** turns text into natural speech in 10 Indian languages and English. Start with
**Bulbul v4 Flash** for new work: it has 200+ voices and the lower price. Both Bulbul models share
one request and response shape, so moving between them is a change to `model` and `speaker`.

### Hear Bulbul v4 Flash

Each voice is tuned for a kind of work, such as support calls, narration, or news. Play a sample,
then copy its `speaker` value into your request.

[Browse all 200+ voices →](/api/api-guides-tutorials/text-to-speech/voices)

### Generate your first audio

#### Python

```python
import os
from sarvamai import SarvamAI
from sarvamai.play import save

client = SarvamAI(api_subscription_key=os.environ["SARVAM_API_KEY"])

audio = client.text_to_speech.convert(
    text="आपका order confirm हो गया है।",
    language_code="hi-IN",
    model="bulbul:v4-flash",
    speaker="aparna_hi_customer",
)
save(audio, "output.wav")  # decodes the base64 audio for you
```

#### JavaScript

```javascript
import { SarvamAIClient } from "sarvamai";
import fs from "fs";

const client = new SarvamAIClient({ apiSubscriptionKey: process.env.SARVAM_API_KEY });

const response = await client.textToSpeech.convert({
    text: "आपका order confirm हो गया है।",
    language_code: "hi-IN",
    model: "bulbul:v4-flash",
    speaker: "aparna_hi_customer",
});

// The audio arrives base64-encoded; decode it before writing
fs.writeFileSync("output.wav", Buffer.from(response.audios.join(""), "base64"));
```

#### cURL

```bash
curl -s -X POST https://api.sarvam.ai/text-to-speech \
  -H "api-subscription-key: $SARVAM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "आपका order confirm हो गया है।",
    "language_code": "hi-IN",
    "model": "bulbul:v4-flash",
    "speaker": "aparna_hi_customer"
  }' -o response.json

# The audio arrives base64-encoded; decode it into a playable file
python3 -c "import json, base64; d = json.load(open('response.json')); open('output.wav', 'wb').write(base64.b64decode(''.join(d['audios'])))"
```

The response is `{"request_id": "...", "audios": ["<base64 audio>"]}`. Join the `audios` strings
and decode them to get the audio file.

> **Tip**
>
> **Good to know**
>
> * Shape the delivery with `pace` (0.5 to 2.0), `pitch` (-0.5 to 0.5), `loudness` (0.1 to 2.5), and `temperature` (0.01 to 1.0), on both models.
> * Choose `output_audio_codec`: `wav` (default), `mp3`, `aac`, `flac`, `opus`, `linear16`, `mulaw`, or `alaw`.
> * Set `speech_sample_rate` from 8 kHz for telephony up to 48 kHz on REST, and up to 24 kHz when streaming. The default is 22,050 Hz.
> * Control how brand names and acronyms are spoken with a [pronunciation dictionary](/api/api-guides-tutorials/text-to-speech/pronunciation-dictionary) (`dict_id`).

Already using named speakers such as `shubh`? Bulbul v3 keeps them:

#### Languages: 10 Indian languages and English

Hindi `hi-IN` · English `en-IN` · Bengali `bn-IN` · Gujarati `gu-IN` · Kannada `kn-IN` · Malayalam `ml-IN` ·
Marathi `mr-IN` · Odia `od-IN` · Punjabi `pa-IN` · Tamil `ta-IN` · Telugu `te-IN`

Both models speak all 11. Bulbul v4 Flash has dedicated voices for nine of them, and any v4 voice
speaks Malayalam and Odia. For code-mixed speech, write Indic words in their native script and
English words in English, for example `आपका order confirm हो गया है`.

## Formal translation

**Sarvam Translate** translates text into formal, official-sounding language across all 22
scheduled Indian languages and English. Use it for government notices, legal and policy text,
and anything that must cover every scheduled language with one model.

### See the output

A live output for *"Your EMI of Rs. 3000 is pending. Please pay by Friday."* translated to Hindi:

> आपकी 3000 रुपये की ईएमआई लंबित है। कृपया शुक्रवार तक भुगतान कर दें।

### Translate your first sentence

#### Python

```python
import os
from sarvamai import SarvamAI

client = SarvamAI(api_subscription_key=os.environ["SARVAM_API_KEY"])

response = client.text.translate(
    input="Your EMI of Rs. 3000 is pending. Please pay by Friday.",
    source_language_code="en-IN",
    target_language_code="hi-IN",
    model="sarvam-translate:v1",
)
print(response.translated_text)
```

#### JavaScript

```javascript
import { SarvamAIClient } from "sarvamai";

const client = new SarvamAIClient({ apiSubscriptionKey: process.env.SARVAM_API_KEY });

const response = await client.text.translate({
    input: "Your EMI of Rs. 3000 is pending. Please pay by Friday.",
    source_language_code: "en-IN",
    target_language_code: "hi-IN",
    model: "sarvam-translate:v1",
});
console.log(response.translated_text);
```

#### cURL

```bash
curl -X POST https://api.sarvam.ai/translate \
  -H "api-subscription-key: $SARVAM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "Your EMI of Rs. 3000 is pending. Please pay by Friday.",
    "source_language_code": "en-IN",
    "target_language_code": "hi-IN",
    "model": "sarvam-translate:v1"
  }'
```

The response holds the translation and the source language:

```json
{
  "request_id": "20261202_9ecfd602-3089-42ef-8690-f8ebdf3a5252",
  "translated_text": "आपकी 3000 रुपये की ईएमआई लंबित है। कृपया शुक्रवार तक भुगतान कर दें।",
  "source_language_code": "en-IN"
}
```

> **Tip**
>
> **Good to know**
>
> * Always set `model="sarvam-translate:v1"`. A request without `model` goes to Mayura.
> * Set `source_language_code` to the input's language. Sarvam Translate doesn't detect it.
> * Set `speaker_gender` to `Male` or `Female` (the default) to match the speaker's grammatical gender in languages such as Hindi, where verb forms change with it.
> * Set `numerals_format="native"` for native digits, such as ३००० in Hindi.
> * To translate whole files and keep their layout, use [Document Translation](/api/api-guides-tutorials/doc-translation/overview).

#### Languages: 22 Indian languages and English

Assamese `as-IN` · Bengali `bn-IN` · Bodo `brx-IN` · Dogri `doi-IN` · English `en-IN` · Gujarati `gu-IN` ·
Hindi `hi-IN` · Kannada `kn-IN` · Kashmiri `ks-IN` · Konkani `kok-IN` · Maithili `mai-IN` · Malayalam `ml-IN` ·
Manipuri `mni-IN` · Marathi `mr-IN` · Nepali `ne-IN` · Odia `od-IN` · Punjabi `pa-IN` · Sanskrit `sa-IN` ·
Santali `sat-IN` · Sindhi `sd-IN` · Tamil `ta-IN` · Telugu `te-IN` · Urdu `ur-IN`

## Conversational translation

**Mayura** translates text the way people talk, in 10 Indian languages and English. Pick a style
with `mode`, from formal to code-mixed, and get the output in native or Roman script. Use it for
chat, customer support, app copy, and SMS.

### One sentence, three styles

`mode` sets how the text sounds, and `output_script` sets the script it's written in. Live outputs
for *"Your EMI of Rs. 3000 is pending. Please pay by Friday."* translated to Hindi:

| `mode`              | `output_script`  | Output                                                               |
| ------------------- | ---------------- | -------------------------------------------------------------------- |
| `formal`            | native (default) | आपका 3000 रुपये का EMI लंबित है। कृपया शुक्रवार तक भुगतान कर दीजिए।  |
| `modern-colloquial` | native (default) | आपका Rs. 3000 का EMI pending है। Please Friday तक pay कर दीजिए।      |
| `modern-colloquial` | `roman`          | Aapka Rs. 3000 ka EMI pending hai. Please Friday tak pay kar dijiye. |

`mode` also takes `classic-colloquial` and `code-mixed`, and `output_script` also takes
`fully-native` and `spoken-form-in-native`. See [Mayura](/api/api-guides-tutorials/models/mayura) for each one.

### Translate your first message

#### Python

```python
import os
from sarvamai import SarvamAI

client = SarvamAI(api_subscription_key=os.environ["SARVAM_API_KEY"])

response = client.text.translate(
    input="Your EMI of Rs. 3000 is pending. Please pay by Friday.",
    source_language_code="auto",  # detect the input language
    target_language_code="hi-IN",
    model="mayura:v1",
    mode="modern-colloquial",
)
print(response.translated_text)
```

#### JavaScript

```javascript
import { SarvamAIClient } from "sarvamai";

const client = new SarvamAIClient({ apiSubscriptionKey: process.env.SARVAM_API_KEY });

const response = await client.text.translate({
    input: "Your EMI of Rs. 3000 is pending. Please pay by Friday.",
    source_language_code: "auto", // detect the input language
    target_language_code: "hi-IN",
    model: "mayura:v1",
    mode: "modern-colloquial",
});
console.log(response.translated_text);
```

#### cURL

```bash
curl -X POST https://api.sarvam.ai/translate \
  -H "api-subscription-key: $SARVAM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "Your EMI of Rs. 3000 is pending. Please pay by Friday.",
    "source_language_code": "auto",
    "target_language_code": "hi-IN",
    "model": "mayura:v1",
    "mode": "modern-colloquial"
  }'
```

The response has the same shape as Sarvam Translate's. With `"auto"`, `source_language_code` in the
response is the language Mayura detected.

> **Tip**
>
> **Good to know**
>
> * `mayura:v1` is the default model on `POST /translate`, so existing calls without `model` already use it.
> * Keep each request to 1,000 characters. Split longer text by sentence.
> * Set `speaker_gender` to `Male` or `Female` (the default) to match the speaker's grammatical gender in languages such as Hindi.
> * Set `numerals_format="native"` for native digits, such as ३००० in Hindi.

#### Languages: 10 Indian languages and English

Bengali `bn-IN` · English `en-IN` · Gujarati `gu-IN` · Hindi `hi-IN` · Kannada `kn-IN` · Malayalam `ml-IN` ·
Marathi `mr-IN` · Odia `od-IN` · Punjabi `pa-IN` · Tamil `ta-IN` · Telugu `te-IN`

## Documents

**Sarvam Vision** reads PDFs and scanned pages in 22 Indian languages and English. You call it
through [Document AI](/api/api-guides-tutorials/document-intelligence/overview): pick the
operation that matches the output you need, and Sarvam Vision does the reading.

### Parse or Extract

|                                      | [Parse](/api/api-guides-tutorials/document-intelligence/how-to/parse) | [Extract](/api/api-guides-tutorials/document-intelligence/how-to/extract) |
| ------------------------------------ | --------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| **You want**                         | The whole document as clean text                                      | Specific values, such as a total or an ID number                          |
| **You send**                         | A PDF, PNG, or JPEG                                                   | A PDF, PNG, or JPEG, plus a schema of the fields                          |
| **You get**                          | HTML, Markdown, or JSON, with tables and reading order kept           | JSON, CSV, or XLSX                                                        |
| **Best for**                         | Archives, search, RAG                                                 | KYC, invoices, forms                                                      |
| **Price** <mark>pay-as-you-go</mark> | ₹0.50 / page                                                          | From ₹1 / page ([all rates](/api/getting-started/pricing))                |

### Parse your first document

A Document AI call runs as a job. Submit the file, poll until the job finishes, then fetch the output.

#### Python

```python
import os
import time
from sarvamai import SarvamAI

client = SarvamAI(api_subscription_key=os.environ["SARVAM_API_KEY"])

# 1. Submit: one call creates and starts the job
with open("sample-document.pdf", "rb") as f:
    job = client.doc_ai.parse(
        file=[("sample-document.pdf", f, "application/pdf")],
        language="hi-IN",
        output_format="md",
    )

# 2. Poll until the job finishes
while True:
    status = client.doc_ai.get_status(job_id=job.job_id)
    if status.status in {"completed", "partially_completed", "failed", "rejected"}:
        break
    time.sleep(5)

# 3. Fetch: a link to a ZIP with the Markdown output
print(status.status, client.doc_ai.get_download_url(job_id=job.job_id).url)
```

#### JavaScript

```javascript
import fs from "fs";
import { SarvamAIClient } from "sarvamai";

const client = new SarvamAIClient({ apiSubscriptionKey: process.env.SARVAM_API_KEY });

// 1. Submit: one call creates and starts the job
const job = await client.docAi.parse({
    file: [fs.createReadStream("sample-document.pdf")],
    language: "hi-IN",
});

// 2. Poll until the job finishes
const DONE = new Set(["completed", "partially_completed", "failed", "rejected"]);
let status;
do {
    await new Promise((r) => setTimeout(r, 5000));
    status = await client.docAi.getStatus(job.job_id);
} while (!DONE.has(status.status));

// 3. Fetch: the text of each block
const results = await client.docAi.getResults(job.job_id);
for (const doc of results.documents)
    for (const page of doc.pages)
        for (const block of page.blocks) console.log(block.text);
```

> **Tip**
>
> **Good to know**
>
> * Document AI uses `language` (not `language_code`) and `output_format` values `"md"`, `"html"`, or `"json"`.
> * The Python example needs `sarvamai` 0.1.50 or later, and the JavaScript example 1.1.23 or later.
> * The [Parse](/api/api-guides-tutorials/document-intelligence/how-to/parse) and [Extract](/api/api-guides-tutorials/document-intelligence/how-to/extract) guides cover every option, with cURL. Page and file-size limits are in [Languages, Formats & Limits](/api/api-guides-tutorials/document-intelligence/languages-formats-limits).

#### Languages: 22 Indian languages and English

Hindi `hi-IN` · Bengali `bn-IN` · Tamil `ta-IN` · Telugu `te-IN` · Marathi `mr-IN` · Gujarati `gu-IN` ·
Kannada `kn-IN` · Malayalam `ml-IN` · Assamese `as-IN` · Urdu `ur-IN` · Sanskrit `sa-IN` · Nepali `ne-IN` ·
Dogri `doi-IN` · Bodo `brx-IN` · Punjabi `pa-IN` · Odia `od-IN` · Konkani `kok-IN` · Maithili `mai-IN` ·
Sindhi `sd-IN` · Kashmiri `ks-IN` · Manipuri `mni-IN` · Santali `sat-IN` · English `en-IN`

## Build with Sarvam Models

The models chain together with the same key and SDK. Each card below opens a guide for a common pipeline.

#### [Voice agent](/api/integration/build-voice-agent-with-live-kit)

**Saaras v4** hears the caller, an LLM replies, and **Bulbul v4 Flash** speaks. Built with LiveKit.

#### [Call analytics](/api/cookbook/guides/call-analytics-pipeline)

**Saaras v4** batch transcribes calls with speaker labels, then an LLM pulls out the issue, sentiment, and resolution.

#### [Localized audio and video](/api/api-guides-tutorials/dubbing/overview)

Chain **Saaras v4**, **Sarvam Translate**, and **Bulbul v4 Flash**, or dub a video end to end with the Dubbing API.

## Next steps

#### [Pricing & rate limits](/api/getting-started/pricing)

Pay-as-you-go, Pro, Growth, and Business rates, and the rate limits for each API.

#### [Building for Indian languages](/api/getting-started/building-for-india)

Code-mixing, scripts, native numerals, and 8 kHz telephony audio.

#### [All models](/api/getting-started/models)

Every model on the Sarvam platform, side by side.