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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@tangentad/sdk

v0.3.1

Published

Official SDK for TangentAd - Turn AI Conversations Into Revenue

Downloads

608

Readme

TangentAd SDK

JavaScript/TypeScript SDK for integrating streaming AI avatars into your applications. Turn AI conversations into revenue.

Installation

npm install @tangentad/sdk

Quick Start


import { TangentSDK, AvatarSessionManager, AVATAR_PROVIDERS } from '@tangentad/sdk';

const sdk = new TangentSDK({
  apiKey: "your-api-key",
});

// Get avatars
const avatars = await sdk.getAvatars();

// Create session
const sessionManager = await sdk.createSession({
  avatarId: avatars[0].id,
  userId: "user-123",
});

// Connect (video for Hedra, audio-only for RPM)
const videoEl = document.getElementById("video");
const audioEl = document.getElementById("audio");

if (avatars[0].provider === AVATAR_PROVIDERS.HEDRA) {
  await sessionManager.connect(videoEl, audioEl);
} else {
  await sessionManager.connect(undefined, audioEl);
}

// Listen for responses
sessionManager.on("avatar.response", (event) => {
  console.log("Avatar said:", event.data.text);
});

// Send message
await sessionManager.sendMessage("Hello!");

Provider Types

  • Hedra: Video + audio avatars
  • RPM: Audio-only avatars

Creating Avatars

You can create custom avatars with voice and image files:

// For Hedra avatars (requires image + audio)
const imageFile = document.getElementById("imageInput").files[0];
const audioFiles = Array.from(document.getElementById("audioInput").files);

const hedraAvatar = await sdk.createAvatar({
  name: "My Hedra Avatar",
  description: "Custom avatar with video",
  provider: "hedra",
  image: imageFile, // Required for Hedra
  audioFiles: audioFiles, // Required for voice creation
  systemPrompt: "You are a helpful assistant.",
});

// For RPM avatars (audio files only)
const rpmAvatar = await sdk.createAvatar({
  name: "My RPM Avatar",
  description: "Custom voice-only avatar",
  provider: "rpm",
  audioFiles: audioFiles, // Required for voice creation
  systemPrompt: "You are a knowledgeable expert.",
});

console.log("Avatar created with voice ID:", avatar.voiceId);

File Requirements

  • Audio files: Required for ALL avatars (voice creation via ElevenLabs)
    • Supported formats: MP3, WAV, M4A, AAC, OGG, FLAC
    • Up to 5 files, 25MB total limit
  • Image file: Required only for Hedra avatars
    • Supported formats: JPEG, PNG, GIF, WebP
    • Used for avatar appearance

Events

  • session.started - Session connected
  • session.ended - Session disconnected
  • avatar.response - Text response from avatar
  • avatar.video - Video track available (Hedra only)
  • avatar.audio - Audio track available

Manual Session Creation

If using your own API routes:

// Create via your API
const sessionData = await fetch("/api/sessions", {
  method: "POST",
  body: JSON.stringify({ avatarId, userId }),
}).then((r) => r.json());

// Use session data directly
const sessionManager = new AvatarSessionManager(sessionData);

API Reference

SDK Methods

  • getAvatars()Avatar[]
  • getAvatar(id)Avatar
  • createSession(request)AvatarSessionManager
  • endSession(sessionId)void

Session Manager

  • connect(videoEl?, audioEl?) → Connect to LiveKit
  • sendMessage(text) → Send message to avatar
  • disconnect() → End session
  • on(event, handler) → Listen for events

Types

interface Avatar {
  id: string;
  slug: string;
  name: string;
  provider: "rpm" | "hedra";
  // ... other fields
}

License

MIT License

Support