Messages
After session.ready, stream raw PCM as binary frames. Control messages are JSON text frames: finalize, stop, ping.
Client → Server
| Message | Payload | Description |
|---|---|---|
session.finalize | — | Force the in-flight segment to close and emit its final. |
session.stop | — | End the stream cleanly. |
session.ping | — | Keepalive. Answered with session.pong. |
Audio frames are raw pcm_s16le, 16 kHz, mono, up to 64 KB per frame. There is no frame header, no sequence number and no offset bookkeeping — send bytes in order and the server does the rest.
Server → Client
All server messages are JSON text frames with a type. sessionId is only on session.ready, not on every transcript or translation. segmentId is an opaque id; do not parse its prefix.
| Message | Payload | Description |
|---|---|---|
session.ready | sessionId, audio, limits, store, region | The stream is live. Start sending audio. |
transcript.partial | text, language?, pending?, tail?, paragraphs?, tailTranslation? | Preview snapshot. In sentence mode, paragraphs contains {speaker?, pieces: [{text, confirmed}], translation?} and tail/tailTranslation describe the unfinished sentence. pending is the flat fallback. Replace the snapshot; render aligned paragraph translations instead of aggregate translation.partial. Only transcript.final is permanent. |
transcript.final | segmentId, text, startMs?, endMs?, speaker?, language? | A settled segment on the effective-audio clock. |
translation.partial | text, sourceText | Unstable translation preview. |
translation.final | segmentId, text, sourceText, sourceLanguage, targetLanguage, enhanced? | A settled translation. With aiEnhance on, the same segmentId is emitted a second time with enhanced: true. |
digest.update | sections[] | Rolling summary: { title, points[], confirmed }. Each push replaces the previous state. |
usage.update | effectiveSamples, discardedSamples, effectiveSeconds, discardedSeconds, priceCentsPerHour, accruedCents, collectedCents, uncollectedCents, balanceCents | Every 15 seconds and at end. |
session.error | code, message, retryable, scope | A recoverable or fatal error. |
session.ended | reason, enhancement, storage, billing | The server closed the stream. Storage and enhancement each have their own status. |
session.pong | — | Reply to session.ping. |