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

@varie-ai/avatar-sdk

v0.1.4

Published

SDK for integrating Varie AI avatars into your applications

Downloads

18

Readme

@varie-ai/avatar-sdk

SDK for integrating Varie AI avatars into your applications.

Features

  • Discover - Browse available AI characters with filtering
  • Download - Fetch and unpack Spine model bundles
  • Caching - IndexedDB caching for models (browser) with in-memory fallback
  • Rate Limiting - Client-side throttling to prevent API abuse
  • TypeScript - Full type definitions included

Installation

npm install @varie-ai/avatar-sdk

Quick Start

import { VarieAvatarSDK } from '@varie-ai/avatar-sdk';

const sdk = new VarieAvatarSDK();

// Discover available characters
const { characters } = await sdk.discover({
  genre: 'fantasy',
  limit: 10
});

console.log(characters.map(c => c.name));
// ['Soren', 'Luna', 'Kai', ...]

// Get specific character details
const character = await sdk.getCharacter('soren_cb3333dd3e3f');
console.log(character.tagline);
// "A mysterious wanderer with ancient secrets"

// Download and unpack the Spine model
const model = await sdk.downloadModel(character.id, {
  type: 'full',  // 'full' or 'base'
  cache: true,   // Uses IndexedDB
  onProgress: (p) => console.log(`${p.percent}%`)
});

// Use with Spine runtime
const { skeleton, atlas, texture } = model.files;

API Reference

new VarieAvatarSDK(options?)

Create a new SDK instance.

| Option | Type | Default | Description | |--------|------|---------|-------------| | baseUrl | string | https://varie.ai/api | API base URL | | cacheEnabled | boolean | true | Enable IndexedDB caching | | rateLimitPerSecond | number | 5 | Max requests per second | | discoverCacheTTL | number | 3600000 | Cache TTL for discover (1 hour) | | characterCacheTTL | number | 604800000 | Cache TTL for characters (1 week) |

sdk.discover(options?)

List available characters.

| Option | Type | Description | |--------|------|-------------| | limit | number | Max results (1-50, default: 20) | | cursor | string | Pagination cursor | | genre | string | Filter by genre | | language | string | Filter by language |

Returns: Promise<DiscoverResponse>

sdk.getCharacter(id, skipCache?)

Get character details by ID.

Returns: Promise<Character>

sdk.downloadModel(characterId, options?)

Download and unpack a character model.

| Option | Type | Default | Description | |--------|------|---------|-------------| | type | 'full' \| 'base' | 'full' | Model quality | | cache | boolean | true | Cache the model | | onProgress | function | - | Progress callback |

Returns: Promise<UnpackedModel>

sdk.clearCache()

Clear all cached data.

sdk.getCacheStats()

Get cache statistics.

sdk.getRateLimitStatus()

Get current rate limiter status.

Types

Character

interface Character {
  id: string;
  name: string;
  tagline: string;
  quotes: string[];
  genre: string;
  pronouns: string;
  personalityTags: string[];
  avatarUrl: string;
  story: string;
  publicModel: {
    status: 'full_ready' | 'base_ready' | 'failed' | null;
    baseUrl?: string;
    fullUrl?: string;
  };
}

UnpackedModel

interface UnpackedModel {
  characterId: string;
  type: 'full' | 'base';
  files: {
    skeleton: object;     // Parsed JSON
    atlas: string;        // Atlas text
    texture: Blob;        // PNG texture
    raw: Map<string, ArrayBuffer>;
  };
  size: number;
  cachedAt?: number;
}

SDKError

class SDKError extends Error {
  code: SDKErrorCode;
  cause?: unknown;
}

enum SDKErrorCode {
  NETWORK_ERROR,
  API_ERROR,
  NOT_FOUND,
  MODEL_NOT_AVAILABLE,
  INVALID_BUNDLE,
  CACHE_ERROR,
  RATE_LIMITED,
}

Using with Spine Runtime

The SDK returns unpacked model files ready for any Spine runtime:

// With spine-webgl
const model = await sdk.downloadModel(characterId);

// Create texture from blob
const textureUrl = URL.createObjectURL(model.files.texture);
const image = new Image();
image.src = textureUrl;
await new Promise(resolve => image.onload = resolve);

// Create atlas and skeleton
const atlas = new spine.TextureAtlas(model.files.atlas);
// ... set up texture on atlas pages

const skeletonJson = new spine.SkeletonJson(new spine.AtlasAttachmentLoader(atlas));
const skeletonData = skeletonJson.readSkeletonData(model.files.skeleton);

// Create skeleton instance
const skeleton = new spine.Skeleton(skeletonData);

Eye Tracking (Gaze)

Varie characters support eye tracking via look_left, look_right, look_up, look_down animations:

// Convert mouse position to -1 to 1 range
const gazeX = ((mouseX - canvasLeft) / canvasWidth) * 2 - 1;
const gazeY = -(((mouseY - canvasTop) / canvasHeight) * 2 - 1);

// Apply horizontal gaze
if (Math.abs(gazeX) > 0.1) {
  const animName = gazeX < 0 ? 'look_left' : 'look_right';
  const track = animationState.setAnimation(TRACK_GAZE, animName, false);
  track.alpha = Math.min(1.0, Math.abs(gazeX));
  track.trackTime = 0.3;
  track.timeScale = 0; // Hold at this frame
}

See examples/browser/spine-render.html for a complete working example with eye tracking, blink, and expressions.

Browser Support

  • Chrome 80+
  • Firefox 78+
  • Safari 14+
  • Edge 80+

Requires fetch, IndexedDB, and TextDecoder APIs.

Node.js Support

Works in Node.js 18+ with in-memory caching (IndexedDB not available).

Local Development

Running Examples

The API has CORS restrictions. For local browser testing, use port 3000:

# Clone and install
git clone https://github.com/varie-ai/avatar-sdk.git
cd avatar-sdk
npm install
npm run build

# Serve examples on port 3000 (required for CORS)
python3 -m http.server 3000

# Open in browser
# http://localhost:3000/examples/browser/           - Basic SDK usage
# http://localhost:3000/examples/browser/spine-render.html - Spine rendering with eye tracking

Examples

| Example | Description | |---------|-------------| | examples/browser/index.html | Basic discover, select, download workflow | | examples/browser/spine-render.html | Full Spine rendering with eye tracking, blink, expressions | | examples/node/index.ts | Node.js CLI example |

License

MIT

Links