pi-model-switch

Model switching extension for pi coding agent

Packages

Package details

extension

Install pi-model-switch from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-model-switch
Package
pi-model-switch
Version
0.2.0
Published
Aug 23, 2026
Downloads
699/mo · 136/wk
Author
nicopreme
License
MIT
Types
extension
Size
15.2 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-model-switch

A Pi coding agent extension for direct model switching.

It provides one tool, switch_model, for identifying, listing, searching, and directly switching models.

Foreground orchestration now lives in pi-orchestrate.

Installation

pi install npm:pi-model-switch

Restart Pi to load the extension.

Tool

switch_model

Parameters:

  • action: current | list | search | switch
  • search?: query for search and switch
  • provider?: provider filter

Behavior:

  • current: shows the active model without listing every model
  • list: shows available authenticated models
  • search: filters by provider, id, or name
  • switch: resolves aliases first, then does exact or partial model matching

Aliases

Aliases can be defined in the first existing file from these locations, in priority order:

  1. {project}/.pi/aliases.json
  2. ~/.pi/agent/aliases.json
  3. ~/.pi/agent/extensions/model-switch/aliases.json

The extension loads aliases when the tool runs, so project aliases use the current working directory. list reports the selected alias file path.

For example, define aliases in the extension-level file:

~/.pi/agent/extensions/model-switch/aliases.json
{
  "cheap": "google/gemini-2.5-flash",
  "coding": "anthropic/claude-opus-4-5",
  "budget": ["openai/gpt-5-mini", "google/gemini-2.5-flash"]
}

Rules:

  • top-level value must be an object
  • alias names must be non-empty strings
  • each target must be provider/modelId
  • string alias: one exact model target
  • array alias: fallback chain; first available authenticated target wins

License

MIT