API Reference
Speech To Text Translate · WebSocket
WSS
wss://stream.shabd.tech/v1/speech-to-text-translateConnection 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, translation, chunk, completed, mode.
Send Metadata (↑):
{ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "sourceLanguage": "hindi", "targetLanguage": "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
sourceLanguagestringrequiredSource language of the speech
targetLanguagestringrequiredTarget Language of the text
sampleRatenumber or nulloptionalSample Rate of the speech
- Default:
16000
projectIdstring or nulloptionalAn optional ID representing the project.
Server messages
The server streams transcribed and translated text.
Receive Transcription and Translation (↓):
{ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "status": true, "transcript": "नमस्ते, आपका दिन शुभ हो!", "chunk": 1, "completed": false, "mode": "stt"}{ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "status": true, "translation": "வணக்கம் இனிய நாள்!", "chunk": 1, "completed": false, "mode": "ttt"}When the transcription is complete:
{ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "status": true, "transcript": "", "chunk": 2, "completed": true, "mode": "stt"}When the translation is complete:
{ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "status": true, "translation": "", "chunk": 2, "completed": true, "mode": "ttt"}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, "translation": "வணக்கம் இனிய நாள்!", "chunk": 1, "completed": false, "mode": "ttt"} { "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "status": true, "transcript": "", "chunk": 2, "completed": true, "mode": "stt"} { "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "status": true, "translation": "", "chunk": 2, "completed": true, "mode": "ttt"}