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

@easy-llm/llm

v0.10.0

Published

Provider-agnostic LLM runtime, routing, and model registry

Readme

llm

One API for hosted and local language models, backed by a normalized model registry and automatic routing.

npm install @easy-llm/llm
npx llm setup
npx llm doctor
npx llm run "Explain closures simply."

The default is auto: you do not need to choose a provider or memorize a model ID.

TypeScript API

import { llm } from "@easy-llm/llm";

const response = await llm("Explain this code");
console.log(response.text);

Use a routing intent when one quality matters most:

await llm(prompt, { model: "cheap" });
await llm(prompt, { model: "fast" });
await llm(prompt, { model: "reasoning" });
await llm(prompt, { model: "local" });

You can also request an exact canonical model ID. Images automatically require a vision-capable route:

await llm({
  messages: [{
    role: "user",
    content: [
      { type: "text", text: "What is in this image?" },
      { type: "image", source: { url: "https://example.com/image.jpg" } },
    ],
  }],
});

Inspect a decision without executing it:

const explanation = await llm.explain("Summarize this", { model: "cheap" });
console.log(explanation.selected.modelId, explanation.reasons);

The runtime loads the registry, resolves credentials, scores executable routes using capability evidence, confidence, freshness, observed health, latency, availability, pricing, and policy, then invokes the winner. Retryable failures are recorded and the remaining semantically equivalent routes are re-scored. The response includes the route and normalized usage metadata.

Runtime outcomes are held separately from the immutable canonical registry. Route health starts as unknown, requires multiple observations before becoming healthy or degraded, and uses a rolling window so one old failure cannot permanently poison a route. Prompt content is never stored in observations.

Credentials

Credential resolution has one precedence order:

  1. An explicitly supplied runtime credential
  2. The provider environment variable, such as OPENAI_API_KEY
  3. The encrypted llm vault

llm setup creates or updates the vault and verifies that the packaged canonical registry loads. In a long-running process, unlock the vault once:

await llm.unlock(process.env.LLM_VAULT_PASSWORD!);
// Subsequent llm(...) calls reuse the unlocked session.

Ollama needs no credential. Its default endpoint is http://localhost:11434.

CLI journey

llm setup                         # configure credentials
llm doctor                        # actionable readiness summary
llm doctor --deep                 # include provider connectivity checks
llm run "Draft a release note"    # automatic execution
llm route "Draft a release note"  # explain the same runtime decision
llm models                        # canonical model inventory
llm model <canonical-model-id>    # inspect one normalized record
llm status                        # registry and executable-provider status
llm status --routes               # locally observed route health and latency
llm evaluate                      # certify Routing Contract invariants
llm evaluate --json               # stable CI-readable certification report

Add --json to automation-oriented inspection commands where supported.

Canonical registry

The npm package ships the same normalized registry used by routing and the CLI. Consumers do not need repository-relative files.

import { loadCanonicalRegistry } from "@easy-llm/llm/registry";

const registry = await loadCanonicalRegistry();
console.log(registry.version, registry.models.length);

The loader prefers an explicitly supplied registry, then the packaged canonical snapshot. A local path is only a development fallback after packaged resolution fails.

Advanced requests

The object request form remains available for messages, tools, structured output, streaming, timeouts, and cancellation:

const result = await llm({
  messages: [{ role: "user", content: "Return a JSON list of three colors" }],
  output: { parse: (text) => JSON.parse(text) as string[] },
  timeoutMs: 10_000,
});
for await (const chunk of llm.stream("Write a haiku")) {
  if (chunk.type === "text") process.stdout.write(chunk.text ?? "");
}

Providers

Built-in adapters cover OpenAI, Anthropic, Google, OpenRouter, and Ollama. OpenAI and OpenRouter accept native image content through the unified request shape; other adapters preserve a text-compatible representation when native image transport is unavailable.

Development

npm run typecheck
npm test
npm run build
npm run test:fresh-install

The fresh-install test packs the project, installs the tarball in an empty consumer, loads the packaged registry, and executes an automatically routed request.

License

MIT