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

@namzu/openrouter

v0.2.0

Published

OpenRouter LLM provider for @namzu/sdk. Access to 200+ models (Claude, GPT-4, Llama, Mixtral) via OpenRouter's unified API.

Readme

@namzu/openrouter

OpenRouter LLM provider for @namzu/sdk. Thin fetch-based wrapper around OpenRouter's OpenAI-compatible Chat Completions API (chat + streaming) with full tool-use support, conformant to the LLMProvider contract. Gives you access to 200+ models — Claude, GPT-4, Llama, Mixtral, Gemini, and more — through a single unified API and billing account.

Install

pnpm add @namzu/sdk @namzu/openrouter

@namzu/openrouter declares @namzu/sdk as a peer dependency. Install both. The provider has zero runtime dependencies — it talks to OpenRouter with native fetch.

Usage

import { ProviderRegistry } from '@namzu/sdk'
import { registerOpenRouter } from '@namzu/openrouter'

// Register once at app startup.
registerOpenRouter()

// Fully typed via module augmentation: ProviderConfigRegistry['openrouter'].
const { provider, capabilities } = ProviderRegistry.create({
  type: 'openrouter',
  apiKey: process.env.OPENROUTER_API_KEY!,
  siteUrl: 'https://myapp.example',   // optional — shown on OpenRouter analytics
  siteName: 'My App',                 // optional — shown on OpenRouter analytics
})

const response = await provider.chat({
  model: 'anthropic/claude-sonnet-4',
  messages: [{ role: 'user', content: 'Hello' }],
})

Streaming:

for await (const chunk of provider.chatStream({
  model: 'openai/gpt-4o',
  messages: [{ role: 'user', content: 'Tell me a story' }],
})) {
  if (chunk.delta.content) process.stdout.write(chunk.delta.content)
}

Authentication

Get an API key at openrouter.ai/keys. Pass it to the provider via the apiKey field, or read it from process.env.OPENROUTER_API_KEY in your app before constructing the config.

Models

OpenRouter exposes 200+ models from every major vendor under one unified API. See the OpenRouter model catalog for the full list and current pricing. Identifiers follow the vendor/model-name pattern:

  • anthropic/claude-sonnet-4
  • anthropic/claude-haiku-4
  • openai/gpt-4o
  • openai/gpt-4o-mini
  • meta-llama/llama-3.3-70b-instruct
  • mistralai/mixtral-8x22b-instruct
  • google/gemini-pro-1.5

Pricing is per-million tokens on OpenRouter's catalog — the provider's listModels() returns live pricing pulled from the /models endpoint.

Base URL override

The OpenRouter endpoint defaults to https://openrouter.ai/api/v1. Override via the baseUrl config field or the OPENROUTER_BASE_URL environment variable — useful for OpenRouter-compatible self-hosted gateways.

Capabilities

import { OPENROUTER_CAPABILITIES } from '@namzu/openrouter'

// {
//   supportsTools: true,
//   supportsStreaming: true,
//   supportsFunctionCalling: true,
// }

OpenAI compatibility

Because OpenRouter speaks the OpenAI Chat Completions dialect, this provider can also target any OpenAI-compatible endpoint (vLLM, LM Studio, Groq, local OpenAI-compat gateways) by passing baseUrl pointing at the alternate endpoint. For a zero-config generic OpenAI-compatible client, use the forthcoming @namzu/http package instead.

Observability

This package ships without observability hooks in 0.1.x. OpenTelemetry span emission and structured logging are roadmapped for the forthcoming @namzu/telemetry package — a separate opt-in dependency that wraps any LLMProvider to emit GenAI semantic-convention spans. Track progress in the Namzu roadmap.

License

FSL-1.1-MIT. Same as @namzu/sdk.