Sarvam Dictate API Guide: Add Multilingual Voice Input

November 25, 2026 16 min read By Bejoy Naduvilathara Joy
Sarvam Dictate API Guide: Add Multilingual Voice Input

Voice input is useful only when the resulting text is ready to use. A conventional speech recognition system can capture spoken words, but the result may still contain repeated phrases, fillers, unfinished sentences and incorrectly recognized names.

That creates extra work for anyone using voice input to write a message, complete a form or update a customer record.

The Sarvam Dictate API takes a different approach. Announced on November 23, 2026, it combines speech recognition with a text-finishing step designed to produce the words a person intended to type. It supports English and 22 Indian languages, including Malayalam, and can handle mixed-language speech.

For developers, this opens up practical ways to add voice input to productivity applications, ecommerce platforms, customer management systems and multilingual services.

This guide explains how to integrate Sarvam Dictate using Python and JavaScript, process longer recordings, build live dictation and customize the returned text.

Quick Summary

  • Sarvam Dictate converts speech into cleaned-up text rather than returning only a raw transcript.
  • It supports English and 22 Indian languages, including Malayalam.
  • Use POST /v2/dictate for audio clips up to 30 seconds.
  • Use POST /v2/dictate/jobs for recordings up to one hour.
  • Use WSS /v2/dictate/ws for live microphone dictation.
  • The vocabulary and context.reference fields help recognise product names, people and technical terms.
  • The mode setting controls whether the output uses native scripts, mixed scripts or Latin characters.
  • output_rules can generate structured JSON from a recording.
  • The published pay-as-you-go price is ₹0.50 per minute of audio.

What Is the Sarvam Dictate API?

Sarvam Dictate is a speech-to-text API designed around the difference between speaking and writing.

People rarely speak in perfectly structured sentences. They repeat words, pause to think, correct themselves and use names that a general speech recognition system may not recognise.

For example, someone might say:

Um, let’s meet on Tuesday, no sorry, Wednesday at the main office.

A conventional transcription could preserve the entire sentence. Dictate’s finished text can instead read:

Let’s meet on Wednesday at the main office.

The API provides two important results:

  • transcript: The original speech recognition output.
  • text: The finished version intended for use in an application.

This distinction is useful when developers need both a readable result and an original record of what was recognized.

The API also supports vocabulary, contextual information and formatting instructions. Applications can provide details about the user’s current task so the system has a better chance of recognizing relevant names and terminology.

Sarvam Dictate vs Conventional Speech-to-Text

Both technologies convert audio into text, but their intended outputs are different.

CapabilityConventional speech-to-textSarvam Dictate
Main purposeCapture spoken wordsProduce usable written text
Fillers and repetitionsUsually preservedCan be cleaned up
Self-correctionsMay retain both versionsCan select the corrected version
Custom vocabularyRecognition prompts or keytermsVocabulary and reference context
FormattingUsually handled separatelySupports style rules
Structured outputRequires additional processingSupports output_rules
Long recordingsDepends on the APIJobs up to one hour
Live audioOften supports streamingWebSocket dictation

This does not make Dictate the right choice for every speech application.

If you need a faithful transcript for research, search indexing, analytics or legal review, preserving the original words may be more important than cleaning them up. Sarvam’s Speech-to-Text service, Saaras, is better suited to raw transcription workflows.

Dictate is more useful when the text is intended to go directly into a message, note, form or business record.

Set Up the Sarvam SDK

Before making an API request, create a Sarvam API key through the developer dashboard.

Keep the key in an environment variable rather than placing it inside frontend JavaScript or committing it to a repository.

The official SDK packages are:

Python

pip install "sarvamai==0.1.49a1"

JavaScript / TypeScript

npm install "sarvamai@1.1.22-alpha.1"

These are the prerelease SDK versions currently used in Sarvam’s Dictate documentation. Check the official package documentation for newer releases before upgrading.

Set the API key in your environment:

export SARVAM_API_KEY="your_api_key"

For production applications, use a secrets manager or your hosting platform’s environment-variable settings.

Make Your First Dictation Request

The simplest integration uses POST /v2/dictate.

This endpoint accepts an audio clip of up to 30 seconds and returns the result directly. It is a good starting point for voice notes, short messages and voice-enabled form fields.

Python implementation

Create a file named dictate.py:

import os
from sarvamai import SarvamAI

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

with open("voice-note.wav", "rb") as audio:
    response = client.dictate.transcribe(
        file=audio,
        language_code="en-IN"
    )

print("Finished text:", response.text)
print("Raw transcript:", response.transcript)
print("Degraded:", response.degraded)

Run it:

python dictate.py

The text property contains the finished output, while transcript contains the original recognition result.

Always inspect degraded. A null value indicates that the finishing step ran. If it contains a reason, the returned text may be the raw transcript rather than the cleaned-up result.

JavaScript implementation

The JavaScript SDK supports the same dictation operation. The documented method accepts a readable audio stream and the request fields:

import fs from "node:fs";

// Use the configured Sarvam SDK client.
const response = await client.dictate.transcribe({
  file: fs.createReadStream("voice-note.wav"),
  language_code: "en-IN"
});

console.log("Finished text:", response.text);
console.log("Raw transcript:", response.transcript);
console.log("Degraded:", response.degraded);

Here, client represents your configured SarvamAI SDK instance. Keep its initialization and API key on the server.

The short-clip endpoint accepts common formats such as WAV, MP3 and M4A. The audio must be no longer than 30 seconds and must remain within the documented upload limit.

Add Malayalam and English Code-Mixed Dictation

One of the useful capabilities for Indian applications is mixed-language input.

A person might speak Malayalam while naturally using English product names, technical terms or interface terminology.

For example, a user could say:

ഈ order നാളെ deliver ചെയ്യണം.

A developer building a Malayalam-first application may want the Malayalam words in Malayalam script while retaining the English words in Latin characters.

Use the following settings:

with open("malayalam-note.wav", "rb") as audio:
    response = client.dictate.transcribe(
        file=audio,
        language_code="ml-IN",
        mode="codemix"
    )

print(response.text)

The important fields are:

  • language_code="ml-IN" identifies Malayalam.
  • mode="codemix" allows the output to retain English words in Latin characters while writing the Indian-language portions in their own script.

Sarvam documents four output modes:

ModeOutput behaviourSuitable use
codemixNative-language script with English words in Latin lettersChat messages and mixed-language input
transcribeOne script for the outputDocuments and search
translitLatin charactersRomanised Indian-language text
verbatimPreserves words as spoken without normal dictation editsExact records

The default is transcribe.

A useful implementation detail: when you already know the language, provide its language code rather than relying on automatic detection. The documentation notes that a known language is more reliable than auto.

Process Longer Recordings With Dictate Jobs

The short-clip endpoint is not intended for lengthy recordings.

For audio longer than 30 seconds, use:

POST /v2/dictate/jobs

This endpoint supports recordings up to one hour. Instead of returning the finished text immediately, it creates a job and returns a job_id.

Create a recording job

from sarvamai import SarvamAI
import os

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

with open("meeting.wav", "rb") as audio:
    job = client.dictate.jobs.create(
        file=audio,
        language_code="en-IN",
        output_rules=(
            "Return a concise meeting summary with action items. "
            "Include only information stated in the recording."
        )
    )

print("Job ID:", job.job_id)
print("Status:", job.job_state)

A successful creation request returns a job identifier. It does not mean the audio has already been processed.

Retrieve the result

Use the job identifier to check the processing status:

import time

while True:
    job = client.dictate.jobs.get(
        job_id=job.job_id
    )

    if job.job_state in ("Completed", "Failed"):
        break

    time.sleep(5)

if job.job_state == "Completed":
    print(job.result.text)
else:
    print(job.error.code, job.error.message)

You can also provide a callback URL when creating a job, rather than repeatedly polling for completion.

Completed job results are retained for seven days. Retrieve the information you need and delete the job when it is no longer required.

For larger files, the API also supports an HTTPS audio_url that Sarvam can download. This can be useful when your application already stores recordings in cloud storage.

Build Live Dictation With WebSockets

For a voice-enabled application, waiting until someone finishes recording before displaying text may not provide the best experience.

Sarvam Dictate supports live audio through:

wss://api.sarvam.ai/v2/dictate/ws

The WebSocket sends partial transcript updates while the user speaks. When a pause completes a turn, it sends a finished dictation.final result.

A typical integration follows this sequence:

  1. Your backend opens the WebSocket connection.
  2. The application sends microphone audio to your backend.
  3. Your backend forwards audio chunks to Sarvam.
  4. Partial transcript events are sent back to the interface.
  5. The interface replaces the preview with the finished text after each pause.
  6. The session ends with an explicit end message.

Important authentication requirement

Do not connect directly from browser JavaScript using your permanent API key.

Sarvam requires the api-subscription-key header for the WebSocket handshake. The standard browser WebSocket interface does not allow applications to set arbitrary authentication headers.

Instead, build a backend WebSocket proxy or streaming endpoint. The browser sends audio to your server, and the server connects to Sarvam using the protected API key.

This keeps the credential out of the browser and prevents users from extracting it through developer tools.

Python streaming example

The official asynchronous SDK exposes a streaming client:

import asyncio
import base64
import os
import wave

from sarvamai import AsyncSarvamAI
from sarvamai.types import DictateAudioInput, DictateEnd

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

CHUNK = 3200

async def live_dictation(path):
    with wave.open(path) as audio:
        pcm = audio.readframes(audio.getnframes())

    async with client.dictate_streaming.connect(
        language_code="en-IN",
        encoding="linear16",
        sample_rate="16000"
    ) as ws:

        async def send_audio():
            for i in range(0, len(pcm), CHUNK):
                chunk = base64.b64encode(
                    pcm[i:i + CHUNK]
                ).decode()

                await ws.send_audio(
                    DictateAudioInput(audio=chunk)
                )

                await asyncio.sleep(CHUNK / 32000)

            await ws.end(DictateEnd())

        sender = asyncio.create_task(send_audio())

        async for message in ws:
            if message.event == "transcript.partial":
                print("Preview:", message.text)

            elif message.event == "dictation.final":
                print("Finished:", message.text)

            elif message.event == "error":
                print("Error:", message.code, message.message)

        await sender

asyncio.run(live_dictation("voice-note.wav"))

This example streams a 16 kHz, mono, 16-bit WAV recording in small chunks. For live applications, the same principle applies to audio captured from the microphone.

Send audio at approximately real-time speed. The documented maximum is one second of audio per message, or half a second when using the fast streaming option.

The interface should treat transcript.partial as a preview, not final text. Replace the relevant turn with dictation.final when the finished result arrives.

Improve Recognition With Custom Vocabulary

A general speech model may struggle with names that are specific to your application.

Think about an ecommerce platform with product names, a CRM containing customer names, or a developer tool that uses framework-specific terminology.

Instead of expecting the model to recognise every term without context, send the relevant vocabulary with the audio.

vocabulary = [
    {
        "word": "Pixoptimo",
        "description": "A developer and designer tools platform"
    },
    {
        "word": "Planfo CMS",
        "description": "A static website content management system"
    },
    {
        "word": "VLedger",
        "description": "A fintech dashboard template"
    }
]

with open("product-note.wav", "rb") as audio:
    response = client.dictate.transcribe(
        file=audio,
        language_code="en-IN",
        vocabulary=vocabulary
    )

print(response.text)

for correction in response.corrections:
    print(
        correction.heard,
        "->",
        correction.wrote
    )

Each vocabulary entry can include the expected spelling, up to five sounds_like alternatives and an optional description.

The API supports up to 1,000 vocabulary entries per request. That does not mean sending an entire product catalogue is a good idea. Sarvam recommends providing the names relevant to the current recording.

You can also pass context.reference when the names already exist in a document, such as a CRM record, meeting agenda or product list.

Use context.text to explain the situation surrounding the recording. For example, you could describe it as a customer support call about a broadband connection.

These fields serve different purposes:

  • vocabulary: Specific names and terms that must have the correct spelling.
  • context.reference: A document containing relevant names and terminology.
  • context.text: Background information about the recording.

Check the returned corrections field. It shows which vocabulary or reference-based changes were made, allowing your application to review potentially incorrect replacements.

Control Text Formatting With Style Rules

Recognition is only part of a useful dictation experience. Different applications expect different output formats.

A chat message may need natural sentences, while a task manager might prefer bullet points. A finance application may need amounts formatted with the rupee symbol.

Sarvam provides style.preset and style.rules for this purpose.

The available presets include:

  • none: No finishing edits.
  • light: Retains more of the original spoken wording.
  • clean: Removes more fillers and unnecessary repetition.

You can also provide formatting instructions:

style = {
    "preset": "clean",
    "rules": (
        "Write money amounts using the ₹ symbol "
        "and Indian digit grouping. "
        "Format times using the 24-hour clock."
    )
}

with open("finance-note.wav", "rb") as audio:
    response = client.dictate.transcribe(
        file=audio,
        language_code="en-IN",
        style=style
    )

print(response.text)

There is an important distinction between formatting and generating new content.

style.rules changes the form of the recognized text. It should not be used to add a greeting, write a new email or create a summary that was not spoken.

For those tasks, use output_rules.

Generate Structured JSON for Forms and CRM Systems

One of the more useful features for business applications is the ability to turn a recording into a structured result.

Imagine a sales representative speaking a customer order into a CRM application. Instead of asking the user to dictate each field separately, your application can request a JSON object containing the relevant information.

import json

CRM_RULES = """
Return only one JSON object with these keys:

{
  "customer_name": string or null,
  "city": string or null,
  "phone": string or null,
  "product": string or null,
  "quantity": number or null
}

Use null when a value was not mentioned.
Write every value in English.
Do not invent missing information.
"""

with open("sales-call.wav", "rb") as audio:
    response = client.dictate.transcribe(
        file=audio,
        language_code="hi-IN",
        mode="codemix",
        output_rules=CRM_RULES
    )

if response.output and response.output.text:
    record = json.loads(response.output.text)
    print(json.dumps(record, indent=2, ensure_ascii=False))

The generated JSON is available through response.output.text, separate from the regular finished text.

This is useful for:

  • Customer information forms.
  • Ecommerce order details.
  • Sales call records.
  • Support ticket creation.
  • Meeting action items.
  • Appointment booking information.

Treat the generated JSON as untrusted application input. Validate field types, check required values and confirm important details before saving records or triggering actions.

The model can only extract information supported by the recording. It should not be expected to calculate totals or reliably infer missing values. Perform calculations and business validation in your own application code.

Language Support and Script Options

Sarvam Dictate supports English and 22 Indian languages.

The API accepts language codes such as:

LanguageCode
English (India)en-IN
Hindihi-IN
Malayalamml-IN
Tamilta-IN
Telugute-IN
Kannadakn-IN
Bengalibn-IN
Marathimr-IN
Gujaratigu-IN
Punjabipa-IN
Odiaor-IN
Assameseas-IN
Urduur-IN
Nepaline-IN
Konkanikok-IN

The remaining supported languages include Bodo, Dogri, Kashmiri, Maithili, Manipuri, Sanskrit, Santali and Sindhi.

For applications where the language is unknown, use auto. The API returns the detected language code in its response. However, when the language is already known, specifying it is the more reliable approach.

The output mode then determines how the text is written. For example, codemix is useful when a Malayalam speaker naturally includes English product names, while translit is appropriate when the user prefers typing Malayalam using Latin characters.

Test the language and script combinations with real recordings from the audience your application serves. Language support does not mean every accent, recording condition or domain-specific phrase will produce identical results.

Pricing and Practical Limits

Sarvam publishes a pay-as-you-go price of ₹0.50 per minute of audio for Dictate. Speech recognition and the finishing step are included in that price.

FeatureDocumented limit
Short audio clipUp to 30 seconds
Short clip uploadUp to 10 MB
Long recording jobUp to 1 hour
Job upload through gatewayAbout 100 MB
Live WebSocket sessionUp to 3 hours
Audio per live messageUp to 1 second
Vocabulary entriesUp to 1,000
Job result retention7 days

The published price is a pay-as-you-go rate. Other plans may offer different pricing.

For a production application, also consider the cost of retries, storage, audio uploads and the infrastructure required to relay live audio.

Is Sarvam Dictate Ready for Production Applications?

Sarvam Dictate offers a useful combination of multilingual recognition, text cleanup, contextual vocabulary and structured output. That makes it relevant to applications where users want to speak naturally and receive text they can immediately review or submit.

However, developers should test it against their own recordings before choosing it as the default input method.

Pay particular attention to:

  • Recognition quality across regional accents.
  • Malayalam-English and other code-mixed speech.
  • Names, product identifiers and technical terminology.
  • Background noise and microphone quality.
  • The difference between raw transcripts and finished text.
  • Whether the degraded field indicates that finishing was skipped.
  • Validation of generated JSON before storing business records.

Sarvam’s launch announcement reports fewer character edits than competing dictation systems in its own evaluation. Those results come from Sarvam’s datasets and evaluation methodology; they should be treated as company-reported comparisons, not independent proof of performance across every application.

There are also functional boundaries to consider. Dictate does not provide SRT or VTT subtitle files, browser-ready WebSocket tokens or a dedicated translation mode. Translation can be requested through formatting rules, but developers should test the result carefully.

Final Thoughts

The Sarvam Dictate API addresses a practical problem in voice-enabled software: people speak naturally, but applications usually need structured, readable text.

By combining recognition with text finishing, language and script controls, vocabulary, context and JSON output, it gives developers more control over what happens between a spoken instruction and the final application input.

For Indian-language products, Malayalam-enabled services and applications that support English mixed with regional languages, it is worth evaluating.

Start with the short-clip endpoint, test the output against real user recordings, and then add job processing or live WebSocket dictation if your workflow needs it. Keep the original transcript, inspect corrections and validate important information before using it in business operations.

The strongest implementation is not simply one that accepts voice. It is one that gives users accurate, reviewable text in the language and format they actually use.

Stay tuned to Pixoptimo as we bring you the latest insights on design, development, tools, and the technology shaping the web.