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

@use-solace/openllm

v1.0.2

Published

OpenLLM model registry and API client with full TypeScript support

Readme

@use-solace/openllm

OpenLLM model registry and API client with full TypeScript support for interacting with the OpenLLM inference engine.

Installation

npm install @use-solace/openllm@latest      # npm
bun add @use-solace/openllm@latest          # bun (recommended)
pnpm add @use-solace/openllm@latest         # pnpm
deno add @use-solace/openllm@latest         # deno

Usage

Model Registry

Define your model registry:

import { ModelRegistry } from "@use-solace/openllm";

export const models = ModelRegistry({
  entries: {
    "llama3.1-70b": {
      inference: "ollama",
      id: "llama3.1:70b",
      context: 8192,
      quant: "Q4_K_M",
      capabilities: ["chat"],
      latency: "slow",
    },
    "llama3.1-8b": {
      inference: "llama",
      id: "llama3.1:8b",
      context: 8192,
      quant: "Q4_K_M",
      capabilities: ["chat", "completion"],
      latency: "fast",
    },
  },
});

// Usage examples
models.list();                   // returns all models
models.get("llama3.1:70b");      // returns data for llama3.1:70b
models.find({ capability: "chat", latency: "fast" });
models.findOne({ capability: "chat" });
models.has("llama3.1:70b");      // check if model exists
models.add("new-model", {        // add a new model
  inference: "ollama",
  id: "new-model",
  context: 4096,
  capabilities: ["chat"],
});
models.remove("new-model");      // remove a model

API Client

Directly interact with the OpenLLM engine:

import { createOpenLLMClient } from "@use-solace/openllm";

const client = createOpenLLMClient({ engine: 8080 });

// Health check
const health = await client.health();

// List models
const { models } = await client.listModels();

// Register a model
await client.registerModel({
  id: "llama3.1:8b",
  name: "llama3.1-8b",
  inference: "ollama",
  context: 8192,
  quant: "Q4_K_M",
  capabilities: ["chat"],
  latency: "fast",
});

// Load a model
await client.loadModel({ model_id: "llama3.1:8b" });

// Run inference
const result = await client.inference({
  model_id: "llama3.1:8b",
  prompt: "Hello, how are you?",
  max_tokens: 512,
  temperature: 0.7,
});

// Stream inference
await client.inferenceStream(
  {
    model_id: "llama3.1:8b",
    prompt: "Tell me a story",
    max_tokens: 1024,
  },
  {
    onToken: (token) => console.log(token.token),
    onComplete: (response) => console.log("Done:", response),
    onError: (error) => console.error("Error:", error),
  },
);

// Unload a model
await client.unloadModel("llama3.1:8b");

Elysia Plugin

import { Elysia } from "elysia";
import { openllm } from "@use-solace/openllm/elysia";
import { models } from "./registry.ts";

const app = new Elysia().use(
  openllm({
    prefix: "ollm",         // routes will be under /ollm/* instead of /openllm/*
    modelrouter: true,       // enable model router
    registry: models,        // pass the registry instance
    engine: 4292,            // openllm-server port
  }),
);

app.listen(3000);

console.log("Server running on localhost:3000");

Available endpoints:

  • GET /openllm/health - Health check
  • GET /openllm/models - List registered models
  • POST /openllm/models/register - Register a new model
  • POST /openllm/models/load - Load a model
  • POST /openllm/models/unload/:modelId - Unload a model
  • POST /openllm/inference - Run inference
  • POST /openllm/router/chat - Chat with automatic model routing (if modelrouter: true)

Types

The package provides full TypeScript type safety for all API interactions:

import type {
  InferenceBackend,
  ModelCapability,
  LatencyProfile,
  ModelRegistryEntry,
  InferenceRequest,
  InferenceResponse,
  StreamToken,
  // ... and more
} from "@use-solace/openllm";

Error Handling

The package provides typed error classes:

import {
  OpenLLMError,
  ModelNotFoundError,
  ModelNotLoadedError,
  InferenceError,
} from "@use-solace/openllm";

try {
  await client.inference({ model_id: "unknown", prompt: "test" });
} catch (error) {
  if (error instanceof ModelNotFoundError) {
    console.error("Model not found:", error.message);
    console.error("Status code:", error.statusCode);
  }
}

License

MIT