@spekoai/client connects a browser tab to a Speko voice session over LiveKit WebRTC. You mint a session on your server (POST /v1/sessions); the browser uses the returned token to join the LiveKit room and exchange audio + structured events with the agent worker.
Install
1. Mint a session on your server
server.ts
SPEKO_API_KEY to the browser. The session token is short-lived and scoped to one room.
2. Join from the browser
VoicePanel.tsx
What you can do mid-conversation
sendContextualUpdate injects context the agent will see on its next turn without speaking it aloud — useful for app-state changes the agent should know about.
Mic / device control
@spekoai/client requests the mic with sensible defaults (echo cancel, noise suppression, AGC). Override per session:
What the SDK does not handle
- Token minting. Always server-side — your API key must not ship to browsers.
- Reconnect / retry. A failed
connect()throwsSpekoClientError. Your UX decides whether to retry. - Tool calls / MCP / VAD streaming. Deferred.
Next
Client API
Full
@spekoai/client reference.Build the agent worker
Worker side of the same architecture.