Browser Voice Cookbook
Connect a browser to an Atoms agent in three steps. Your API key stays on your server; the browser only ever holds a short-lived access token.
How it works
- Your API key never reaches the browser.
- The token is single-use and expires in 30 seconds — mint a fresh one per call.
You need an API key (from app.smallest.ai/dashboard/api-keys) and an agent ID. This cookbook uses the recommended token flow; server-side or trusted clients can instead connect with the API key directly — see the Agent Web SDK reference.
Get an access token (server-side)
Call POST /conversation/register-call from your backend with your API key
(see the Register Call endpoint under Realtime Agent in the API
reference). Set agent_id, and optionally mode and per-call variables.
Response:
variables is optional — it fills {{key}} placeholders in the agent prompt
for this call only.
connect() calls navigator.mediaDevices.getUserMedia(). Browsers only expose
the microphone on secure contexts: HTTPS in production, or
http://localhost / http://127.0.0.1 in development. Serving from a
non-loopback HTTP origin throws a permission error.
Events
Subscribe with agent.on(eventName, handler).
transcript and transcript_delta carry a role of "user" or "assistant"
and a text string. Deltas are cumulative — replace the bubble’s text on each
one, then treat the matching transcript as the final value for that turn.
SDK config
Methods
Common errors
Limits
- Access token: 30-second TTL, single-use.
- Audio: PCM 16-bit, 24 kHz, mono.

