@vultr/model-catalog
v0.0.3
Published
Fetch and normalize a Model Document 2.4 catalog (Vultr Inference /v1/models)
Readme
@vultr/model-catalog
Fetch GET /v1/models from Vultr Inference and turn each Model Document 2.4
entry into a flat CatalogModel. This is the base the TypeScript harness
integrations (Pi, OpenClaw, OpenCode) build on. The Python twin is
model-catalog-python; both produce the same output for the same input.
Install
npm install @vultr/model-catalogNo runtime dependencies. Node 20+ or Bun.
import { isChatModel, loadCatalog, pricePerMillion } from "@vultr/model-catalog";
const catalog = await loadCatalog({ cachePath: "/home/me/.cache/vultr/catalog.json", maxAgeMs: 300_000 });
for (const model of catalog.models.filter(isChatModel)) {
console.log(model.id, model.contextWindow, pricePerMillion(model).prompt);
}Surface
loadCatalog(options): fetch, normalize, fall back to the last good payload when the network fails.catalog.sourceisnetwork,cacheorstale-cache. ThrowsCatalogErroronly when there is nothing to servefetchCatalog(options): the raw JSON payload. The catalog is public;apiKeyis optionalparseCatalog(payload): documents plusissues. A bad entry is skipped and reported, it never fails the catalognormalizeModel(document): oneCatalogModelisChatModel,isAgentModel,acceptsInput,pricePerMillion,usdPerMilliontoCanonical(model): the snake_case form shared with the Python library
CatalogModel carries contextWindow, maxOutputTokens, inputModalities,
outputModalities, pricing (exact USD per token strings), tools,
structuredOutputs, streaming, supportedParameters, parameters,
reasoning, isReady, deprecationDate. Rerankers, embedders, image
generators, transcription and decision models are in the catalog too;
isChatModel keeps the ones that output text. isAgentModel keeps the chat
models a coding harness can drive: ready, with tool calling and a known context
window. A safety classifier outputs text but calls no tools, so it is a chat
model and not an agent model.
See docs/catalog.md for the field mapping and the cache format.
Development
npm install
npm run typecheck
npm test
npm run buildTests run the .ts sources directly on Node's type stripping. fixtures/ is
shared with the Python project: after changing normalization, run
UPDATE_FIXTURES=1 npm test and copy fixtures/*.json to
model-catalog-python/fixtures/.
