ASR quickstart

Overview

Transcribe spoken audio into text across 22+ Indian languages using state-of-the-art Automatic Speech Recognition (ASR) models hosted on Bhashini Dhruva.

Getting started

  1. Get an inference API key from the Bhashini developer portal.
  2. Choose an ASR service ID for your target spoken language.
  3. Prepare your audio: 16 kHz mono WAV/MP3 encoded in standard base64 string.
  4. Receive transcribed text under pipelineResponse[0].output[0].source.

Audio requirements & best practices

  • Sample rate: 16,000 Hz (16 kHz) is strongly recommended for optimal recognition accuracy.
  • Channels: 1 channel (Mono). Convert multi-channel or stereo audio to mono before encoding.
  • Format: Linear PCM WAV, MP3, or FLAC encoded as standard UTF-8 Base64 string.
  • Duration limit: For batch REST requests, audio should ideally be under 60 seconds. For continuous real-time streams, use the Streaming WebSocket API.

Converting an audio file to base64

import fs from "fs";


const base64Audio = fs.readFileSync("my_recording.wav").toString("base64");

Interactive playground

Try ASR
Record from microphone or upload audio to transcribe in real time
Request
Choose audio file
audio or video (wav, flac, mp3, m4a, aac, ogg, webm, mp4, mov) · max 120 s
Audio (base64)
Add an inference API key to run.
curl
curl --location 'https://dhruva-api.bhashini.gov.in/services/inference/pipeline' \
--header 'Accept: */*' \
--header 'Authorization: YOUR_INFERENCE_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"pipelineTasks": [
{
"taskType": "asr",
"config": {
"serviceId": "",
"language": {
"sourceLanguage": "hi"
}
}
}
],
"inputData": {
"audio": [
{
"audioContent": "<base64-audio>"
}
]
}
}'
Response
Send a request to see the live response here.

Code examples

import fs from "fs";


const url = 'https://dhruva-api.bhashini.gov.in/services/inference/pipeline';
const audioBase64 = fs.readFileSync("sample.wav").toString("base64");


const payload = {
  pipelineTasks: [{
    taskType: 'asr',
    config: {
      language: { sourceLanguage: 'hi' },
      serviceId: '<ASR_SERVICE_ID>'
    }
  }],
  inputData: {
    audio: [{ audioContent: audioBase64 }]
  }
};


const res = await fetch(url, {
  method: 'POST',
  headers: {
    'Accept': '*/*',
    'Authorization': '<YOUR_INFERENCE_API_KEY>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(payload)
});


const data = await res.json();
console.log("Transcribed Text:", data.pipelineResponse[0].output[0].source);