Streaming speech to text
Tapra-Scribe-Realtime / tapra-scribe-v1-realtime
Tapra-Scribe-Realtime is the streaming twin of Tapra-Scribe: same code-switching behaviour, different delivery. The browser or your server opens one socket, ships 16 kHz PCM frames, and receives partial events as words are recognized, then a final transcript with the exact usage charge when you stop.
Make a request
const socket = new WebSocket(
'wss://api.tapra.tn/v1/realtime/stream?language=ar-AR',
['tapra-realtime', 'tapra-auth.' + apiKey]
);
socket.onmessage = (event) => {
const message = JSON.parse(event.data);
if (message.type === 'partial') render(message.text);
if (message.type === 'utterance') lockTurn(message.turn_text);
if (message.type === 'final') console.log(message.text, message.usage);
};
// Push mono 16-bit PCM frames, then close the session cleanly.
socket.onopen = () => recorder.onFrame((frame) => socket.send(frame));
stopButton.onclick = () => socket.send(JSON.stringify({ type: 'stop' }));Inputs and parameters
- Model id
- tapra-scribe-v1-realtime
- Endpoint
- WSS /v1/realtime/stream?language=ar-AR
- Client to server
- Binary mono PCM frames, pcm_s16le, 16 kHz
- Server to client
- ready, partial, utterance, revision, final, pong, error events
- Custom protocols
- tapra-realtime, tapra-auth.<API_KEY>
- VAD / endpointing
- On by default; trailing silence ~800 ms emits utterance
- Idle auto-stop
- On by default; ~2 min of silence sends final and closes the socket
- Keep-alive
- {"type":"ping"} health check → pong; audio frames (zeros while muted) hold the socket open
- Close
- {"type":"stop"} or idle auto-stop returns the final transcript and usage
- Billing
- Audio milliseconds streamed at 0.200 TND / min
Recorded examples
The 26-second code-switched voice note, streamed at real-time pace in 100 ms PCM frames. Every partial below is the event the server sent, at the moment it sent it.
Client sends · pcm_s16le 16 kHz
Server partials
نخمم نعمل une combinaison ما بين les deux modèles tomes canagent اللي هو capable يجاوب عل les clients كيما مثلا في الكنفيرما متاع les ordres والا تعمل marketing لهنا le modèle لازمو يكون قادر يعمل switch between languages ويجاوب زادا بنفس ال façon
Unedited stream. It mishears the same product name as the batch model ("tomes canagent"), and gets façon right where the batch transcript did not.
Capabilities
Silence VAD and turn endpointing
Live sessions mask silence before the decoder and emit an utterance event after about 800 ms of trailing pause. About two minutes of continuous silence auto-stops the session so idle microphones stop holding an ASR slot. Pass idle_stop=0 to keep listening.
No GPU cold start
Inference runs on commodity CPU instances. The first frame is served immediately: there is no warm-up window and no capacity you rent while idle.
Auth without leaking keys
Browser clients pass the WebSocket subprotocols tapra-realtime and tapra-auth.<API_KEY>. Server clients use Authorization: Bearer during the upgrade. Keys never belong in a URL.
Explicit session lifecycle
A ready event opens the session, partial events stream, and {"type":"stop"} closes it with the final transcript and charge. {"type":"ping"} checks connection health (the server answers pong) but does not keep an idle socket open: a socket that receives no audio frame for 45 seconds is closed (idle_timeout), so keep streaming frames even while muted, zeros of at least 20 ms each. About two minutes of continuous silence also ends the session unless you pass idle_stop=0, and every socket ends after about four hours.
Billing
0.200 TND / min. Usage draws from the same prepaid TND balance as the studios. See pricing and all variants.
Common questions
How do I authenticate from a browser?
Send the subprotocols tapra-realtime and tapra-auth.<API_KEY> when opening the socket. Never put a key in the query string. It would land in server logs and referrer headers.
What audio format does the socket expect?
Binary mono PCM frames encoded as pcm_s16le at 16 kHz. That is what the Tapra microphone capture already produces, so there is no resampling step.
What happens if the connection goes idle?
After a pause of about 800 ms the server emits utterance and keeps listening. About two minutes of continuous silence auto-stops the session (final with reason idle_stop) so it stops consuming a slot; pass idle_stop=0 to disable that. Silence means silent audio: keep sending frames (zeros while muted, at least 20 ms each), because a socket that receives no audio frame for 45 seconds is closed (idle_timeout), and pings do not prevent that. A {"type":"ping"} simply checks health; the server answers pong. When you are done, send {"type":"stop"} for the final transcript and usage charge.