nur-v1.
There are two ways to connect, and both speak the OpenAI Realtime protocol:
Events, session settings and replies are the same on both.
WebRTC in the browser
The browser captures the microphone and plays Nur through a normal audio element. Your server only relays two requests, so the key stays private.server.js
browser.js
client.realtime.calls.create(sdp=..., session=...) posts the same
request.
WebSocket from a server
Configure the session
Sendsession.update at any time. Later updates merge with earlier ones, so a
frame that changes only the voice keeps your instructions.
Put today’s date and anything else the assistant should know in
instructions.
Audio on a WebSocket
WebRTC handles audio formats for you. On a WebSocket, audio is 16-bit mono PCM, base64 encoded:- Input defaults to 16 kHz. Send about 20 ms per message (640 bytes) at the pace it was recorded. Turn detection listens to the timing, so sending a file all at once makes for poor turn-taking, not a faster reply.
- Output defaults to 16 kHz. For 24 kHz, set
"output": {"format": {"type": "audio/pcm", "rate": 24000}}. - For telephony,
{"type": "audio/pcmu"}and{"type": "audio/pcma"}select G.711 at 8 kHz.
format out. Don’t write "rate": 16000, which the
schema rejects.
response.create:
Interruptions
People talk over each other, and Nur is built for it. When someone starts speaking over a reply, the server stops generating and tells you withinput_audio_buffer.speech_started. On WebRTC the gateway also stops the
audio it already sent. On a WebSocket, stop your own playback when that event
arrives, or Nur will seem to keep talking.
Events you will use
The server also sends a few
eesi.* events. eesi.session carries the
session_id and resume_token for reconnecting, eesi.recording_disclosure
has wording to show people when sessions are recorded, and
eesi.synthetic_audio declares the audio machine-generated. You can ignore
them if you don’t need them.
Reconnecting
If a connection drops, reconnect within 15 minutes with?resume=<session_id>&resume_token=<resume_token> from the eesi.session
event, and the conversation continues where it left off. The new
eesi.session event then includes resumed; if it doesn’t, you got a fresh
session.
Languages
Nur understands and speaks more than a hundred languages and follows the person when they switch. To keep it in one language, say so ininstructions. For
interpreting rather than conversing, use Live translation.
Limits
- A session can last up to three hours. A WebSocket with no client traffic for
five minutes closes; send
{"type": "eesi.keepalive"}while a person is reading or thinking. - Usage is billed per minute of session time.
- If your organization runs out of credits during a call, the session ends with a message saying why before it closes.