Browser client
@voicethere/client connects web and Node runtimes to VoiceThere voice sessions over WebRTC. Use local mode against a runner on your machine, or cloud mode with credentials from the session API.
Install
npm install @voicethere/client
Package matrix: npm packages.
Local mode (developer runner)
Point at a signaling WebSocket on localhost while you develop an agent against a local session worker:
import { connectVoiceSession } from "@voicethere/client";
const client = await connectVoiceSession({
mode: "local",
signalingUrl: "ws://127.0.0.1:8080/ws",
sessionId: "local-dev",
});
client.on("peer-joined", (peerId) => console.log("peer", peerId));Cloud mode (hosted VoiceThere)
Create a client API key in the dashboard (vthc_…) — safe to embed in browser apps. Start a session via the session API, then pass credentials to the client:
const res = await fetch("https://app.voicethere.dev/v1/sessions", {
method: "POST",
headers: {
Authorization: "Bearer vthc_…",
"Content-Type": "application/json",
},
body: JSON.stringify({ project_id: "<project-uuid>" }),
});
const credentials = await res.json();
const client = await connectVoiceSession({
mode: "cloud",
credentials: {
sessionId: credentials.session_id,
joinToken: credentials.join_token,
signalingUrl: credentials.signaling_url,
roomId: credentials.room_id,
iceServers: credentials.ice_servers,
},
});Deploy your agent first — see Quickstart.
Browser imports
import {
connectVoiceSession,
connectChatSession,
} from "@voicethere/client/browser";connectChatSession adds DataChannel text chat alongside voice when your project supports both.
Embed widget
import { createVoiceThereWidget } from "@voicethere/client/embed";Floating chat launcher for quick demos without building a full UI.
Session errors
Handle onSessionError for agent crashes, idle timeout, and recoverable restarts. Error codes are documented in Session errors.
Node / headless
import { createNodeWebRtcRuntime } from "@voicethere/client/node";Pass the runtime into connectVoiceSession when WebRTC is not provided by the browser (automated E2E, load tests).