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

@nan0web/ai

v1.1.0

Published

Unified AI Kernel for NaN0Web ecosystem - LLM provider abstraction

Readme

@nan0web/ai

Unified AI Kernel — LLM provider abstraction for nan•web ecosystem

Installation

How to install with npm?

npm install @nan0web/ai

How to install with pnpm?

pnpm add @nan0web/ai

Quick Start

How to create an AI instance?

import { AI } from '@nan0web/ai'
const ai = new AI()

Streaming Text

import { AI } from '@nan0web/ai'

const ai = new AI()
await ai.refreshModels()

const model = ai.findModel('llama-3.3')
const stream = ai.streamText(model, [
  { role: 'user', content: 'Hello!' }
])

for await (const chunk of stream.textStream) {
  process.stdout.write(chunk)
}

How to use streamText API?

Providers

| Provider | ENV Key | Status | |----------|---------|--------| | Cerebras | CEREBRAS_API_KEY | ✅ | | OpenAI | OPENAI_API_KEY | ✅ | | OpenRouter | OPENROUTER_API_KEY | ✅ | | HuggingFace | HF_TOKEN | ✅ | | LlamaCpp | LLAMA_CPP_URL | ✅ |

How to get a provider?

import { AI } from '@nan0web/ai'
const ai = new AI()

Model Strategy

Smart model selection by 4 axes:

  • financefree | cheap | expensive
  • speedslow | fast
  • volumelow | mid | high
  • levelsimple | smart | expert

How to use AI Strategy for model selection?

import { AI } from '@nan0web/ai'
const ai = new AI()
ai.addModel(
	'test',
	new ModelInfo({
		id: 'test-model',
		provider: 'openai',
		context_length: 128000,
		volume: 200e9,
		pricing: { prompt: 1, completion: 1 },
	}),
)
const found = ai.strategy.findModel(ai.getModelsMap(), 1000)

Model Info

How to create a ModelInfo instance?

import { ModelInfo } from '@nan0web/ai'
const model = new ModelInfo({
	id: 'llama-3.3-70b',
	provider: 'cerebras',
	context_length: 128000,
	maximum_output: 8192,
	pricing: { prompt: 0.6, completion: 0.6 },
	volume: 70e9,
})

Usage Tracking

How to track token usage?

import { Usage } from '@nan0web/ai'
const usage = new Usage({
	inputTokens: 1000,
	outputTokens: 500,
})

Testing

Use TestAI for deterministic tests without real API calls:

How to use TestAI for testing?

import { TestAI } from '@nan0web/ai/test'
const ai = new TestAI()

Architecture

@nan0web/ai
├── AI.js              — Provider abstraction (streamText, generateText)
├── ModelInfo.js       — Model metadata & capabilities
├── ModelProvider.js   — Remote model discovery
├── AiStrategy         — Smart model selection (finance/speed/volume/level)
├── TestAI.js          — Deterministic testing mock
├── Usage.js           — Token tracking & cost calculation
└── Pricing.js         — Per-token pricing calculations

How to verify the package engine requirement?

Documentation

  • PLAN.md — Detailed architecture and API plan

License

How to check the license?