Skip to main content
Open a WebSocket, push audio, receive text as it is recognised.

Authenticating

Never do either of these from a browser you do not control — the key is visible to anyone who opens devtools. Stream from your server, or proxy through it.

Sending audio

Wait for ready, then send binary chunks:
  • 16 kHz, 16-bit PCM, mono
  • 20 ms per chunk — 640 bytes

Messages you receive

object
Authentication succeeded. Start sending audio.
object
A result. transcript holds the text; isFinal says whether it is settled.Interim results arrive fast and may be revised — good for showing live captions. Final results are stable — use those for anything you store or act on.
object
Something went wrong. message explains what.

A complete example

Render finals and interims differently — settled text in your normal colour, the interim tail dimmed. Users read a caption that visibly firms up as accurate; one that silently rewrites itself reads as broken.

Keeping the stream healthy

  • Send steadily. Bursting a buffer is worse than a paced 20 ms cadence.
  • Reconnect on close. Networks drop; keep the transcript you already finalised and resume.
  • Close cleanly when you stop, so the last partial result is flushed.