{
"transcribeConfig": {
"modelId": "inworld/inworld-stt-1",
"audioEncoding": "LINEAR16",
"sampleRateHertz": 16000,
"language": "en"
}
}{
"audioChunk": {
"content": "<BASE64_AUDIO>"
}
}{
"endTurn": {}
}{
"closeStream": {}
}{
"result": {
"transcription": {
"transcript": "Open the door and let me in, please.",
"isFinal": true,
"wordTimestamps": [],
"voiceProfile": null,
"silenceDurationMs": 0
}
}
}{
"result": {
"usage": {
"transcribedAudioMs": 2400,
"modelId": "inworld/inworld-stt-1"
}
}
}{
"result": {
"speechStarted": {
"startTimeMs": 0,
"confidence": 0
}
}
}{
"result": {
"speechStopped": {
"silenceDurationMs": 750
}
}
}Transcribe audio (WebSocket)
Bidirectional streaming API for real-time speech-to-text transcription over WebSocket.
This method listens for streaming audio input and returns recognized text chunks one by one as soon as they are ready. Audio chunks are expected to be a part of a single voice input. Suitable for streaming live conversations, microphone input, or other streaming audio sources.
To use the API:
- Send a
transcribeConfigmessage first to configure the session (model, language, audio encoding, etc.). - Stream
audioChunkmessages containing raw audio bytes. - Receive
transcriptionresults as they become available, including both interim (partial) and final results. - Listen for
speechStartedandspeechStoppedevents to detect voice activity changes. - Optionally send
endTurnto signal end of a speaker’s turn. - Send
closeStreamwhen done.
{
"transcribeConfig": {
"modelId": "inworld/inworld-stt-1",
"audioEncoding": "LINEAR16",
"sampleRateHertz": 16000,
"language": "en"
}
}{
"audioChunk": {
"content": "<BASE64_AUDIO>"
}
}{
"endTurn": {}
}{
"closeStream": {}
}{
"result": {
"transcription": {
"transcript": "Open the door and let me in, please.",
"isFinal": true,
"wordTimestamps": [],
"voiceProfile": null,
"silenceDurationMs": 0
}
}
}{
"result": {
"usage": {
"transcribedAudioMs": 2400,
"modelId": "inworld/inworld-stt-1"
}
}
}{
"result": {
"speechStarted": {
"startTimeMs": 0,
"confidence": 0
}
}
}{
"result": {
"speechStopped": {
"silenceDurationMs": 750
}
}
}Your authentication credentials. For Basic authentication, please populate Basic $INWORLD_API_KEY. You can create a key in one command with the Inworld CLI: inworld workspace add-key.
Configure the transcription session. Must be the first message sent. On the wire, wrap the fields below in a top-level transcribeConfig key (see the example) — an unwrapped config is rejected and the socket closes without an error frame.
Send a chunk of audio data for transcription. Must be sent after the initial transcribe config message. On the wire, wrap the fields below in a top-level audioChunk key (see the example).
Signal the end of a speaker's turn. Send as {"endTurn": {}}. Some providers do not support manual turn-taking; for those providers, sending this message will have no effect. See the Turn Detection guide for automatic vs. manual turn control.
Signal that the client is done sending audio data. Send as {"closeStream": {}}. Required for HTTP/WebSocket clients since there is no equivalent to gRPC stream close.
Transcription result streamed back as audio is processed. May be an interim (partial) result or a final result depending on the isFinal field. Arrives wrapped under a top-level result key as result.transcription (see the example).
Usage metrics for billing and monitoring purposes. Sent when the stream ends, wrapped under a top-level result key as result.usage.
Signal to indicate the start of a speaker's speech. Sent when voice activity is detected in the audio stream, wrapped under a top-level result key as result.speechStarted.
Signal raised when STT detects silence after speech has stopped. Useful for tracking pauses and implementing custom turn-taking logic. Arrives wrapped under a top-level result key as result.speechStopped.
Was this page helpful?