# Reference
## Dubbing
<details><summary><code>client.dubbing.<a href="/src/api/resources/dubbing/client/Client.ts">create</a>({ ...params }) -> SarvamAI.CreateDubbingJobResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

## Creative Agents - Dubbing

Create a dubbing job that translates a source video or audio file into one or more Indian languages, with optional voice cloning, watermark control, and translation-style (register) control.

**Base URL:** `https://api.sarvam.ai/dubbing`.
**Auth:** send your key in the `api-subscription-key` header, not `Authorization: Bearer`.

This call only creates the job. It does not accept the media file. The response returns `data.job_id` and a short-lived signed `data.upload_url`. After that:
1. `PUT` the raw media bytes to `upload_url` with headers `Content-Type: <mime>` (e.g. `video/mp4`) and `x-ms-blob-type: BlockBlob`.
2. `POST /jobs/{job_id}/start` to begin the pipeline.

A single job dubs into every language in `target_langs`, so you don't need a separate job per language.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.dubbing.create({
    src_lang: "en-IN",
    target_langs: ["hi-IN", "ta-IN", "te-IN"],
    export_options: ["video", "audio", "srt"],
    voice_cloning: true,
    num_speakers: 1,
    disable_watermark: true,
    register: "modern-colloquial",
    job_name: "segment1"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.CreateDubbingJobRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DubbingClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.dubbing.<a href="/src/api/resources/dubbing/client/Client.ts">start</a>(job_id) -> SarvamAI.DubbingStartResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Start a dubbing job once the media file has been uploaded to the signed `upload_url` returned by `POST /jobs`. The job status then moves from `queued` to `in_progress`, and finally to `completed` or `failed`.

Keep `editor_flow` set to `false` (the default) when creating the job so exports auto-produce once the pipeline finishes.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.dubbing.start("dub_5cb7faa6");

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `string` — The `job_id` returned by `POST /jobs`.
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DubbingClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.dubbing.<a href="/src/api/resources/dubbing/client/Client.ts">getLiveStatus</a>(job_id) -> SarvamAI.DubbingLiveStatusResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Poll the pipeline progress of a dubbing job. `data.status` moves from `queued` to `in_progress`, then to `completed` or `failed`.

> **Note:** `live-status` is a progress signal only. The source of truth for downloadable outputs is `GET /jobs/{job_id}/export-status`. Each `(target_language, export_type)` export completes independently and carries its own `status` and `download_url`.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.dubbing.getLiveStatus("dub_5cb7faa6");

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `string` — The `job_id` returned by `POST /jobs`.
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DubbingClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.dubbing.<a href="/src/api/resources/dubbing/client/Client.ts">getExportStatus</a>(job_id, { ...params }) -> SarvamAI.DubbingExportStatusResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Retrieve the per-output export status for a dubbing job. Returns `data.exports[]`, one entry per `(target_language, export_type)` combination, each with its own `status` and signed `download_url`.

**This is the source of truth for downloads.** Before downloading, confirm an entry's `status == "completed"` and use its `download_url`.

> Signed download URLs are time-limited (~24h). Re-fetch this endpoint for a fresh URL rather than caching long-term.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.dubbing.getExportStatus("dub_5cb7faa6", {
    limit: 5
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `string` — The `job_id` returned by `POST /jobs`.
    
</dd>
</dl>

<dl>
<dd>

**request:** `SarvamAI.DubbingGetExportStatusRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DubbingClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

## DocumentTranslation
<details><summary><code>client.documentTranslation.<a href="/src/api/resources/documentTranslation/client/Client.ts">create</a>({ ...params }) -> SarvamAI.CreateDocumentJobResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

## Document Translation

Create a document translation job. Returns a `job_id` and a short-lived signed `upload_url`.

**Flow:**
1. `POST /translate/document/jobs` with source/target languages and options.
2. `PUT` the raw file bytes to `upload_url` with header `Content-Type: <mime>`.
3. `POST /translate/document/jobs/{job_id}/start` to begin the pipeline.
4. Poll `GET /translate/document/jobs/{job_id}/live-status` until translation completes.
5. `POST /translate/document/jobs/{job_id}/export?lang=<code>` to enqueue an async export for each target language (exports in the uploaded file's format by default).
6. Poll `GET /translate/document/jobs/{job_id}/export/status` until `export_state` is `Completed`, then download from `download_url`.

A single job translates into every language in `target_language_codes`. Exports run asynchronously — do not expect the download URL in the trigger response.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.documentTranslation.create({
    job_name: "chapter1",
    source_language_code: "en-IN",
    target_language_codes: ["hi-IN", "ta-IN"],
    original_filename: "chapter1.pdf",
    genre: "NON_FICTION",
    use_native_numerals: true
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.CreateDocumentJobRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocumentTranslationClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.documentTranslation.<a href="/src/api/resources/documentTranslation/client/Client.ts">start</a>(job_id) -> SarvamAI.StartJobResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Start the translation pipeline after the file has been uploaded to the signed `upload_url`. Idempotent.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.documentTranslation.start("550e8400-e29b-41d4-a716-446655440000");

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `string` — The `job_id` returned by POST /translate/document/jobs.
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocumentTranslationClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.documentTranslation.<a href="/src/api/resources/documentTranslation/client/Client.ts">getLiveStatus</a>(job_id) -> SarvamAI.JobLiveStatusResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Poll the progress of a document translation job.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.documentTranslation.getLiveStatus("550e8400-e29b-41d4-a716-446655440000");

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `string` — The `job_id` returned by POST /translate/document/jobs.
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocumentTranslationClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.documentTranslation.<a href="/src/api/resources/documentTranslation/client/Client.ts">triggerExport</a>(job_id, { ...params }) -> SarvamAI.DocumentJobExportStatusResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Enqueue an async export for one target language.

Returns `202 Accepted` with `export_state=Pending`. Poll `GET /translate/document/jobs/{job_id}/export/status` until `export_state` is `Completed`, then download from `download_url`.

- When `format` is omitted, the export uses the uploaded file's native format.
- **PDF uploads** may optionally set `format` to `pdf`, `docx`, `html`, `txt`, or `epub`.
- **Microsoft Office uploads** always export in the original format only (for example, xlsx in → xlsx out).
- Optional `fit_line_height` / `fit_font_shrink` tune PDF/DOCX shrink-to-fit.
- Returns `409` when an export for the same language and format is already `Pending` or `Running`.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.documentTranslation.triggerExport("550e8400-e29b-41d4-a716-446655440000", {
    lang: "hi-IN"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `string` — The `job_id` returned by POST /translate/document/jobs.
    
</dd>
</dl>

<dl>
<dd>

**request:** `SarvamAI.DocumentTranslationTriggerExportRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocumentTranslationClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.documentTranslation.<a href="/src/api/resources/documentTranslation/client/Client.ts">getExportStatus</a>(job_id, { ...params }) -> SarvamAI.DocumentJobExportStatusResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Poll async export status and retrieve a signed `download_url` when `export_state` is `Completed`.

Provide either `export_id` (from the trigger response) or `lang` (returns the latest export for that language).

> Signed download URLs are time-limited (~24h). Re-fetch this endpoint for a fresh URL rather than caching long-term.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.documentTranslation.getExportStatus("550e8400-e29b-41d4-a716-446655440000", {
    export_id: "exp_1a2b3c4d"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `string` — The `job_id` returned by POST /translate/document/jobs.
    
</dd>
</dl>

<dl>
<dd>

**request:** `SarvamAI.DocumentTranslationGetExportStatusRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocumentTranslationClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

## Text
<details><summary><code>client.text.<a href="/src/api/resources/text/client/Client.ts">translate</a>({ ...params }) -> SarvamAI.TranslationResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

<Note>
  **Short text** — strings, chat messages, and snippets. You are on the right endpoint (`POST /translate`).

  **Whole files** — PDF, Word, Excel, PowerPoint, or HTML with layout preserved. Use the [Document Translation API](/api-reference/translate-document/create-doc-translation) (`POST /translate/document/jobs`) instead of pasting file contents into this endpoint.
</Note>

<CardGroup cols={2}>
  <Card
    title="Document Translation"
    icon="file-export"
    href="/api-reference/translate-document/create-doc-translation"
  >
    Upload once, translate into multiple languages per job, and export in the same format as the source (PDF→PDF, DOCX→DOCX).
  </Card>

  <Card
    title="Document Translation guide"
    icon="book-open"
    href="/api/api-guides-tutorials/doc-translation/overview"
  >
    Overview, pricing, and step-by-step flows for doc-to-doc translation.
  </Card>
</CardGroup>

**Translation** converts text from one language to another while preserving its meaning.
For Example: **'मैं ऑफिस जा रहा हूँ'** translates to **'I am going to the office'** in English, where the script and language change, but the original meaning remains the same.

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

### Newly added languages:
- **`as-IN`**: Assamese
- **`brx-IN`**: Bodo
- **`doi-IN`**: Dogri
- **`kok-IN`**: Konkani
- **`ks-IN`**: Kashmiri
- **`mai-IN`**: Maithili
- **`mni-IN`**: Manipuri (Meiteilon)
- **`ne-IN`**: Nepali
- **`sa-IN`**: Sanskrit
- **`sat-IN`**: Santali
- **`sd-IN`**: Sindhi
- **`ur-IN`**: Urdu

For hands-on practice, you can explore the notebook tutorial on [Translate API Tutorial](https://github.com/sarvamai/sarvam-ai-cookbook/blob/main/notebooks/translate/Translate_API_Tutorial.ipynb).
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.text.translate({
    input: "Hello, how are you?",
    source_language_code: "en-IN",
    target_language_code: "hi-IN"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.TranslationRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `TextClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.text.<a href="/src/api/resources/text/client/Client.ts">identifyLanguage</a>({ ...params }) -> SarvamAI.LanguageIdentificationResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Identifies the language (e.g., en-IN, hi-IN) and script (e.g., Latin, Devanagari) of the input text, supporting multiple languages.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.text.identifyLanguage({
    input: "\u0928\u092E\u0938\u094D\u0924\u0947 \u0906\u092A \u0915\u0948\u0938\u0947 \u0939\u0948\u0902"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.LanguageIdentificationRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `TextClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.text.<a href="/src/api/resources/text/client/Client.ts">transliterate</a>({ ...params }) -> SarvamAI.TransliterationResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

**Transliteration** converts text from one script to another while preserving the original pronunciation. For example, **'नमस्ते'** becomes **'namaste'** in English, and **'how are you'** can be written as **'हाउ आर यू'** in Devanagari. This process ensures that the sound of the original text remains intact, even when written in a different script.

Transliteration is useful when you want to represent words phonetically across different writing systems, such as converting **'मैं ऑफिस जा रहा हूँ'** to **'main office ja raha hun'** in English letters.

**Translation**, on the other hand, converts text from one language to another while preserving the meaning rather than pronunciation. For example, **'मैं ऑफिस जा रहा हूँ'** translates to **'I am going to the office'** in English, changing both the script and the language while conveying the intended message.
### Examples of **Transliteration**:
- **'Good morning'** becomes **'गुड मॉर्निंग'** in Hindi, where the pronunciation is preserved but the meaning is not translated.
- **'सुप्रभात'** becomes **'suprabhat'** in English.

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

For hands-on practice, you can explore the notebook tutorial on [Transliterate API Tutorial](https://github.com/sarvamai/sarvam-ai-cookbook/blob/main/notebooks/transliterate/Transliterate_API_Tutorial.ipynb).
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.text.transliterate({
    input: "namaste",
    source_language_code: "en-IN",
    target_language_code: "hi-IN"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.TransliterationRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `TextClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

## SpeechToText
<details><summary><code>client.speechToText.<a href="/src/api/resources/speechToText/client/Client.ts">transcribe</a>({ ...params }) -> SarvamAI.SpeechToTextResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

## Speech to Text API

This API transcribes speech to text in multiple Indian languages and English. Supports transcription for interactive applications.

### Available Options:
- **REST API** (Current Endpoint): For quick responses under 30 seconds with immediate results
- **Batch API**: For longer audio files, [Follow This Documentation](https://docs.sarvam.ai/api-reference-docs/api-guides-tutorials/speech-to-text/batch-api)
  - Supports diarization (speaker identification)

### Note:
- Pricing differs for REST and Batch APIs
- Diarization is only available in Batch API with separate pricing
- Please refer to [here](https://docs.sarvam.ai/api-reference-docs/pricing) for detailed pricing information
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.speechToText.transcribe({
    file: fs.createReadStream("/path/to/your/file")
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.SpeechToTextTranscriptionRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `SpeechToTextClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.speechToText.<a href="/src/api/resources/speechToText/client/Client.ts">translate</a>({ ...params }) -> SarvamAI.SpeechToTextTranslateResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

## Speech to Text Translation API

This API automatically detects the input language, transcribes the speech, and translates the text to English.

### Available Options:
- **REST API** (Current Endpoint): For quick responses under 30 seconds with immediate results
- **Batch API**: For longer audio files [Follow this documentation](https://docs.sarvam.ai/api-reference-docs/api-guides-tutorials/speech-to-text/batch-api)
  - Supports diarization (speaker identification)

### Note:
- Pricing differs for REST and Batch APIs
- Diarization is only available in Batch API with separate pricing
- Please refer to [here](https://docs.sarvam.ai/api-reference-docs/pricing) for detailed pricing information
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.speechToText.translate({
    file: fs.createReadStream("/path/to/your/file")
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.SpeechToTextTranslationRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `SpeechToTextClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

## TextToSpeech
<details><summary><code>client.textToSpeech.<a href="/src/api/resources/textToSpeech/client/Client.ts">convert</a>({ ...params }) -> SarvamAI.TextToSpeechResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Convert text into spoken audio. The output is a base64-encoded audio string that must be decoded before use.

**Available Models:**
- **bulbul:v4-flash**: Latest model, recommended for new integrations — same request/response contract as bulbul:v3, with a 200+ voice persona catalog
- **bulbul:v3**: Stable model (API default when `model` is omitted) with 30+ voices and temperature control
- **bulbul:v2**: Legacy model with pitch and loudness controls

**Important Notes for bulbul:v3 and bulbul:v4-flash:**
- Pitch and loudness parameters are NOT supported
- Pace range: 0.5 to 2.0
- Preprocessing is automatically enabled
- Default sample rate is 22050 Hz when `speech_sample_rate` is omitted
- Supports sample rates: 8000, 16000, 22050, 24000 Hz (REST API also supports 32000, 44100, 48000 Hz)
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.textToSpeech.convert({
    text: "Welcome to Sarvam AI!",
    language_code: "hi-IN"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.TextToSpeechRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `TextToSpeechClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.textToSpeech.<a href="/src/api/resources/textToSpeech/client/Client.ts">convertStream</a>({ ...params }) -> core.BinaryResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Converts the input text into a streamed spoken audio response.

This endpoint supports streaming audio using the specified output codec (e.g., `audio/mpeg` for MP3). The response is returned as a binary audio stream, which can be played or saved directly by the client.

Supports the `dict_id` parameter to apply a [pronunciation dictionary](https://docs.sarvam.ai/api-reference-docs/pronunciation-dictionary/create) during synthesis.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.textToSpeech.convertStream({
    text: "Welcome to Sarvam AI!"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.TextToSpeechStreamRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `TextToSpeechClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

## VoiceCloning
<details><summary><code>client.voiceCloning.<a href="/src/api/resources/voiceCloning/client/Client.ts">convert</a>({ ...params }) -> SarvamAI.VoiceCloningResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

**Beta.** Generates speech in a cloned voice.

Provide **exactly one** of:
- `voice_id` — a saved cloned voice from `POST /voices/create` (or Content Studio), or
- `ref_audio` — a reference audio clip uploaded with this request (optional `ref_text` transcript).

Sending both returns `400`. A saved `voice_id` avoids re-uploading the clip on every call.

Accepts `multipart/form-data`.

**Base URL:** `https://api.sarvam.ai`.
**Auth:** send your key in the `api-subscription-key` header (recommended); `Authorization: Bearer <key>` is also accepted.

`language_code` is optional — omit it to detect the language from `text`, or pass it when pronunciation has to be exact. The cloned voice is cross-lingual: the reference clip's language does not need to match `language_code`.

**Billing:** charged per character of `text` against the `text_to_speech_voice_cloning` API. See the [pricing page](https://docs.sarvam.ai/api/getting-started/pricing).
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.voiceCloning.convert({
    voice_id: "svc-123e4567-e89b-12d3-a456-426614174000",
    text: "\u0928\u092E\u0938\u094D\u0924\u0947, \u092E\u0948\u0902 \u0906\u092A\u0915\u0940 \u0915\u0948\u0938\u0947 \u092E\u0926\u0926 \u0915\u0930 \u0938\u0915\u0924\u093E \u0939\u0942\u0901?"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.VoiceCloningRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `VoiceCloningClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.voiceCloning.<a href="/src/api/resources/voiceCloning/client/Client.ts">convertStream</a>({ ...params }) -> core.BinaryResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

**Beta.** Converts the input text into a streamed spoken audio response using a cloned voice.

Provide **exactly one** of:
- `voice_id` — a saved cloned voice from `POST /voices/create` (or Content Studio), or
- `ref_audio` — a reference audio clip uploaded with this request (optional `ref_text` transcript).

Sending both returns `400`. `language_code` is optional — omit it to detect the language from `text`, or pass it when pronunciation has to be exact. The response is a binary audio stream (not JSON), so you can begin playback as soon as the first sentence is ready.

Accepts `multipart/form-data`.

**Base URL:** `https://api.sarvam.ai`.
**Auth:** send your key in the `api-subscription-key` header (recommended); `Authorization: Bearer <key>` is also accepted.

**Streaming codecs:** `mp3` (default), `wav`, `linear16`, `mulaw`, `alaw`. `flac`, `aac`, and `opus` are not supported on this endpoint because each sentence would be a complete container that cannot be concatenated.

Quality checks (QC/VAD) and duration bounds (`min_audio_duration` / `max_audio_duration`) are not accepted — the stream path optimizes for time-to-first-byte.

**Billing:** charged per character of `text` against the `text_to_speech_voice_cloning` API. See the [pricing page](https://docs.sarvam.ai/api/getting-started/pricing).
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.voiceCloning.convertStream({
    voice_id: "svc-123e4567-e89b-12d3-a456-426614174000",
    text: "\u0928\u092E\u0938\u094D\u0924\u0947\u0964 \u092F\u0939 \u090F\u0915 \u0938\u094D\u091F\u094D\u0930\u0940\u092E\u093F\u0902\u0917 \u091F\u0947\u0938\u094D\u091F \u0939\u0948\u0964",
    output_audio_codec: "mp3"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.VoiceCloningStreamRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `VoiceCloningClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.voiceCloning.<a href="/src/api/resources/voiceCloning/client/Client.ts">createVoice</a>({ ...params }) -> SarvamAI.VoiceLibraryCreateResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

**Beta.** Creates a cloned voice from a reference audio clip in **one shot**. The whole pipeline runs inline: the audio is stored, validated for quality, transcribed via ASR, and cloned - the response returns the new `voice_id` and the auto-generated transcript (`reference_text`) together.

`remove_background_noise` defaults to `true`: background noise is removed from the reference audio using ML vocal extraction before the voice is saved. Pass `false` to keep the original clip. The response includes `background_noise_removed` to indicate whether denoise was actually applied.

Accepts `multipart/form-data` - send the audio as the `file` upload and everything else as form fields.

**Base URL:** `https://api.sarvam.ai`.
**Auth:** send your key in the `api-subscription-key` header.

**Limits:** max file size 50 MB. Voice count is capped by your subscription tier (e.g. 50 voices on the starter tier, counted across your organization) - the API returns 403 `TIER_LIMIT_REACHED` when the cap is hit.

**Billing:** charged against the voice cloning API. See the [pricing page](https://docs.sarvam.ai/api/getting-started/pricing).
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.voiceCloning.createVoice({
    file: fs.createReadStream("/path/to/your/file"),
    name: "name",
    language: "language"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.CreateVoiceRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `VoiceCloningClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.voiceCloning.<a href="/src/api/resources/voiceCloning/client/Client.ts">listVoices</a>({ ...params }) -> SarvamAI.VoiceLibraryListResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

**Beta.** Lists the cloned voices in your workspace, newest first. Use the returned `id` with POST /voices/clone (`voice_id`) or GET /voices/{voice_id}.

**Base URL:** `https://api.sarvam.ai`.
**Auth:** send your key in the `api-subscription-key` header.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.voiceCloning.listVoices({
    search: "search",
    gender: "gender",
    accent: "accent",
    limit: 1,
    offset: 1
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.ListVoicesRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `VoiceCloningClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.voiceCloning.<a href="/src/api/resources/voiceCloning/client/Client.ts">getVoice</a>(voice_id) -> SarvamAI.VoiceLibraryDetailResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

**Beta.** Returns full details for one cloned voice, including its ASR transcript (`reference_text`) and time-limited signed URLs for the reference, recorded, and preview audio.

**Base URL:** `https://api.sarvam.ai`.
**Auth:** send your key in the `api-subscription-key` header.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.voiceCloning.getVoice("voice_id");

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**voice_id:** `string` — ID of the cloned voice.
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `VoiceCloningClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.voiceCloning.<a href="/src/api/resources/voiceCloning/client/Client.ts">deleteVoice</a>(voice_id) -> void</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

**Beta.** Deletes a cloned voice: its audio assets are removed and the voice is no longer listed or usable for synthesis. On the Starter (pay as you go) plan (capped at 50 voices across your organization), deleting a voice frees a slot. Pro and Enterprise plans have higher limits.

**Base URL:** `https://api.sarvam.ai`.
**Auth:** send your key in the `api-subscription-key` header. Returns `204 No Content` on success.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.voiceCloning.deleteVoice("voice_id");

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**voice_id:** `string` — ID of the cloned voice to delete.
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `VoiceCloningClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

## PronunciationDictionary
<details><summary><code>client.pronunciationDictionary.<a href="/src/api/resources/pronunciationDictionary/client/Client.ts">list</a>() -> SarvamAI.PronunciationDictionaryGetResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Retrieve a list of all pronunciation dictionary IDs associated with the authenticated user.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.pronunciationDictionary.list();

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**requestOptions:** `PronunciationDictionaryClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.pronunciationDictionary.<a href="/src/api/resources/pronunciationDictionary/client/Client.ts">create</a>({ ...params }) -> SarvamAI.PronunciationDictionaryResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Upload a `.json` file to create a new pronunciation dictionary. Only supported by **bulbul:v3** and **bulbul:v4-flash**.

The file should contain a JSON object with a `pronunciations` key mapping language codes to word-pronunciation pairs. See the [Pronunciation Dictionary guide](/api-reference-docs/api-guides-tutorials/text-to-speech/pronunciation-dictionary) for format details and examples.

The returned `dictionary_id` can be passed as `dict_id` in text-to-speech requests (REST, HTTP Stream, and WebSocket).

**Limits:** Max 10 dictionaries per user, 100 words per dictionary, 1 MB file size.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.pronunciationDictionary.create({
    file: fs.createReadStream("/path/to/your/file")
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.CreatePronunciationDictionaryRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `PronunciationDictionaryClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.pronunciationDictionary.<a href="/src/api/resources/pronunciationDictionary/client/Client.ts">update</a>({ ...params }) -> SarvamAI.PronunciationDictionaryUpdateResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Update an existing pronunciation dictionary by uploading a JSON file. You can add new words, change existing pronunciations, or both — entries not included in the uploaded file remain unchanged.

**Limits:** Max 100 words per dictionary, 1 MB file size.

The response includes the `dictionary_id` and the updated pronunciation mappings for verification.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.pronunciationDictionary.update({
    file: fs.createReadStream("/path/to/your/file"),
    dict_id: "p_5cb7faa6"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.UpdatePronunciationDictionaryRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `PronunciationDictionaryClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.pronunciationDictionary.<a href="/src/api/resources/pronunciationDictionary/client/Client.ts">delete</a>({ ...params }) -> SarvamAI.PronunciationDictionaryDeleteResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Delete a pronunciation dictionary by its ID. Once deleted, the dictionary can no longer be referenced in text-to-speech requests.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.pronunciationDictionary.delete({
    dict_id: "dict_id"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.PronunciationDictionaryDeleteRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `PronunciationDictionaryClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.pronunciationDictionary.<a href="/src/api/resources/pronunciationDictionary/client/Client.ts">get</a>(dict_id) -> SarvamAI.PronunciationDictionaryData</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Retrieve the full pronunciation mappings for a specific dictionary by its ID.

Returns the pronunciation data organized by language code, where each language contains word-to-pronunciation pairs.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.pronunciationDictionary.get("dict_id");

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**dict_id:** `string` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `PronunciationDictionaryClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

## Chat
<details><summary><code>client.chat.<a href="/src/api/resources/chat/client/Client.ts">completions</a>({ ...params }) -> SarvamAI.CreateChatCompletionResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Creates a model response for the given chat conversation. This endpoint serves **only** `sarvam-105b` and `sarvam-105b-conversations`.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.chat.completions({
    messages: [{
            content: "content",
            role: "user"
        }],
    model: "sarvam-105b"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.ChatCompletionsRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `ChatClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.chat.<a href="/src/api/resources/chat/client/Client.ts">completionsV2</a>({ ...params }) -> SarvamAI.CreateChatCompletionV2Response</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Creates a model response for the given chat conversation, using an OpenAI-compatible request and response shape.

Requires `api-subscription-key`.

**Streaming is optional.** Default is one JSON response (`stream` omitted or `false`). Set `stream: true` for server-sent events; the stream ends with a `[DONE]` line.

**Reasoning (`glm5.3`, `glm5.3-flash`, `gemma4`, `deepseekv4.1-flash-1017`, `deepseekv4-pro`, `kimi-k3.1-pro`):** set `reasoning_effort` to **`low`**, **`high`**, or **`max`**. Default when omitted is **`max`**, except **`high`** on `glm5.3-flash`, `deepseekv4.1-flash-1017`, and `deepseekv4-pro`, and no reasoning on `gemma4`. **`none`** turns thinking off on `deepseekv4.1-flash-1017` and `deepseekv4-pro`. `kimi-k3.1-pro` always thinks. The trace is in `choices[].message.reasoning_content` and counts toward `max_tokens`. `gemma4` reasons only when `reasoning_effort` is set.

Request fields documented on this operation are validated by the API. Other OpenAI-compatible fields may be forwarded to the model when sent.

Legacy `functions` / `function_call` are rejected — use `tools` and `tool_choice`.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.chat.completionsV2({
    "x-session-affinity": "3f9c2b1e-7a4d-4e8b-9c1a-2d5e6f7a8b9c",
    messages: [{
            role: "user",
            content: "Summarise the causes of the 2008 financial crisis."
        }],
    model: "glm5.3"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.CreateChatCompletionV2Request` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `ChatClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

## SpeechToTextJob
<details><summary><code>client.speechToTextJob.<a href="/src/api/resources/speechToTextJob/client/Client.ts">initialise</a>({ ...params }) -> SarvamAI.BulkJobInitResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Create a new speech to text bulk job and receive a job UUID and storage folder details for processing multiple audio files. Set `job_parameters.input_audio_codec` when uploads are raw PCM (`pcm_s16le`, `pcm_l16`, or `pcm_raw`); the API auto-detects other formats. PCM must be 16 kHz.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.speechToTextJob.initialise({
    job_parameters: {}
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.SpeechToTextJobRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `SpeechToTextJobClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.speechToTextJob.<a href="/src/api/resources/speechToTextJob/client/Client.ts">getStatus</a>(job_id) -> SarvamAI.JobStatusResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Retrieve the current status and details of a speech to text bulk job, including progress and file-level information.

**Rate Limiting Best Practice:** To prevent rate limit errors and ensure optimal server performance, we recommend implementing a minimum 5-millisecond delay between consecutive status polling requests. This helps maintain system stability while still providing timely status updates.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.speechToTextJob.getStatus("job_id");

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `string` — The unique identifier of the job
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `SpeechToTextJobClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.speechToTextJob.<a href="/src/api/resources/speechToTextJob/client/Client.ts">start</a>(job_id, { ...params }) -> SarvamAI.JobStatusResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Start processing a speech to text bulk job after all audio files have been uploaded
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.speechToTextJob.start("job_id", {
    ptu_id: 1
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `string` — The unique identifier of the job
    
</dd>
</dl>

<dl>
<dd>

**request:** `SarvamAI.SpeechToTextJobStartRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `SpeechToTextJobClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.speechToTextJob.<a href="/src/api/resources/speechToTextJob/client/Client.ts">getUploadLinks</a>({ ...params }) -> SarvamAI.FilesUploadResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Generate presigned upload URLs for audio files that will be processed in a speech to text bulk job
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.speechToTextJob.getUploadLinks({
    job_id: "job_id",
    files: ["files"]
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.FilesRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `SpeechToTextJobClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.speechToTextJob.<a href="/src/api/resources/speechToTextJob/client/Client.ts">getDownloadLinks</a>({ ...params }) -> SarvamAI.FilesDownloadResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Generate presigned download URLs for the transcription output files of a completed speech to text bulk job.

**Required body fields:** `job_id` and `files` (array of output filenames such as `"0.json"`). Obtain filenames from the job status response (`job_details[].outputs[].file_name`) after the job reaches `Completed` or `PartiallyCompleted`.

**Method:** POST only (GET returns 405).
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.speechToTextJob.getDownloadLinks({
    job_id: "job_id",
    files: ["files"]
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.FilesRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `SpeechToTextJobClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

## SpeechToTextTranslateJob
<details><summary><code>client.speechToTextTranslateJob.<a href="/src/api/resources/speechToTextTranslateJob/client/Client.ts">initialise</a>({ ...params }) -> SarvamAI.BulkJobInitResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Create a new speech to text translate bulk job and receive a job UUID and storage folder details for processing multiple audio files with translation. Set `job_parameters.input_audio_codec` when uploads are raw PCM (`pcm_s16le`, `pcm_l16`, or `pcm_raw`); the API auto-detects other formats. PCM must be 16 kHz.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.speechToTextTranslateJob.initialise({
    job_parameters: {}
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.SpeechToTextTranslateJobRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `SpeechToTextTranslateJobClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.speechToTextTranslateJob.<a href="/src/api/resources/speechToTextTranslateJob/client/Client.ts">getStatus</a>(job_id) -> SarvamAI.JobStatusResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Retrieve the current status and details of a speech to text translate bulk job, including progress and file-level information.

**Rate Limiting Best Practice:** To prevent rate limit errors and ensure optimal server performance, we recommend implementing a minimum 5-millisecond delay between consecutive status polling requests. This helps maintain system stability while still providing timely status updates.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.speechToTextTranslateJob.getStatus("job_id");

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `string` — The unique identifier of the job
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `SpeechToTextTranslateJobClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.speechToTextTranslateJob.<a href="/src/api/resources/speechToTextTranslateJob/client/Client.ts">start</a>(job_id, { ...params }) -> SarvamAI.JobStatusResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Start processing a speech to text translate bulk job after all audio files have been uploaded
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.speechToTextTranslateJob.start("job_id", {
    ptu_id: 1
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `string` — The unique identifier of the job
    
</dd>
</dl>

<dl>
<dd>

**request:** `SarvamAI.SpeechToTextTranslateJobStartRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `SpeechToTextTranslateJobClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.speechToTextTranslateJob.<a href="/src/api/resources/speechToTextTranslateJob/client/Client.ts">getUploadLinks</a>({ ...params }) -> SarvamAI.FilesUploadResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Generate presigned upload URLs for audio files that will be processed in a speech to text translate bulk job
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.speechToTextTranslateJob.getUploadLinks({
    ptu_id: 1,
    body: {
        job_id: "job_id",
        files: ["files"]
    }
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.SpeechToTextTranslateJobGetUploadLinksRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `SpeechToTextTranslateJobClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.speechToTextTranslateJob.<a href="/src/api/resources/speechToTextTranslateJob/client/Client.ts">getDownloadLinks</a>({ ...params }) -> SarvamAI.FilesDownloadResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Generate presigned download URLs for the translated transcription output files of a completed speech to text translate bulk job.

**Required body fields:** `job_id` and `files` (array of output filenames such as `"0.json"`). Obtain filenames from the job status response after the job completes.

**Method:** POST only (GET returns 405).
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.speechToTextTranslateJob.getDownloadLinks({
    ptu_id: 1,
    body: {
        job_id: "job_id",
        files: ["files"]
    }
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.SpeechToTextTranslateJobGetDownloadLinksRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `SpeechToTextTranslateJobClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

## DocumentIntelligence
<details><summary><code>client.documentIntelligence.<a href="/src/api/resources/documentIntelligence/client/Client.ts">initialise</a>({ ...params }) -> SarvamAI.DocDigitizationCreateJobResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

**Legacy API.** The `/doc-digitization/job/v1` endpoints remain available for existing integrations. For new integrations, use the Document Intelligence API under `/doc-ai/v1`.

Creates a new Document Intelligence job.

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

**Output Formats (delivered as ZIP file):**
- `html`: Structured HTML files with layout preservation
- `md`: Markdown files (default)
- `json`: Structured JSON files for programmatic processing
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.documentIntelligence.initialise();

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.DocumentIntelligenceJobRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocumentIntelligenceClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.documentIntelligence.<a href="/src/api/resources/documentIntelligence/client/Client.ts">getUploadLinks</a>({ ...params }) -> SarvamAI.DocDigitizationUploadFilesResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

**Legacy API.** The `/doc-digitization/job/v1` endpoints remain available for existing integrations. For new integrations, use the Document Intelligence API under `/doc-ai/v1`.

Returns presigned URLs for uploading input files.

**File Constraints:**
- Exactly one file required (PDF or ZIP)
- PDF files: `.pdf` extension
- ZIP files: `.zip` extension
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.documentIntelligence.getUploadLinks({
    job_id: "job_id",
    files: ["files"]
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.DocDigitizationUploadFilesRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocumentIntelligenceClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.documentIntelligence.<a href="/src/api/resources/documentIntelligence/client/Client.ts">start</a>(job_id) -> SarvamAI.DocDigitizationJobStatusResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

**Legacy API.** The `/doc-digitization/job/v1` endpoints remain available for existing integrations. For new integrations, use the Document Intelligence API under `/doc-ai/v1`.

Validates the uploaded file and starts processing.

**Validation Checks:**
- File must be uploaded before starting
- File size must not exceed 200 MB
- PDF must be parseable by the PDF parser
- ZIP must contain only JPEG/PNG images
- ZIP must be flat (no nested folders beyond one level)
- ZIP must contain at least one valid image
- Page/image count must not exceed 10 (returns `400` with `invalid_request_error` if exceeded)
- User must have sufficient credits

**Processing:**
Job runs asynchronously. Poll the status endpoint for completion.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.documentIntelligence.start("job_id");

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `string` — The unique identifier of the job
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocumentIntelligenceClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.documentIntelligence.<a href="/src/api/resources/documentIntelligence/client/Client.ts">getStatus</a>(job_id) -> SarvamAI.DocDigitizationJobStatusResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

**Legacy API.** The `/doc-digitization/job/v1` endpoints remain available for existing integrations. For new integrations, use the Document Intelligence API under `/doc-ai/v1`.

Returns the current status of a job with page-level metrics.

**Job States:**
- `Accepted`: Job created, awaiting file upload
- `Pending`: File uploaded, waiting to start
- `Running`: Processing in progress
- `Completed`: All pages processed successfully
- `PartiallyCompleted`: Some pages succeeded, some failed
- `Failed`: All pages failed or job-level error

**Page Metrics:**
Response includes detailed progress: total pages, pages processed, succeeded, failed, and per-page errors.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.documentIntelligence.getStatus("job_id");

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `string` — The unique identifier of the job
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocumentIntelligenceClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.documentIntelligence.<a href="/src/api/resources/documentIntelligence/client/Client.ts">getDownloadLinks</a>(job_id) -> SarvamAI.DocDigitizationDownloadFilesResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

**Legacy API.** The `/doc-digitization/job/v1` endpoints remain available for existing integrations. For new integrations, use the Document Intelligence API under `/doc-ai/v1`.

Returns presigned URLs for downloading output files.

**Method:** POST only. A GET request to this path returns 405 Method Not Allowed.

**Prerequisites:**
- Job must be in `Completed` or `PartiallyCompleted` state
- Failed jobs have no output available
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.documentIntelligence.getDownloadLinks("job_id");

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `string` — The unique identifier of the job
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocumentIntelligenceClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

## DocAi
<details><summary><code>client.docAi.<a href="/src/api/resources/docAi/client/Client.ts">createUploadUrl</a>({ ...params }) -> SarvamAI.DocAiPresignUploadResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Creates a direct-upload handle for a file to be processed later.

**Flow:**
1. Call this endpoint with the MIME type you will upload (e.g. `application/pdf`).
2. Upload the file using the returned `method`, `url` and `headers` before `expires_at`.
3. Pass the returned `upload_id` through the `upload_ids` field on a later parse or extract job request.

When `content_type` is set, the upload's `Content-Type` header must match it.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.docAi.createUploadUrl();

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.DocAiPresignUploadRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocAiClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.docAi.<a href="/src/api/resources/docAi/client/Client.ts">parse</a>({ ...params }) -> SarvamAI.DocAiStartJobResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Creates and starts a parse job from files or pre-uploaded handles. Parse converts documents into structured HTML, Markdown, or JSON while preserving layout.

**Input:** Exactly one of `file` and `upload_ids` must be provided. Use `POST /doc-ai/v1/job/upload` to obtain upload IDs.

**Processing:** the job runs asynchronously. Poll `GET /doc-ai/v1/job/{job_id}/status` until a terminal status (`completed`, `partially_completed`, `failed`, `rejected`), then fetch output via the results or download-url endpoints.

Parse JSON results include blocks with text, tag and bounding box.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.docAi.parse({});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.DocAiParseRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocAiClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.docAi.<a href="/src/api/resources/docAi/client/Client.ts">extract</a>({ ...params }) -> SarvamAI.DocAiStartJobResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Creates and starts an extract job from files or pre-uploaded handles. Extract pulls structured fields out of documents according to a schema.

**Input:** Exactly one of `file` and `upload_ids` must be provided.

**Schema:** exactly one of `schema` (inline JSON schema) and `config_id` (saved extraction configuration) is required.

**Processing:** the job runs asynchronously. Poll `GET /doc-ai/v1/job/{job_id}/status` until a terminal status (`completed`, `partially_completed`, `failed`, `rejected`), then fetch output via the results or download-url endpoints.

Extract results include `result`, plus `annotations` mirroring the result shape where every leaf has `confidence` and `sources`.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.docAi.extract({
    schema: "{\"type\":\"object\",\"properties\":{\"policy_number\":{\"type\":\"string\",\"description\":\"Insurance policy number\"},\"insured_name\":{\"type\":\"string\",\"description\":\"Name of the insured person\"},\"sum_insured\":{\"type\":\"number\",\"description\":\"Total sum insured, in INR\"}}}",
    output_format: "json"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.DocAiExtractRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocAiClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.docAi.<a href="/src/api/resources/docAi/client/Client.ts">classify</a>({ ...params }) -> SarvamAI.DocAiJobAcceptedResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Creates a Classify job. Classify labels a document, or each page, against the categories you define, or suggests a document type when you supply none.

**Input:** send `file` (PDF, PNG, JPEG or TIFF; repeat the field for up to 10 documents) or `upload_ids`, plus a JSON `request` with the options below. You can also send a JSON body with `input` set to `{"document_ref": "..."}` to classify a child document returned by Split.

**Processing:** the job runs asynchronously. Poll `GET /doc-ai/v1/job/{job_id}/status` until it is `completed`, then fetch `GET /doc-ai/v1/job/{job_id}/results`. Add `?include=details` to the results for inspected pages, provenance and evidence.

**Review:** `review_required` tells you whether a person should check the answer. `confidence` can be `null`; it is a token-based score, not a measured probability.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.docAi.classify({
    request: {}
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.DocAiClassifyRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocAiClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.docAi.<a href="/src/api/resources/docAi/client/Client.ts">split</a>({ ...params }) -> SarvamAI.DocAiJobAcceptedResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Creates a Split job. Split divides a bundle of pages into separate child documents, each with its original page numbers and a `document_ref` you can reuse in other requests.

**Methods:** `fixed_pages` (equal page groups), `page_ranges` (you give the boundaries), `triggers` (split at QR codes, barcodes, blank pages, text or photos) and `semantic` (the model finds the boundaries).

**Input:** send `file` (PDF, PNG, JPEG or TIFF; repeat the field for up to 10 documents) or `upload_ids`, plus a JSON `request`.

**Processing:** the job runs asynchronously. Poll `GET /doc-ai/v1/job/{job_id}/status` until it is `completed`, then fetch `GET /doc-ai/v1/job/{job_id}/results`. `completed` means processing finished, not that every segment passed review: check each segment's `review.required`.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.docAi.split({
    request: {}
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.DocAiSplitRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocAiClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.docAi.<a href="/src/api/resources/docAi/client/Client.ts">getStatus</a>(job_id) -> SarvamAI.DocAiJobStatusResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Returns a job's status and page-level usage.

**Terminal statuses:** `completed`, `partially_completed`, `failed`, `rejected`. Results and download URLs are only available after the job reaches a terminal status.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.docAi.getStatus("job_id");

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `string` — The unique identifier of the job
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocAiClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.docAi.<a href="/src/api/resources/docAi/client/Client.ts">getResults</a>(job_id, { ...params }) -> SarvamAI.DocAiGetResultsResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Returns terminal job results. Results are never available while a job is running; requesting them before a terminal status returns `409`.

**Parse results** include `job_id`, `type`, `status`, `usage` and `documents`.

**Extract results** include `job_id`, `type`, `status`, `usage`, `result`, `annotations` and `version`. `annotations` mirrors the result shape; every leaf has `confidence` and `sources`.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.docAi.getResults("20260707_6eb74174-e2c3-490d-afe5-d2e7e9e2b6c7", {
    format: "json"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `string` — The unique identifier of the job.
    
</dd>
</dl>

<dl>
<dd>

**request:** `SarvamAI.DocAiGetResultsRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocAiClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.docAi.<a href="/src/api/resources/docAi/client/Client.ts">getDownloadUrl</a>(job_id) -> SarvamAI.DocAiDownloadUrlResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Creates a download URL for a completed job's output. Download the output using the returned `method`, `url` and `headers` before `expires_at`.

Requesting a download URL before the job reaches a terminal status returns `409`.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.docAi.getDownloadUrl("job_id");

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `string` — The unique identifier of the job
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DocAiClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.docAi.<a href="/src/api/resources/docAi/client/Client.ts">getCapabilities</a>() -> SarvamAI.DocAiCapabilitiesResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Returns the Classify and Split features, input formats, limits and options enabled on this deployment. Check it before using options such as `reasoning_input` image modes or photo triggers.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.docAi.getCapabilities();

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**requestOptions:** `DocAiClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

## Responses
<details><summary><code>client.responses.<a href="/src/api/resources/responses/client/Client.ts">createStream</a>({ ...params }) -> core.Stream&lt;SarvamAI.ResponseStreamEvent&gt;</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Generate a model reply in the OpenAI Responses format.

**Models:** `sarvam-105b`, `sarvam-105b-conversations`, `glm5.3`, `gemma4`, `deepseekv4.1-flash-1017`, `glm5.3-flash`, `deepseekv4.1-flash-1017-interactive`, and, on Provisioned Throughput, `deepseekv4-pro`, `kimi-k3.1-pro`, `qwen38-27b` (ids are case-sensitive).

**Each call is independent.** Send the full conversation in `input` every time — nothing is stored for you. Leave out `store` or set it to `false` (`true` returns **`400`**). You cannot load a past response by id (`GET /v2/responses/{id}` is always **`404`**).

**Streaming is optional.** Default is a single JSON body (`stream` omitted or `false`). Set `stream: true` only if you want server-sent events.

**Reasoning (`glm5.3`, `deepseekv4.1-flash-1017`):** both support `low`, `high`, and `max`. On `glm5.3`, `reasoning.effort` only accepts **`low`** or **`high`** — omit `reasoning` / `effort` for **`max`**-level reasoning, since sending the literal string **`"max"`** returns **`400`**. On `deepseekv4.1-flash-1017`, all three values including `max` work directly. Read the trace from the reasoning item's `content[0].text`; `summary` is filled only when `reasoning.summary` is set. Reasoning tokens count toward `max_output_tokens`, which has no default cap — omitting it means unbounded generation.

Other fields are documented below. See the [Responses API guide](/api/api-guides-tutorials/chat-completion/responses-api).
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
const response = await client.responses.createStream({
    model: "sarvam-105b",
    input: "input"
});
for await (const item of response) {
    console.log(item);
}

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.ResponsesCreateStreamRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `ResponsesClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.responses.<a href="/src/api/resources/responses/client/Client.ts">create</a>({ ...params }) -> SarvamAI.CreateResponseV2Response</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Generate a model reply in the OpenAI Responses format.

**Models:** `sarvam-105b`, `sarvam-105b-conversations`, `glm5.3`, `gemma4`, `deepseekv4.1-flash-1017`, `glm5.3-flash`, `deepseekv4.1-flash-1017-interactive`, and, on Provisioned Throughput, `deepseekv4-pro`, `kimi-k3.1-pro`, `qwen38-27b` (ids are case-sensitive).

**Each call is independent.** Send the full conversation in `input` every time — nothing is stored for you. Leave out `store` or set it to `false` (`true` returns **`400`**). You cannot load a past response by id (`GET /v2/responses/{id}` is always **`404`**).

**Streaming is optional.** Default is a single JSON body (`stream` omitted or `false`). Set `stream: true` only if you want server-sent events.

**Reasoning (`glm5.3`, `deepseekv4.1-flash-1017`):** both support `low`, `high`, and `max`. On `glm5.3`, `reasoning.effort` only accepts **`low`** or **`high`** — omit `reasoning` / `effort` for **`max`**-level reasoning, since sending the literal string **`"max"`** returns **`400`**. On `deepseekv4.1-flash-1017`, all three values including `max` work directly. Read the trace from the reasoning item's `content[0].text`; `summary` is filled only when `reasoning.summary` is set. Reasoning tokens count toward `max_output_tokens`, which has no default cap — omitting it means unbounded generation.

Other fields are documented below. See the [Responses API guide](/api/api-guides-tutorials/chat-completion/responses-api).
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.responses.create({
    model: "sarvam-105b",
    input: "input"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.ResponsesCreateRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `ResponsesClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

## ChatCompletion
<details><summary><code>client.chatCompletion.<a href="/src/api/resources/chatCompletion/client/Client.ts">listModelsV2</a>() -> SarvamAI.ModelListResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Lists the model IDs available for the V2 Chat Completion API.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.chatCompletion.listModelsV2();

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**requestOptions:** `ChatCompletionClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.chatCompletion.<a href="/src/api/resources/chatCompletion/client/Client.ts">getModelV2</a>(model_id) -> SarvamAI.ModelObject</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Retrieves one served model by ID.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.chatCompletion.getModelV2("model_id");

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**model_id:** `string` — A model ID from `GET /v2/models`, e.g. `glm5.3`.
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `ChatCompletionClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

## Decisions
<details><summary><code>client.decisions.<a href="/src/api/resources/decisions/client/Client.ts">create</a>({ ...params }) -> SarvamAI.SystemOneResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse.

**Models:** `sarvam-prism` (serverless) and `clef` (Provisioned Throughput; also reads images).

Requires `api-subscription-key`, or `Authorization: Bearer <key>`.

**Question types:** `noul` (yes/no), `choice` (one of your options) and `score` (a level on your ordered scale).

**Repeatability:** on `sarvam-prism`, probabilities can vary slightly between identical requests and the top answer is stable; the order of `choice` options does not affect the answer. On `clef`, identical requests return identical probabilities.

**Images:** `clef` reads base64 images in `images`; image URLs return `400`. `sarvam-prism` refuses `images` (image URLs return `400`, inline images `422`).

**Not supported:** streaming. `temperature` returns `422` on both models. `sarvam-prism` also refuses `max_tokens` and `stream` with `422`; `clef` accepts and ignores them. Unknown keys inside a question return `422`.

**Limits:**
- `sarvam-prism`: 32,768 tokens per question (state + question + options), 2–255 options per `choice`, and 2–10 levels per `score`. If any one question breaks a limit, the whole request fails with `422`.
- `clef`: 65,536 tokens per request (state, every question and its options, and images), 1–255 options per `choice`, and 1–10 levels per `score`. A longer request fails with `400`.

There is no cap on the number of questions, and the state is never truncated.

**Timeout:** each request must finish within 60 seconds. A longer request fails with `503 model_overloaded`; split very large batches across several requests before retrying.

**Errors:** every error carries a `message`, a `code` and a `request_id`. Validation errors also carry `param`, the path to the field at fault, such as `questions.urgent.noul.instruction`.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.decisions.create({
    model: "sarvam-prism",
    state: "My Stripe integration stopped working and all checkout payments are failing.",
    questions: {
        "urgent": {
            type: "noul"
        },
        "department": {
            type: "choice",
            criteria: {}
        },
        "severity": {
            type: "score",
            criteria: ["trivial", "minor", "moderate", "major", "critical"]
        }
    }
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `SarvamAI.SystemOneRequest` 
    
</dd>
</dl>

<dl>
<dd>

**requestOptions:** `DecisionsClient.RequestOptions` 
    
</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

