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

@runwayml/avatars

v0.17.0

Published

Framework-agnostic SDK for real-time AI avatar interactions

Readme

@runwayml/avatars

Framework-agnostic SDK for real-time AI avatar interactions. Works with any JavaScript framework or none at all.

Quick start

import { streamTo } from '@runwayml/avatars';

// Fetch credentials from your server
const res = await fetch('/api/avatar/connect', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ avatarId: 'influencer' }),
});
const credentials = await res.json();

// Start streaming to a video element
const session = await streamTo({ credentials, target: document.getElementById('avatar') });

// Control the session
session.mic.toggle();
session.end();

API

Entry points

  • streamTo({ credentials, target }) -- Start a session and stream video to an element. Handles the consume call, LiveKit connection, and media setup. Returns an AvatarSession.
  • connect({ credentials }) -- Start a session without a video element (headless). Use session.streamTo(element) later to attach video.

AvatarSession

Returned by streamTo and connect. Provides:

  • session.state -- 'idle' | 'connecting' | 'active' | 'ending' | 'ended' | 'error'
  • session.sessionId -- The session identifier
  • session.mic -- { isEnabled, enable(), disable(), toggle() }
  • session.camera -- { isEnabled, enable(), disable(), toggle() }
  • session.screenShare -- { isActive, start(), stop(), toggle() }
  • session.end() -- End the session
  • session.transcript(options?) -- Create a transcript accumulator
  • session.onClientEvent(tool, handler) -- Listen for typed client events
  • session.on(event, handler) / session.off(event, handler) -- Event emitter

Events

import { AvatarEvent } from '@runwayml/avatars';

session.on(AvatarEvent.StateChanged, (state) => {});
session.on(AvatarEvent.Transcript, (entry) => {});
session.on(AvatarEvent.ClientEvent, (event) => {});
session.on(AvatarEvent.Error, (error) => {});
session.on(AvatarEvent.AvatarVideoReady, (track) => {});
session.on(AvatarEvent.AvatarAudioReady, (track) => {});
session.on(AvatarEvent.MediaChanged, () => {});

Error handling

All errors are instances of AvatarError with a typed code and optional cause:

import { AvatarError } from '@runwayml/avatars';

try {
  const session = await streamTo({ credentials, target: el });
} catch (err) {
  if (err instanceof AvatarError) {
    console.log(err.code, err.message, err.cause);
  }
}

session.on(AvatarEvent.Error, (err) => {
  if (err instanceof AvatarError && err.code === 'MEDIA_PERMISSION_DENIED') {
    showPermissionPrompt();
  }
});

| Code | When | |------|------| | CONSUME_FAILED | Session consume HTTP request failed | | CONNECTION_FAILED | LiveKit room connection failed | | MEDIA_PERMISSION_DENIED | Mic or camera permission denied on connect | | MEDIA_DEVICE_ERROR | Mic or camera toggle failed | | SCREEN_SHARE_FAILED | Screen share toggle failed | | PUBLISH_FAILED | Track publish failed | | UNKNOWN | Unexpected error |

Server subpath

import { consumeSession, clientTool, pageActionTools } from '@runwayml/avatars/api';

Server-safe utilities with no browser APIs. Use in Next.js API routes, Express handlers, etc.

React

For React apps, use @runwayml/avatars-react which provides components and hooks on top of this package.