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

@acegalaxy/model-registry

v0.1.2

Published

Notion-backed AI model registry — define model configs (provider, model, costs, capabilities) in a Notion table, sync to runtime via a single call. 3-layer fallback: Notion → cache → defaults.

Readme

@acegalaxy/model-registry

npm version npm downloads License: MIT Node

Notion-backed AI model registry — define model configs (provider, model, costs, capabilities) in a Notion table, sync to runtime via a single call.

Manage Claude / GPT / Gemini / DeepSeek configs (pricing, context window, aliases, capabilities) in one Notion DB; consumers load them at startup with safe fallbacks.

Why

LLM model lineups change weekly: new versions, new prices, deprecations. Hardcoding pricing tables in every service means stale costs and stale routing. This package lets ops own the model catalog in Notion while services read a normalized map at boot — with a 3-layer fallback so a Notion outage never knocks production offline.

Features

  • 3-layer load: Notion DB → local cache file → hardcoded defaults
  • Provider-agnostic: Claude, GPT, Gemini, DeepSeek, Grok, etc.
  • Cost metadata: pricePerMTokIn / pricePerMTokOut per model
  • Aliases: resolve gpt-4o-latest / claude-sonnet → canonical key
  • Cache atomic writes (mode 0600, tmp + rename)
  • 5s Notion timeout — never blocks boot
  • Zero runtime deps (you bring your own Notion fetcher)

Install

npm install @acegalaxy/model-registry

Quick start

1. Define models in Notion

Create a Notion DB with rows like:

| Key | Provider | Name | PricePerMTokIn | PricePerMTokOut | ContextWindow | Aliases | |---|---|---|---|---|---|---| | claude-opus-4 | anthropic | Claude Opus 4 | 15 | 75 | 200000 | opus, claude-opus | | gpt-4o | openai | GPT-4o | 2.5 | 10 | 128000 | gpt4o | | gemini-2.5-pro | google | Gemini 2.5 Pro | 1.25 | 10 | 1000000 | gemini-pro |

2. Load registry at runtime

import { loadModels } from "@acegalaxy/model-registry";

const DEFAULTS = {
  "claude-opus-4": {
    provider: "anthropic",
    name: "Claude Opus 4",
    pricePerMTokIn: 15,
    pricePerMTokOut: 75,
    contextWindow: 200_000,
  },
};

const { models, source, warnings } = await loadModels({
  fetchRows: async () => myNotionAdapter.fetchModelsDB(),
  cachePath: "/var/cache/model-registry.json",
  defaults: DEFAULTS,
});

console.log(`loaded from ${source} (${Object.keys(models).length} models)`);
// loaded from notion (12 models)

3. Query model by name / alias

function resolve(key: string) {
  if (models[key]) return models[key];
  for (const [canonical, entry] of Object.entries(models)) {
    if (entry.aliases?.includes(key)) return models[canonical];
  }
  return models["gpt-4o"]; // your default
}

const m = resolve("opus");
const cost = (inTok * m.pricePerMTokIn + outTok * m.pricePerMTokOut) / 1_000_000;

Load source semantics

| Source | When | Action | |---|---|---| | notion | fetchRows() returns non-empty within 5s | Cache written, return rows | | cache | Notion failed/empty AND cache file exists | Return cached rows | | defaults | Both above failed | Return hardcoded defaults |

defaults is required and must be non-empty — guarantees the loader always returns a usable map.

API

loadModels(opts): Promise<LoadModelsResult>

interface LoadModelsOpts {
  fetchRows?: () => Promise<ModelMap | null>;
  cachePath?: string;
  defaults: ModelMap;     // required, non-empty
  logger?: Logger;
}

interface LoadModelsResult {
  models: ModelMap;
  source: "notion" | "cache" | "defaults";
  warnings: string[];
}

writeCache(path, models, logger?)

Atomic write helper if you manage cache externally.

NOTION_TIMEOUT_MS

Constant: 5000. Caller-imposed upper bound on fetchRows().

Bring your own Notion fetcher

This package does not call the Notion API directly — pass your own adapter as fetchRows. This keeps the package transport-free and lets you reuse your existing Notion client / auth / rate-limiter.

License

MIT — see LICENSE.

Contributing

See CONTRIBUTING.md. Security issues: see SECURITY.md.