API Reference
Speech To Text · WebSocket
wss://stream.shabd.tech/v1/speech-to-textConnection headers
x-api-keystringrequiredAPI key for authentication.
Message flow
- Outgoing Message (↑): The client sends metadata first then sends audio data in bytes.
- Incoming Message (↓): The server responds json with requestId, status, transcript, language, chunk, completed, mode.
Send Metadata (↑):
{ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "language": "tamil", "sampleRate": 16000, "projectId": "<your-project-id-here>"}Send Audio Data (↑):
Raw PCM 16-bit Audio Data (in Bytes) Initial messageapplication/json
requestIdstringrequiredUnique identifier for the request
languagestringrequiredLanguage of the speech, or "auto" to detect it
sampleRatenumber or nulloptionalSample Rate of the speech
- Default:
16000
projectIdstring or nulloptionalAn optional ID representing the project.
asrModelNamestringoptionalOptional model. English: asr_en_1, asr_en_2 or asr_en_3 (default). Indic: asr_in_1 (default) or asr_in_2.
customWordsarray of stringsoptionalOptional list of custom words to recognise better: names, brands and terms (a custom word can be one or more words, at most 100), e.g. ["Paytm", "नगर निगम:3"]. Write them in English letters or in the language of the audio. Add :boost to change how strongly a word is preferred; without it the model's own default is used. Keep boosts at 3 or below: higher values can make the word appear when it wasn't said. Not available with asr_en_1 or asr_en_2.
Server messages
The server streams transcribed text along with status and progress updates.
Receive Transcription (↓):
{ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "status": true, "transcript": "வணக்கம் இனிய நாள்!", "chunk": 1, "completed": false, "mode": "stt"}When the transcription is complete:
{ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "status": true, "transcript": "", "chunk": 2, "completed": true, "mode": "stt"}Messages
Example response
{ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "status": true, "transcript": "வணக்கம் இனிய நாள்!", "chunk": 1, "completed": false, "mode": "stt"} { "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "status": true, "transcript": "", "chunk": 2, "completed": true, "mode": "stt"}