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

@viewrium/sdk

v0.1.0

Published

Official JavaScript / TypeScript SDK for the Viewrium API. Create and manage 3D models, api keys, and usage records.

Readme

@viewrium/sdk

Official JavaScript / TypeScript SDK for the Viewrium API. Create and manage 3D models, API keys, and usage records.

Install

npm install @viewrium/sdk
# or
pnpm add @viewrium/sdk
# or
yarn add @viewrium/sdk

Node 18+, Deno, Bun, browsers, and edge runtimes all supported (uses the global fetch).

Quickstart

import Viewrium from "@viewrium/sdk";

const viewrium = new Viewrium(process.env.VIEWRIUM_API_KEY!);

const model = await viewrium.models.create({
  customId: "sku-1",
  images: ["https://example.com/img1.jpg", "https://example.com/img2.jpg"],
  height: 90,
  tags: ["chair", "summer-2026"],
});

console.log(model.id, model.status);

const listing = await viewrium.models.list({ tag: "chair", limit: 20 });
for (const m of listing.data) {
  console.log(m.custom_id, m.status);
}

Configure

const viewrium = new Viewrium("sk_live_...", {
  apiBase: "https://api.viewrium.com",  // default
  timeoutMs: 60_000,                      // default
  maxRetries: 3,                          // retries 429 / 5xx, respects Retry-After
});

If you omit the first argument, the SDK reads process.env.VIEWRIUM_API_KEY. Likewise process.env.VIEWRIUM_API_BASE overrides the default base URL.

Resources

| Resource | Methods | |---|---| | viewrium.models | create, createFromImages, createFromVideo, retrieve, list, modify, delete, listEvents | | viewrium.apiKeys | create, list, delete | | viewrium.usage | retrieve | | viewrium.tags | list |

Uploading files

createFromImages and createFromVideo accept Blob, File, or (in Node) a filesystem path string.

import { readFile } from "node:fs/promises";

// Node: filesystem path (easiest)
const model = await viewrium.models.createFromImages(
  ["./chair-front.jpg", "./chair-side.jpg", "./chair-back.jpg"],
  { customId: "sku-1", height: 90, tags: ["chair"] },
);

// Anywhere: Blob/File (from a browser `<input type=file>` or `fetch` response)
const response = await fetch("https://example.com/chair.mp4");
const blob = await response.blob();
const model2 = await viewrium.models.createFromVideo(blob, {
  customId: "sku-2",
  height: 92,
});

Sizing

Pass height plus optional sizeUnit ("cm" or "in", default "cm"). The server normalizes to cm before storing. Explicit height wins over scraped values; if neither is present, the model renders unscaled.

await viewrium.models.create({
  images: [...],
  height: 35,
  sizeUnit: "in",   // stored as 88.9 cm
});

Errors

import {
  ViewriumError,      // base class
  AuthError,          // 401 or missing key
  NotFoundError,      // 404
  ValidationError,    // 400 / 409 / 422
  RateLimitError,     // 429 (has .retryAfter)
  APIError,           // 5xx / other
} from "@viewrium/sdk";

try {
  await viewrium.models.retrieve("not-a-real-id");
} catch (err) {
  if (err instanceof NotFoundError) {
    // ...
  } else if (err instanceof RateLimitError) {
    console.log("retry after", err.retryAfter, "seconds");
  } else {
    throw err;
  }
}

All ViewriumError subclasses carry .statusCode and .responseBody.

Retries

Requests retry automatically on 429 and 5xx responses up to maxRetries times, using Retry-After when the server provides it and exponential backoff otherwise. Network errors also retry.

TypeScript

Full types ship with the package. All response shapes (Model, ApiKey, UsageSummary, TagSummary, ...) and request params (ModelCreateParams, ModelUpdateParams, ...) are exported.

Custom fetch

For testing or custom transports, pass your own fetch:

const viewrium = new Viewrium("sk_live_...", {
  fetch: async (url, init) => {
    // intercept, log, proxy, etc.
    return globalThis.fetch(url, init);
  },
});

License

Apache 2.0.