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

pi-anyrouter-dev

v0.1.7

Published

AnyRouter (anyrouter.dev) provider for the pi coding agent - a thin layer over pi's built-in OpenAI-compatible client with a dynamically fetched model catalog

Readme

pi-anyrouter-dev

npm version npm downloads Provenance License: MIT

AnyRouter provider for the pi coding agent. Adds AnyRouter (anyrouter.dev) as a provider using pi's built-in OpenAI-compatible client with a dynamically fetched model catalog.

Install

# Required: registers the extension with pi so the provider is available
pi install npm:pi-anyrouter-dev

Note: npm install pi-anyrouter-dev alone only adds the package to your project. You must run pi install npm:pi-anyrouter-dev (or use --extension) to register the provider with pi.

Quick Start

# Set your AnyRouter API key
export ANYROUTER_DEV_API_KEY=sk-...

# Use the anyrouter-dev provider explicitly with a specific model
pi --provider anyrouter-dev --model gpt-4o -p "Hello, world!"

What It Does

This extension registers anyrouter-dev as a provider in pi. It:

  • Uses pi's native OpenAI-compatible client for provider requests — no custom HTTP/SSE code for chat/completions
  • Fetches the live model catalog from AnyRouter at startup (online) or restores persisted models (offline)
  • Maps AnyRouter models to pi's model format — pricing, context, reasoning, vision
  • Persists the catalog so it works offline and restores instantly on next start
  • Handles API keys via ANYROUTER_DEV_API_KEY (owned by this package) with fallback to ANYROUTER_API_KEY

Configuration

API Key

| Variable | Priority | Notes | |----------|----------|-------| | ANYROUTER_DEV_API_KEY | 1st (owned) | This package's own variable | | ANYROUTER_API_KEY | 2nd (fallback) | AnyRouter's documented name |

Keys can also be stored in pi's credential store under provider anyrouter-dev.

Model Selection

The extension fetches the full model catalog from AnyRouter dynamically. To use a specific model, pass it explicitly:

pi --provider anyrouter-dev --model gpt-4o -p "Your prompt"

Or select it in pi's model picker after the catalog loads. The extension does not read static model lists from models.json — the catalog is always fetched from AnyRouter (or restored from pi's persisted store offline).

How It Works

  1. Startup (online): Extension loads, resolves API key, fetches live catalog from AnyRouter
  2. Startup (offline): Restores persisted models from pi's store without contacting AnyRouter
  3. Mapping: catalog.ts converts AnyRouter models → pi model configs (cost, context, reasoning, compat)
  4. Registration: Provider registered with pi using api: "openai-completions"
  5. Refresh: refreshModels re-fetches the catalog when pi requests a refresh (e.g., model picker)
  6. Persist: Catalog saved to pi's store; restored on next start (works offline)

Architecture

  • src/index.ts — Extension entry point, provider registration, refresh logic
  • src/catalog.ts — Model mapping, cost parsing, reasoning/compat computation
  • src/fetch-catalog.ts — HTTP fetch with auth, timeout, error handling (custom HTTP for catalog)
  • src/api-key.ts — Key resolution priority, credential templates
  • src/provider-info.ts — Provider constants (id, name, base URL)

Requirements

  • pi ≥ 1.3.0
  • Node.js ≥ 22.19
  • Bun ≥ 1.2
  • AnyRouter API key (free at anyrouter.dev)

License

MIT