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-model-switch

v0.1.2

Published

Model switching extension for pi coding agent

Readme

pi-model-switch

A Pi coding agent extension that gives the agent the ability to list, search, and switch models on its own.

With this extension, you can tell the agent things like "switch to a cheaper model" or "use Claude for this task" and it will handle the model change itself, without you needing to use /model or keyboard shortcuts.

Installation

pi install npm:pi-model-switch

Restart Pi to load the extension.

Verify Installation

After restarting Pi, the switch_model tool should be available. Ask the agent to "list available models" to confirm.

Updating

If you used curl:

curl -o ~/.pi/agent/extensions/model-switch/index.ts \
  https://raw.githubusercontent.com/nicobailon/pi-model-switch/main/index.ts

If you cloned:

cd ~/.pi/agent/extensions/model-switch && git pull

Restart Pi after updating.

Configuration

Model Aliases

Create aliases.json in the extension directory to define shortcuts:

~/.pi/agent/extensions/model-switch/aliases.json
{
  "cheap": "google/gemini-2.5-flash",
  "fast": "google/gemini-2.5-flash",
  "coding": "anthropic/claude-opus-4-5",
  "budget": ["openai/gpt-5-mini", "google/gemini-2.5-flash", "anthropic/claude-3-5-haiku-latest"]
}
  • String value: Must be an available model or returns an error
  • Array value: Uses first available model in the list (fallback chain)

Then just say "switch to cheap" or "use coding model".

AGENTS.md

Add model switching preferences to your AGENTS.md for contextual decisions:

## Model preferences
- Simple file ops / quick questions: switch to "cheap"
- Complex refactoring / architecture: switch to "coding"
- Default to budget-friendly models unless quality is needed

The agent will use aliases when appropriate based on your guidance.

Usage

Once installed, the agent gains a switch_model tool. Just ask naturally:

  • "List available models"
  • "Switch to GPT-5.2"
  • "Use Opus 4.5"
  • "Change to a model with vision capabilities"
  • "Use a cheaper model for this task"

The agent will list models or switch as appropriate.

Tool Reference

The extension registers a single tool:

switch_model

| Parameter | Type | Description | |-----------|------|-------------| | action | "list" | "search" | "switch" | List all models, search/filter models, or switch to one | | search | string (optional) | For search/switch: term to match model by provider, id, or name | | provider | string (optional) | Filter to a specific provider (e.g. 'anthropic', 'openai', 'google') |

List action

Returns all models you have API keys configured for, showing:

  • Provider and model ID
  • Model name
  • Context window and max output tokens
  • Capabilities (reasoning, vision)
  • Cost per 1M tokens (input/output)
  • Which model is currently active

Search action

Filters models by partial match on provider, id, or name. Returns all matching models with full details.

Switch action

Matches models by:

  1. Alias lookup (if defined in aliases.json)
  2. Exact provider/id match
  3. Exact id match
  4. Partial match on id, name, or provider

If multiple models match, it asks you to be more specific.

Requirements

License

MIT