Skip to Content

Installation

Package

npm install @oshara/voice-sdk livekit-client # or pnpm add @oshara/voice-sdk livekit-client # or yarn add @oshara/voice-sdk livekit-client

livekit-client and @livekit/krisp-noise-filter are runtime dependencies; in most apps your bundler dedupes a single copy. react / react-dom are optional peers — only needed for the /react entry point.

Entry points

The package exposes three importable entry points:

import { createVoiceAgent } from "@oshara/voice-sdk"; // headless core import { mountVoiceUI } from "@oshara/voice-sdk/ui"; // prebuilt widget UI import { useVoiceAgent } from "@oshara/voice-sdk/react"; // React bindings

If you use the prebuilt UI (/ui or <VoiceWidget>), also load the stylesheet once:

import "@oshara/voice-sdk/styles.css";

The prebuilt UI renders inside a shadow DOM, so the stylesheet is scoped and won’t leak into your page. You still import it once so the bundler includes it.

No build step? Use the script tag

If you can’t (or don’t want to) run a bundler, skip npm entirely and drop in the embeddable widget — it’s built on this SDK:

<script src="https://api.oshara.ai/widget.js" data-agent="support-bot" data-api-url="https://api.oshara.ai"> </script>

See Creating an Agent → Script tag.

Node / server-side

The core is safe to import and construct in Node:

  • localStorage access (audio prefs, consent, visitor id) is wrapped in try/catch.
  • navigator.mediaDevices / AudioContext are only touched when you call audio/device methods.
  • The Krisp and DeepFilter noise filters are dynamically imported only when a call attaches them — import "@oshara/voice-sdk" never pulls browser-only Worker/WASM code server-side.

On Node < 18 there is no global fetch; pass one in the config:

import fetch from "node-fetch"; createVoiceAgent({ agentSlug: "support-bot", apiKey: process.env.OSHARA_KEY, fetch });

Microphone capture is browser-only. Server-side use is for session minting, appearance, form submission, and data publishing — not for running an actual call from a headless process.

Last updated on