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

corpus-sdk

v0.2.0

Published

Production-grade JavaScript/TypeScript client for the Corpus API. Init with an API key, then use namespaced methods that map to every backend endpoint.

Readme

Corpus SDK

Production-grade JavaScript/TypeScript client for the Corpus API. Init with an API key, then use namespaced methods that map to every backend endpoint.

Install

npm install corpus-sdk

Quick start

import Corpus from "corpus-sdk";

const corpus = new Corpus({
  apiKey: process.env.CORPUS_API_KEY,
  baseUrl: "https://your-api.example.com", // optional; default http://localhost:3001
});

// Health (no API key required)
await corpus.health.check();

// User — get API key by wallet (no auth)
const { apiKey } = await corpus.user.create({ walletAddress: "0x..." });

// When treasury is configured: user deposits to StorageTreasury, then call prepare to see cost per upload and per month
const prep = await corpus.datasets.prepare(); // { debitPerUploadWei, debitPerMonthWei, description } — storage is per-month, not permanent
// Ensure treasury balance covers at least prep.debitPerMonthWei to retain access, then upload

// Datasets
const { cid } = await corpus.datasets.upload(file, { name: "my-dataset", encrypt: true });
const bytes = await corpus.datasets.get(cid);
const list = await corpus.datasets.list();

// Named datasets: versions, set default, download by name
await corpus.datasets.addVersionByName("my-dataset", file);
const { versions } = await corpus.datasets.listVersionsByName("my-dataset");
await corpus.datasets.setDefault("my-dataset", versions[0].cid);
const defaultFile = await corpus.datasets.getByName("my-dataset");

// Models
const run = await corpus.models.register({
  datasetCID: "...",
  modelArtifactCID: "...",
  trainingConfigHash: "...",
  trainingCodeHash: "...",
});
const runs = await corpus.models.list({ datasetCID: "..." });

// Treasury
const { balance } = await corpus.treasury.getBalance();
const { datasets } = await corpus.treasury.getDatasets();

API surface

| Namespace | Methods | |------------|---------| | health | check() | | user | create({ walletAddress }) | | datasets | prepare() — cost debited per upload (call before upload when using treasury), upload(file, options?), createVersion(file, previousCID, options?), list(), get(cid, { metadata? }), getMetadata(cid), getByName(name, versionCid?), listVersionsByName(name), addVersionByName(name, file, options?), setDefault(name, cid), getRaw(cid), deleteByCid(cid), deleteByName(name) | | models | register(input), list({ datasetCID? }), get(provenanceHash) | | treasury | getBalance(), getDatasets() |

Environment

  • CORPUS_API_URL — Base URL when not passed in config (e.g. https://api.example.com).
  • apiKey — From POST /user/create; required for dataset, model, and treasury calls.

Errors

Failed API calls throw CorpusApiError with status and message:

import Corpus, { CorpusApiError } from "corpus-sdk";
try {
  await corpus.datasets.get("bad-cid");
} catch (e) {
  if (e instanceof CorpusApiError) {
    console.log(e.status, e.message);
  }
}

Types

All request/response types are exported (e.g. DatasetItem, ModelRun, RegisterModelRunInput, UploadOptions).