Realtime streaming
One socket streams Arabic speech in and returns text as it's spoken. One request streams speech out from the first chunk. Same key, same base URL, built for the turn-taking a voice agent lives on.
import websockets, json
ws = await websockets.connect(
"wss://api.munsit.com/api/v1/listen?encoding=linear16&sample_rate=16000",
additional_headers={"x-api-key": MUNSIT_API_KEY},
)
async for frame in microphone(): # 20–200 ms of PCM each
await ws.send(frame)
await ws.send(json.dumps({"type": "CloseStream"}))What arrives first, how soon, at what rate, and how many at once.
Every server message is JSON with a type. A turn arrives in this order, and each event carries the session id, so a multiplexed client can attribute it without tracking connections.
The voice-activity detector confirmed speech on a channel. ts is the audio second.
Refresh continuously while the speaker talks, and may revise earlier words. Render them as provisional text.
Text that will not change, with a timestamp and a confidence on every word. speech_final: true means the speaker genuinely finished; that is your trigger to respond.
Fires only on a genuine end of turn, never on a forced split. The cleanest single signal that the caller stopped talking.
Classified from the turn's audio, male or female, with a score. No extra request.
Positive, neutral or negative, from the turn's transcript. On a two-channel call, a live trajectory per party.
The silence the engine waits for before it declares a turn finished is the latency and accuracy trade you control, and you can retune it mid-session.
| endpointing | 800 mssafest boundaries | 500 msbalanced | 300 msfastest |
|---|---|---|---|
| Final arrives | About 1.2 s after speech ends | About 0.9 s | About 0.8 s |
| Best for | Conversational speech | Most mid-sentence hesitations | Short commands |
| The trade | The longest wait | A little of each | Can split a hesitant speaker mid-thought |
Three ways to get speech back as it's generated. Pick by where your text is: all known up front, still arriving from a model, or needing timings for captions.
Ask for 48 kHz. It is the engine's native rate, so the audio skips downsampling and needs no client-side resampling for WebRTC.
One POST with streaming: true. Raw PCM16 chunks arrive as they are generated; start playing on the first.
POST /text-to-speech/{model_id}Open the text socket, send chunks as your model emits them, get base64 PCM back. Flush on the last one.
WSS /websocket/text-to-speechThe same audio as NDJSON lines, with a character-level alignment at the end, for highlighting and captions.
POST /text-to-speech/{model_id}/with-timestampsEverything on the API that returns before it has finished, and the page on docs.munsit.com for each.
Audio in over WebSocket, transcripts back as people speak.
WSS /listenText in, PCM chunks out, from the first byte.
POST /text-to-speech/{model_id}Any language to any other over Server-Sent Events, chunk by chunk.
POST /translation/streamA voice-isolation job's progress as SSE, ending with the clean audio's URL.
GET /denoise/{denoiseId}/progressThe listen socket meters seconds of audio times channels, and closes with a code that says why. Handle these four and it stays up.
Twelve seconds with neither audio nor a KeepAlive closes the session. On hold is a pause.
KeepAlive1011Audio can run at most 60 seconds ahead of real time. A live source never hits it; a file replay does unless you sleep.
It finalises the turn in progress and sends the closing Metadata with the seconds billed. Keep reading until the server closes.
CloseStream10001008 is policy: the key, the session limit or the wallet. The Error before it says which.
If you are building an agent, you may never open the socket yourself. These four do it for you, with Munsit STT as the transcriber and Munsit TTS as the voice.
Use Munsit as the STT node in your LiveKit Agents pipeline.
livekit-plugins-munsitDrop Munsit in as a service class for Pipecat’s real-time pipeline.
pipecat-plugins-munsitSelect Munsit as the transcriber for any VAPI assistant.
transcriber: munsitWire Munsit in as the speech input for Ultravox calls.
stt.provider = munsitThe first partial arrives in under 50 ms. Try it for free.