# @millisai/web-sdk

> Millis AI's web sdk to build voice agents on web and browser extension.

Latest version **1.0.16** (published 2025-04-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install @millisai/web-sdk
pnpm add @millisai/web-sdk
yarn add @millisai/web-sdk
bun add @millisai/web-sdk
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.16 |
| Published | 2025-04-22 |
| First published | 2024-05-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 104.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Millis AI |
| Maintainers | thach-millis |
| Keywords | millis, ai, voice, voice agent, voice assistant, voice ai, text to speech |

## Links

- npm: https://www.npmjs.com/package/@millisai/web-sdk
- npm.io page: https://npm.io/package/@millisai/web-sdk

## Dependencies (2)

- [eventemitter3](https://npm.io/package/eventemitter3.md) ^5.0.1
- [@alexanderolsen/libsamplerate-js](https://npm.io/package/@alexanderolsen/libsamplerate-js.md) ^2.1.1

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.0.16 (latest) — 2025-04-22
- 1.0.15 — 2024-11-13
- 1.0.14 — 2024-10-25
- 1.0.13 — 2024-10-03
- 1.0.12 — 2024-09-12
- 1.0.11 — 2024-09-12
- 1.0.10 — 2024-08-09
- 1.0.9 — 2024-08-09
- 1.0.8 — 2024-08-07
- 1.0.7 — 2024-08-06
- 1.0.6 — 2024-08-05
- 1.0.5 — 2024-07-31
- 1.0.4 — 2024-07-26
- 1.0.3 — 2024-07-23
- 1.0.2 — 2024-05-23
- … 2 more at https://npm.io/package/@millisai/web-sdk/versions

## README

# Millis AI Web SDK

Welcome to the Millis AI Web SDK! This SDK enables you to integrate Millis AI's voice agent capabilities directly into your web applications and browser extensions. 

## Installation

Install the SDK with npm:

```
npm install @millisai/web-sdk
```

## Usage

Here’s how to quickly set up a voice agent in your web application:

### 1. Import the SDK:

```js
import Millis from '@millisai/web-sdk';
```

### 2. Initialize the Client:

```js
const msClient = Millis.createClient({publicKey: 'your_public_key'});
```

Obtain your public key from your [Millis AI Playground](https://app.millis.ai/settings/keys)

### 3. Start a Conversation:

#### Using a Predefined Agent

First, create a voice agent from the [Playground](https://app.millis.ai/agents). Then, start a conversation with your agent using the following code:

```js
msClient.start(<agent-id>);
```

Replace 'agent-id' with the ID of your agent obtained from the Playground.

#### Dynamically Creating a Temporary Voice Agent

You can also dynamically create a temporary voice agent with custom configurations using the code below:

```js
msClient.start({
  prompt: "You're a helpful assistant.", // Example prompt
  voice: {
    provider: "elevenlabs", // Voice provider
    name: "voice-id" // Replace 'voice-id' with the ID of the desired voice
  },
  tools: ["list of function calls"] // Replace with actual function calls you need
});
```

### 4. Stop a Conversation:

```js
msClient.stop();
```

### 5. Setup event listener:

```js
    msClient.on("onopen", () => {
      // When the client connected to the server
    });

    msClient.on("onready", () => {
      // When the conversation is ready 
    });

    msClient.on("onaudio", (audio: Uint8Array) => {
      // Incoming audio chunk
    });

    msClient.on("analyzer", (analyzer: AnalyserNode) => {
      // AnalyserNode that you can use for audio animation
    });

    msClient.on("onclose", (event) => {
      // When the connection is closed
    });

    msClient.on("onerror", (error) => {
      // An error occurred
    });
```

## Support

If you encounter any issues or have questions, please reach out to us directly at thach@millis.ai.

---
_Source: https://npm.io/package/@millisai/web-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
