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

@saifymatteo/pi-9router

v0.3.0

Published

9Router provider driven by the router's own /v1/models endpoint, plus fetch/search/transcribe tools.

Downloads

1,148

Readme

pi-9router

Pi's model picker listing every model from the router's own /v1/models

9Router model provider driven by the router's own /v1/models endpoint, plus fetch, search, and transcribe tools.

Model discovery uses only the router's models API: every model the router lists is registered from the capabilities it advertises itself (vision, reasoning, thinkingFormat, contextWindow, maxOutput) — no external catalogs (modelgrep, models.dev, opencode zen) are consulted, so a third-party outage can never break model discovery.

Based on @xynogen/pix-9router via the @haoyiyin/9router fork (both MIT); see NOTICE.md.

Install

pi install npm:@saifymatteo/pi-9router

Configure

There is no built-in default endpoint. Run /login, select 9Router, and enter the base URL and API key.

The two halves live in different files, both under <agent-dir> (PI_CODING_AGENT_DIR or ~/.pi/agent):

  • extensions/9router.json — the base URL and options (mode 0600); no API key is stored here. This is the same directory other packages use for their settings (typically a symlink into your dotfiles), so it can be versioned safely.
  • auth.json — the API key, stored by pi as the standard 9router login credential; chat authentication reads it from there, and so do the bundled tools.

/9router settings edits the base URL, combo reasoning on/off and the tool switches. A missing extensions/9router.json is created once with $schema, comboReasoning and the tool switches; baseUrl is left out so ROUTER_API_BASE still applies.

ROUTER_API_BASE / ROUTER_API_KEY environment variables override the config file and the credential respectively.

Migrating from @haoyiyin/9router: on first launch the extension reads the old haoyiyin/9router.json (or the intermediate saifymatteo/9router.json from 0.1.0 dev builds), writes the new secret-free config, and moves the key into the auth.json credential. The old file is then removed (and the haoyiyin/ directory, once empty), so the move happens once.

For editor completion, the config's first line is:

"$schema": "https://raw.githubusercontent.com/saifymatteo/pi-extensions/main/packages/pi-9router/schemas/9router.schema.json"

/login adds it when the key is absent and keeps any other $schema you set; the loader ignores it.

Model discovery

The provider refreshes <router-base-url>/models every 30 minutes (cached at ~/.cache/pi/9router.json). Startup never waits on the router: it registers the cached models at once, whatever their age, and refreshes in the background. The provider maps each model to pi's registry from the router's own capabilities:

| Router capability | Registered as | | --- | --- | | capabilities.vision | model input (["text", "image"] or ["text"]) | | capabilities.reasoning | reasoning | | capabilities.thinkingFormat / thinkingCanDisable | compat.thinkingFormat + thinkingLevelMap | | capabilities.contextWindow (or context_window / context_length) | contextWindow | | capabilities.maxOutput (or max_tokens / max_completion_tokens) | maxTokens |

Cost is registered as zero for every model (the router meters usage). Display names are derived from the model id (e.g. kr/claude-sonnet-4.5 → Claude Sonnet 4.5) since the router does not advertise names. A failed refresh falls back to the stale cache; an unavailable router registers no models until it answers again.

Combo models (owned_by: "combo") advertise no capabilities, so their reasoning is decided by comboReasoning in the config file. It defaults to on (assumes combo routes hit thinking-capable upstreams) with the full off..max range. Opt out per machine with:

{
  "comboReasoning": false
}

To override that default range, pass a custom thinkingLevelMap (keys: off, minimal, low, medium, high, xhigh, max; values: what gets sent to the router, null hides the level). For example, to cap combo models at high:

{
  "comboReasoning": { "thinkingLevelMap": { "xhigh": null, "max": null } }
}

Tools

fetch / search / transcribe behave the same as in pix-9router; collapse config still lives in ~/.pi/agent/pix.json. They register only when a base URL and a credential are both available at load time (logging in mid-session enables them on the next launch). Disable any of them individually via the tools section of the config file — every tool is on by default:

{
  "tools": { "transcribe": false }
}

License

AGPL-3.0-only — see LICENSE. The vendored fetch/search/transcribe/http/render sources remain MIT (see NOTICE.md).