npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vatel/sdk

v0.1.0

Published

JavaScript SDK for Call Agent Builder WebSocket and REST APIs

Readme

@vatel/sdk

Connect to Vatel voice agents from JavaScript or TypeScript. Send audio, receive agent replies and transcripts, and handle tool calls. Works in Node.js and the browser.

Install

npm install @vatel/sdk

In Node.js you also need a WebSocket implementation (browsers have one built in):

npm install ws

Quick start

1. Get a session token using your API key and agent ID:

import { Client } from "@vatel/sdk";

const client = new Client({
  getToken: () => process.env.VATEL_API_KEY,
});

const { data } = await client.generateSessionToken("your-agent-id");
if (!data?.token) throw new Error("Failed to get token");

2. Connect a session and listen for events:

import { Session } from "@vatel/sdk";

const session = new Session({ token: data.token });

session.on("session_started", () => console.log("Connected"));
session.on("response_text", (msg) => console.log("Agent:", msg.data.text));
session.on("response_audio", (msg) => {
  // msg.data.audio is base64-encoded PCM (24 kHz, mono, 16-bit)
  // Decode and play with your audio stack
});
session.on("input_audio_transcript", (msg) => console.log("You said:", msg.data.transcript));

await session.connect();

3. Send microphone (or other) audio as base64 PCM chunks:

session.sendInputAudio(base64PcmChunk);

Node.js: WebSocket setup

Node doesn’t include a WebSocket API. Install ws and pass a WebSocket factory when creating the session:

import { Session } from "@vatel/sdk";
import WebSocket from "ws";

const session = new Session({
  token: data.token,
  createWebSocket: (url) => new WebSocket(url),
});
await session.connect();

Session options

| Option | Description | |--------|-------------| | token | Required. JWT from client.generateSessionToken(agentId). | | baseUrl | API base URL. Default: https://api.vatel.ai. Use https://… or wss://…; the SDK uses the right protocol. | | createWebSocket | Node only. Function that takes a URL and returns a WebSocket instance. Use with the ws package. |

REST client

The Client uses your organization API key as a Bearer token. Use it to get session tokens and list agents.

import { Client } from "@vatel/sdk";

const client = new Client({
  getToken: () => process.env.VATEL_API_KEY,
});

const { data: tokenData } = await client.generateSessionToken("agent-id");
const { data: agents } = await client.listAgents();

Tool calls

When the agent invokes a tool, handle it and send the result back:

session.on("tool_call", async (msg) => {
  const { toolCallId, toolName, arguments: args } = msg.data;
  const result = await yourToolHandler(toolName, args);
  session.sendToolCallOutput(toolCallId, JSON.stringify(result));
});

TypeScript

The package includes type definitions. No extra @types install; use TypeScript as usual and import types when needed:

import type { ResponseAudioMessage, SessionStartedMessage } from "@vatel/sdk";