Realtime transcription
Send audio as it becomes available and receive partial transcripts while the speaker talks. At the end of each utterance, receive a final transcript. One connection can transcribe multiple utterances.
For a runnable example, follow the STT quickstart. STT connections share an organization concurrency limit.
Connect and configure
Connect from your backend using your API key:
Send your session configuration immediately after connecting:
Wait for session.configured before sending audio. It returns the applied settings and defaults in session, with duration and idle limits in session.limits. The configuration is fixed for this connection.
Session arguments
These fields belong inside session in the initial session.configure:
The API reference lists all accepted language codes, VAD fields, and validation limits.
Send audio
Use 16 kHz, signed 16-bit little-endian PCM, mono, without a WAV header. Encode each chunk as base64 and send it in an input_audio_buffer.append JSON message:
For example, 100 ms of audio is 3,200 bytes before base64 encoding. Each chunk must contain whole two-byte samples, and the complete JSON message must fit within 128 KiB.
Send and receive in Python
This example streams audio and receives transcripts concurrently, supporting multiple utterances on one connection.
Use Python 3.11+, set NARI_API_KEY, and place the quickstart sample hello.pcm beside stt_stream.py.
For live audio, replace pcm_file(...) with an async iterator yielding PCM bytes. In this example, yielding None commits an utterance manually. Use on_event to handle incoming events.
See Transcripts and turn detection for callback and VAD examples, or Errors and troubleshooting for error handling.
Read the results
Partial transcripts may change as more audio arrives, including words returned earlier. After an utterance ends, the server returns a completed transcript that replaces all partial text for that item_id.
A partial result:
The completed result for the same item_id:
To receive word timing, configure "word_timestamps": true. The server first
sends the authoritative transcript.completed, then sends one
transcript.words event with the same item_id:
Alignment is asynchronous. Keep the completed transcript even if the terminal
event is transcript.words.failed, and correlate timestamp events by item_id
rather than assuming events for multiple utterances finish in commit order.
Transcripts and turn detection explains how to update text, finalize utterances, and reuse the connection. For timeouts and reconnecting, use WebSocket failures.
Session limits
These limits apply to all connections. The session.configured event returns the applied duration and idle limits in session.limits.
See automatic utterance finalization and WebSocket errors for details.