@spekoai/client is the browser-side companion to @spekoai/sdk. It connects a browser tab to a Speko voice session over LiveKit WebRTC: capture the user’s microphone, subscribe to the agent’s audio track, and exchange structured events (transcripts, contextual updates, overrides) over LiveKit’s data channel.
Your server (using @spekoai/sdk or the raw HTTP API) mints a session token. The browser takes that token and joins the room. Audio flows browser ↔ LiveKit ↔ agent worker — your server is not in the audio path.
Install
livekit-client. The package re-exports no LiveKit types on its public surface, so you only need livekit-client transitively.
Quick start
1. Server mints a session
2. Browser joins the room
What the SDK owns
- Connecting to LiveKit with the supplied token.
- Acquiring the microphone with sensible constraints (echo cancellation, noise suppression, auto gain — all togglable via
audioConstraints). - Subscribing to remote audio tracks and attaching them to hidden
<audio>elements. - Parsing inbound data-channel packets (transcripts, agent messages) and invoking your callbacks.
- Sending outbound packets — overrides, user messages, contextual updates.
- Mic mute, speaker volume, output device selection.
- Tearing everything down on disconnect, including releasing the OS microphone capture.
What it doesn’t do
- Mint tokens. Session minting is a server-side concern — it has to run where your API key lives. v1 ships no
agentIdpublic flow. - Retries. A failed
connect()throws aSpekoClientError. Retry logic belongs in your app’s UX. - Tool calls, guardrail hooks, MCP, VAD score streaming. Deferred — see the package’s
ROADMAP.md.
Reference
- VoiceConversation — the primary API surface.
- Callbacks & events — every hook the SDK exposes.
- Data channel protocol — wire format for inbound / outbound packets.
- Errors —
SpekoClientErrorand its codes.