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

@genoventures-labs/zenrouter

v0.1.0

Published

Keep OpenCode Zen apps running with ordered free and paid model fallback.

Readme

ZenRouter

TypeScript Python Tests License

ZenRouter helps an app keep going when an OpenCode Zen model is busy or has reached its limit.

Give it a list of free models and an optional list of paid backups. It tries them in order, remembers a model that needs a short break, and moves on when Zen says that model is temporarily unavailable. Your app gets the normal Chat Completions response plus the name of the model that handled it.

This first release supports OpenCode Zen's Chat Completions endpoint. It is built for server-side TypeScript and Python apps.

What It Does

  • Tries free models before paid models.
  • Moves to the next model for rate limits, exhausted credits, temporary outages, and unavailable models.
  • Respects Zen's Retry-After wait time when it is supplied.
  • Avoids wasting requests on models that are still waiting to become available.
  • Keeps ordinary failures, such as a bad API key or invalid request, visible instead of quietly trying every model.
  • Passes a successful streamed reply straight through. It never restarts a reply after it has begun.

TypeScript

Install the package after it has been published, or use a local npm link while developing it:

npm install @genoventures-labs/zenrouter
import { createZenRouter } from "@genoventures-labs/zenrouter";

const router = createZenRouter({
  apiKey: process.env.OPENCODE_ZEN_API_KEY!,
  freeModels: ["big-pickle", "mimo-v2.5-free", "hy3-free"],
  paidModels: ["deepseek-v4-flash", "qwen3.5-plus"],
});

const result = await router.chat({
  messages: [{ role: "user", content: "Explain this function." }],
});

console.log(`Used ${result.pool}: ${result.model}`);
const completion = await result.response.json();

For a streamed reply, add stream: true to the request and read the returned response as usual:

const result = await router.chat({
  stream: true,
  messages: [{ role: "user", content: "Explain this function in a few lines." }],
});

for await (const chunk of result.response.body!) {
  process.stdout.write(new TextDecoder().decode(chunk));
}

Python

The Python package lives in python. From that folder, install it into your environment:

pip install .
import os

from zenrouter import ZenRouter

router = ZenRouter(
    api_key=os.environ["OPENCODE_ZEN_API_KEY"],
    free_models=["big-pickle", "mimo-v2.5-free"],
    paid_models=["deepseek-v4-flash"],
)

result = router.chat({
    "messages": [{"role": "user", "content": "Explain this code."}],
})

print(f"Used {result.pool}: {result.model}")
print(result.response.read().decode())

Keep Your Key Safe

ZenRouter needs your OpenCode Zen API key, so create the router in your server, command-line program, or Python service.

Do not put OPENCODE_ZEN_API_KEY in browser JavaScript, a mobile app, a public repository, or a frontend .env file. A website should send requests to its own backend, and that backend should use ZenRouter.

Free-model availability and data handling can vary. Review the current Zen model list, pricing, privacy information, and your own spending limits before turning on paid backups.

Development

npm install
npm run typecheck
npm test
npm run build

Run the Python tests with the package source on the import path:

PYTHONPATH=python python -m unittest discover -s python/tests -v