Skip to main content
This guide contains complete examples demonstrating real-time audio transcription for various use cases in different programming languages.

Prerequisites

Python

Node.js

Python Example

This example shows how to stream audio from a file and receive real-time transcriptions:

Node.js Example

This example demonstrates real-time transcription using the ws library:

Browser JavaScript Example

This example shows how to stream audio from a file input in the browser:

Streaming from Microphone

Here’s an example of streaming live audio from a microphone in the browser:

Handling Responses

The WebSocket API sends JSON messages with the following structure:

Key Response Fields

  • is_final: false indicates a partial/interim transcript; true indicates a final transcript
  • is_last: true when the session is complete
  • transcript: Current segment text
  • full_transcript: Accumulated text from the entire session
  • word_timestamps: Only included when word_timestamps=true in query params

Browser

No additional dependencies required - uses native WebSocket API.

Error Handling

Always implement proper error handling for production use: