Repository navigation
v0.6.0
Realtime streaming
client.realtime.connect() now speaks the public streaming.nexara.ru WebSocket protocol (v1): GET /v1/transcribe with the session parameters in the query string and the API key as a Bearer token; raw PCM in, final words out.
async with client.realtime.connect(sample_rate=16000, diarize=True) as session:
async for event in session.stream(microphone()):
print(event.speaker, event.words[0].start, event.text)
print(session.ended.text)RealtimeSession: async iteration ofRealtimeTranscriptevents,stream(),finish()(sendsinput_audio.end, resolves onsession.ended),keepalive(),close(). Sending and receiving are concurrent.- Parameters:
encoding(pcm_s16ledefault,pcm_f32le,pcm_mulaw,pcm_alaw),sample_rate(8–48 kHz),channels,multichannel,diarize,delay_ms,client_id; invalid values raiseNexaraValidationErrorbefore connecting. - Every word is final, with integer-millisecond timestamps on the audio clock and, with
diarize=True, a speaker label (0–3 orNone). - New
RealtimeError(code, reason, message)for server-side closes (session_full,idle_timeout,audio_backlog,service_restart, …); wallet exhaustion mid-session raisesInsufficientBalanceError; a rejected handshake raises the usual status-mapped errors. - Requires the
realtimeextra:pip install nexara[realtime].
Breaking: the previous placeholder realtime API (RealtimeEvent, RealtimeToken, is_final) is gone — it never matched a real server.