API Reference

Speech To Text · WebSocket · Streaming

WSSwss://stream.shabd.tech/v1/streaming-speech-to-text

Connection headers

  • x-api-keystringrequired

    API key for authentication.

Message flow

  • Outgoing Message (↑): The client sends metadata first then continuously sends audio data in bytes.
  • Incoming Message (↓): The server responds json with requestId, status, transcript, chunk, completed, mode, stage.

Send Metadata (↑):

{  "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02",  "language": "tamil",  "sampleRate": 16000}

Send Audio Data (↑):

  Raw PCM 16-bit Audio Data (in Bytes) 

Initial messageapplication/json

  • requestIdstringrequired

    Unique identifier for the request

  • languagestringrequired

    Language of the speech

  • sampleRatenumber or nulloptional

    Sample Rate of the speech

    Default:
    8000
  • sendPartialbooleanoptional

    Whether to send partial transcripts or not

    Default:
    true

Server messages

  • 101The server streams transcribed text along with status and progress updates.

    Receive Transcription (↓):

    {  "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02",  "status": true,  "transcript": "வணக்கம்",  "chunk": 1,  "stage": "partial",  "completed": false,  "mode": "stt"}
    {  "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02",  "status": true,  "transcript": "வணக்கம் இனிய",  "chunk": 1,  "stage": "partial",  "completed": false,  "mode": "stt"}
    {  "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02",  "status": true,  "transcript": "வணக்கம் இனிய நாள்!",  "chunk": 1,  "stage": "final",  "completed": false,  "mode": "stt"}

    When the transcription is complete:

    {  "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02",  "status": true,  "transcript": "",  "chunk": 2,  "stage": "final",  "completed": true,  "mode": "stt"}

    Messages

    Message TypeExampleDescription
    Send (↑){ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "language": "tamil", "sampleRate": 16000 }The client sends parameters for getting transcription from Audio.
    Send (↑)Raw PCM 16-bit Audio Data (in Bytes)The client sends audio data after sending metadata.
    Receive (↓){ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "status": true, "transcript": "வணக்கம்", "chunk": 1, "stage": "partial", "completed": false, "mode": "stt" }The server returns intermediate transcription updates.
    Receive (↓){ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "status": true, "transcript": "வணக்கம் இனிய", "chunk": 1, "stage": "partial", "completed": false, "mode": "stt" }Continued partial result with updated transcription.
    Receive (↓){ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "status": true, "transcript": "வணக்கம் இனிய நாள்!", "chunk": 1, "stage": "final", "completed": false, "mode": "stt" }Final transcription for the current audio segment.
    Receive (↓){ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "status": true, "transcript": "", "chunk": 2, "stage": "final", "completed": true, "mode": "stt" }Indicates completion of transcription for the entire stream.

    Example response

    {  "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02",  "status": true,  "transcript": "வணக்கம்",  "chunk": 1,  "stage": "partial",  "completed": false,  "mode": "stt"} {  "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02",  "status": true,  "transcript": "வணக்கம் இனிய",  "chunk": 1,  "stage": "partial",  "completed": false,  "mode": "stt"} {  "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02",  "status": true,  "transcript": "வணக்கம் இனிய நாள்!",  "chunk": 1,  "stage": "final",  "completed": false,  "mode": "stt"} {  "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02",  "status": true,  "transcript": "",  "chunk": 2,  "stage": "final",  "completed": true,  "mode": "stt"}