End-to-end browser demo for attention labs SAA (Selective Auditory Attention) SDK, streams microphone and webcam to the SAA Server, then forwards detected speech segments to OpenAI Realtime.
Everything runs in the browser. The server tells you when someone is speaking and what they said; this demo routes that speech to the LLM of your choice (OpenAI Realtime is shown).
- A SAA auth token (sign up on the dashboard here)
- An OpenAI API key with Realtime access (optional, omit to run and just see live predictions)
- Node 18+ and a modern browser (Chrome, Edge, Safari, Firefox)
Follow these steps in order:
From a checkout of the saa-sdk monorepo:
git clone https://github.com/attenlabs/saa-sdk.git
cd saa-sdk/examples/web
npm installnpx serveThis prints a local URL, typically http://localhost:3000. Open it in your browser.
In the Setup panel (top-left of the page), paste your SAA token (and optionally your OpenAI key) and click Connect. The browser will prompt for microphone and camera access, allow both.
After a short warmup, the orb starts reacting to your voice.
All optional. The token / key fields stay editable in the UI. URL params just auto-populate them for future runs.
| param | notes |
|---|---|
token |
Pre-fills the SAA auth token field. |
openai_key |
Pre-fills the OpenAI key field. Omit to just watch predictions and VAD. |
Example: /?token=al_live_…&openai_key=sk-…
app.jsconstructs anAttentionClientfrom@attenlabs/saa-js, which acquires the mic + webcam and opens a WebSocket to the SAA server.- The SDK emits typed events,
prediction,vad,state,turnReady,warmupComplete.app.jsrenders into the UI. - On
turnReady,app.jshands the PCM16 audio (and any attached JPEG frames) tollm.js, a small OpenAI Realtime bridge that wraps them intoinput_audio/input_imagecontent parts and plays the response back through WebAudio. - While the LLM is speaking,
app.jscallsclient.mute()+client.markResponding(true)so the server stops emitting predictions until playback ends. - A small guided flow (top-of-screen pill) walks first-time users through talk to the computer → talk to each other → free play.
The LLM bridge is deliberately part of this demo, not the SDK, swap in whichever provider you like.
Try three send thresholds and keep the one that performs best: 0.6, 0.77, 0.88.
Raise it for fewer false triggers, lower it to catch borderline speech. Drag the threshold slider, or call client.setThreshold(v).
This demo accepts the OpenAI API key in the browser (typed into the UI or passed via URL) for simplicity. Never do that in production, always proxy the Realtime connection through a server you control so the key never reaches the client.
Apache-2.0