PARAS MADAN
All writing

Latest in AI

Sarvam Dictate API: Test Hinglish, Roman Hindi and Raw Fallbacks

Compare the raw transcript with edited text, choose a script and handle successful responses where the dictation cleanup did not run.

Sarvam launched Dictate on November 23 for English and 22 Indian languages at ₹0.50 per audio minute. It returns two versions of a clip in one call: the words its speech recognizer heard and the text it edited for someone to use. If you're building voice typing, compare both before deciding what goes into the user's draft.

The distinction matters when someone says a wrong date and then corrects it. Raw transcription should preserve both statements. A finished note should retain the intended date without losing a separate “don't send it” instruction. Those are different jobs, even when both outputs look fluent.

Start with one bilingual clip

Record a short fictional reminder: “Tuesday shipment note mein 14 boxes, sorry, 40 boxes likho. Packing list abhi forward mat karna.” Make an answer key for four items: Tuesday, 40 boxes, packing list, and the instruction not to forward it yet. The last item matters more than perfect punctuation.

Use the clip endpoint for up to 30 seconds and 10 million bytes. Send the options as multipart form fields. Putting the language in the query string can quietly leave the request on automatic detection. Use the exact HTTPS endpoint without a trailing slash.

curl --fail-with-body https://api.sarvam.ai/v2/dictate \
  -H "api-subscription-key: $SARVAM_API_KEY" \
  -F file=@reminder.wav \
  -F language_code=hi-IN \
  -F mode=codemix

Repeat with mode=translit for Roman Hindi. The script guide explains that codemix keeps the local-language portion in its own script and English in Latin letters, while translit writes the whole result in Latin letters. Check the four facts in both outputs. Switching scripts is not a reason to change a quantity or a negation.

Handle HTTP 200 when editing didn't run

Check degraded before you label the result “cleaned.” If the finishing step fails or runs too long, Sarvam documents that the request still returns 200 and puts the raw transcript into text. Show it as a transcript and let the user review it. Treat an empty text separately: a clip with just background noise can also return 200.

Keep the original voice clip or the transcript available for review when your data policy permits. If a product name is repeatedly misspelled, test a short custom vocabulary and inspect corrections. An unrelated term in the vocabulary can make a similar-sounding name less accurate, not more.

Pick the endpoint for the actual workflow

At the launch rate, 1,000 audio minutes are ₹500 before any other costs. That gives you an initial budget, but track how often someone still has to fix a number or restore a missing instruction. The quicker workflow may not be the one with fewer visible typos.

For recordings longer than the clip limit, use the documented jobs endpoint for up to one hour. For a live preview, the WebSocket guide distinguishes early raw text from the finished turn. Keep the API key on the server. If your use case is searchable records or immediate voice-agent reactions, the API comparison says raw Saaras speech-to-text may be the better fit.

I'm Paras. I help AI teams write implementation guides around the details a developer needs before shipping. Book a 30-minute call.