Browse documentation

Quickstart

Everything a working stream needs: one HTTP request for a node and a token, one WebSocket, raw PCM going up and JSON coming back.

Start with 3 seconds of silence. No microphone, audio file or SDK required. Choose one language below; each example makes its own connect request.

1 — Set your API key

2 — Run one example

JavaScript · Node.js 22+

Python · Python 3.10+

3 — Check the output

You should see session.ready, usage.update, session.ended and a close code of 1000. Silence normally produces no transcript. With speech, read transcript.final. If you receive session.error, check its code and message; retryable allows a new connect, never resuming this stream.

The returned url already includes the session path. Configure only in connect; omitted store means false. Send only pcm_s16le, 16 kHz, mono, after session.ready. The server can discard audio over its realtime budget; see discardedSeconds in usage.update. A disconnect ends the stream.

Optional: inspect connect with curl

4 — Complete runnable clients

For real WAV audio, use a complete client below. It converts 16-bit PCM WAV to 16 kHz mono, paces frames and limits the local queue to 2 seconds, dropping the oldest unsent audio when full. Source code is collapsed by default. Expand to copy or download, then save as stream.mjs or stream.py.

Save as stream.mjs (Node.js 22+, no npm dependencies) or stream.py (Python 3.10+, websocket-client). Set LECSYNC_API_KEY; optional LECSYNC_API_ORIGIN defaults to https://api.lecsync.com. An optional WAV path sends that file; omit it to send 3 seconds of silence. The source WAV is read into memory; only the pending send queue is bounded. Run one client, not both:

JavaScript · stream.mjs — View full source · copy / download
Python · stream.py — View full source · copy / download