Voice SDK
@oshara/voice-sdk embeds the Oshara voice agent into any web app. Add your agent slug (and optionally an API key) and everything initializes exactly like the widget: appearance is fetched, the voice call connects, and agent-triggered forms surface automatically.
The same package ships four ways to create an agent, so you can pick the level of control you need:
| Goal | Import | What you get |
|---|---|---|
| Script tag | widget.js | Drop-in embeddable widget, zero build step |
| Prebuilt UI | @oshara/voice-sdk/ui | mountVoiceUI(client) — the full widget UI, mounted anywhere |
| Custom UI | @oshara/voice-sdk | Headless client — typed events + methods, zero DOM |
| React | @oshara/voice-sdk/react | useVoiceAgent() hook + <VoiceWidget> component |
All four paths sit on top of the same headless core (createVoiceAgent). The prebuilt UI, the React bindings, and the embeddable widget are just thin layers over the events and methods documented in Client API and Events.
How it fits together
┌──────────────────────────────┐
your code ──► │ createVoiceAgent(config) │ ◄─ headless core
│ • fetches appearance │
│ • connects the LiveKit call │
│ • emits typed events │
│ • owns the form model │
└──────────────┬────────────────┘
│ events + methods
┌───────────────────────┼───────────────────────┐
▼ ▼ ▼
mountVoiceUI(client) your custom UI useVoiceAgent(config)
(prebuilt widget) (vanilla / Vue / …) <VoiceWidget /> (React)What you need first
- An Oshara account — sign up at app.oshara.ai .
- An agent slug — the URL-friendly identifier of the AI character you want to embed (e.g.
support-bot). - For browser embeds: the domain you serve from must be on the character’s Allowed Origins list in the dashboard. No API key needed.
- For server / Node usage: a secret API key (
sk_…). See Authentication.
Next steps
- Installation — install the package and its peers.
- Creating an Agent — the detailed, end-to-end guide for every creation method.
- Configuration — every option
createVoiceAgentaccepts. - Client API — methods on the client.
- Events — the full event reference.
Last updated on