← Catalog

pi-hide-providers

Hide providers and models from pi's model selector — filter the /model list and Ctrl+P cycling via a configurable blocklist

ExtensionProvider

Install

Install with PiG

pig install npm:pi-hide-providers

Install with Pi

pi install npm:pi-hide-providers
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./hide-providers.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.1.27 (README.md). PiG does not review it.

🔇 pi-hide-providers

Hide providers and models from the selector in pi

Filter the model picker so you only see the models you care about.

pi extension license

pi-hide-providers interactive model selector

The Problem

Pi's model selector shows every available model from every configured provider. If you have Ollama running with 20 local models, or an OpenRouter account with hundreds of options, the model list becomes noisy and slow to navigate. There's no built-in way to say "I never want to see these providers/models in the selector."

Pi has enabledModels in settings.json as an allowlist, but maintaining it manually is tedious — you have to list every model you do want, and clobber settings.json with hundreds of entries. What you really want is a blocklist: "hide everything from these providers, except the ones I explicitly use."

The Solution

pi-hide-providers gives you a blocklist that completely removes models from all lists — not an allowlist, not a scoped subset:

  • Define hide rules in a config file (~/.pi/agent/hide-providers.json or .pi/hide-providers.json)
  • On session start, the extension patches pi’s underlying ModelRuntime accessors (with a ModelRegistry fallback for older pi versions) to filter out hidden models
  • The /model selector, Ctrl+P cycling, --list-models, and session restoration all see only visible models
  • /hide-models reset removes the runtime/registry patch — all models return immediately
  • Changes via /hide-models add and /hide-models remove take effect immediately (no reload needed)
  • Interactive /hide-models TUI lists visible models first in user-toggle order, then hidden models in their original registry order, and keeps the cursor at the same index after each toggle — matching pi core's /scoped-models UX
  • model fields accept glob patterns — "gpt-3.5*" hides the whole family, "*preview*" hides every preview variant — so one rule can cover dated aliases and future models that follow the same naming convention
  • /hide-models subcommands for adding, removing, and inspecting rules

No settings.json is modified. No 250+ entry explosion. No allowlist semantics.

Usage

Interactive Commands

CommandWhat it does
/hide-modelsOpen interactive TUI to select providers/models to hide
/hide-models add ollamaHide the entire ollama provider
/hide-models add openrouter/cheap-modelHide a specific model from openrouter
/hide-models add openrouter/*Hide the entire openrouter provider (explicit)
/hide-models remove ollamaRemove the hide rule for ollama
/hide-models statusShow current rules, patch status, and hidden model count
/hide-models applyShow current hide state (changes are already active)
/hide-models resetUnpatch registry — all models return immediately
/hide-models helpShow usage reference

Config File

Create ~/.pi/agent/hide-providers.json (global) or .pi/hide-providers.json (project-local):

{
  "hide": [
    { "provider": "ollama" },
    { "provider": "openrouter", "model": "cheap-model" },
    { "provider": "github-copilot", "model": "gpt-3.5-turbo" }
  ]
}

Rule formats:

RuleEffect
{ "provider": "ollama" }Hide all models from the ollama provider
{ "provider": "ollama", "model": "*" }Same — explicit wildcard
{ "provider": "openrouter", "model": "cheap-model" }Hide only openrouter/cheap-model

Project config (.pi/hide-providers.json) takes priority over global config (~/.pi/agent/hide-providers.json).

Commands will not overwrite invalid config. Writers use a short-lived <config>.lock directory beside the actual config file. If a crash leaves it behind, remove the empty lock directory only after all writers have stopped.

Installation

With pi install (recommended):

pi install npm:pi-hide-providers

Or install from GitHub:

pi install https://github.com/monotykamary/pi-hide-providers

With npm:

npm install pi-hide-providers

Or in ~/.pi/agent/settings.json:

{
  "packages": [
    "https://github.com/monotykamary/pi-hide-providers"
  ]
}

Then /reload or restart pi.

For quick one-off tests:

pi -e ./hide-providers.ts

How It Works

Session starts
  → Extension reads hide-providers.json
  → Patches ModelRuntime (current pi) or ModelRegistry (older pi):
      available model reads → original result filtered by isHidden()
      all model reads       → original result filtered by isHidden()
      model lookup(p, m)    → returns undefined if isHidden(p, m)
  → All downstream consumers see only visible models:
      /model selector, Ctrl+P, --list-models, session restoration

/hide-models add or /hide-models remove:
  → Config updated on disk
  → currentRules updated in memory
  → Patched runtime/registry methods read latest rules via closure
  → Changes take effect immediately (no reload)

/hide-models reset:
  → Restores the original model accessors
  → All models return immediately

The SDK doesn't provide a mechanism to remove models from the registry — registerProvider({ models: [] }) is treated as "no models to register" (override-only), not "remove all models." Monkey-patching the accessor methods is the only way to completely remove models from all lists without touching settings.json.

The patches survive model catalog refreshes because they wrap the runtime accessors rather than a model snapshot. On reload, the extension detects an existing patch and updates its rules source.

Comparison with Alternatives

ApproachProsCons
pi-hide-providers (this)Blocklist — completely removes models from all lists; no settings.json writes; changes take effect immediately; survives catalog refreshMonkey-patches internal model accessors (not an official SDK mechanism)
enabledModels in settings.json (manual)Built-in, no extension neededAllowlist — must list every model you want individually; no blocklist support; clobbers settings with hundreds of entries
--models CLI flagPer-session scopingMust pass every time; no persistence
pi.unregisterProvider()Restores built-in models after overrideOnly works for providers registered via pi.registerProvider(); can't hide entire providers (empty models array is a no-op)
pi-model-router scope shimDynamic scoping with routingHeavyweight — full routing system just to filter the model list

Development

npm install
npm test          # Vitest unit tests
npm run typecheck # TypeScript validation
npm run lint:dead # Dead code detection (knip)

Structure

.
├── hide-providers.ts   # Main extension
├── src/
│   └── index.ts        # Constants, types, and utilities
├── __tests__/
│   └── unit/
│       └── hide-providers.test.ts
├── package.json
├── tsconfig.json
├── vitest.config.ts
└── knip.json

License

MIT

Pi 1.0 compatibility (0.1.22)

Tested against Pi 1.3.0 with exact SDK development pins and wildcard host peers. Native ModelRuntime filtering, scoped fallbacks and selector restoration are verified in both host layouts.

Run bun run test:host for the offline real-host regression. Set PI1_HOST_PACKAGE to an installed Pi package directory and PI1_HOST_ENTRY=bundle to test its bundled CLI runtime.

Pi 0.99 compatibility (0.1.21)

Filters the actual 0.99 ModelRuntime and scoped-selector fallback entries. Auth/cancellation arguments are forwarded; filtering composes with model sorting and restores on shutdown. Custom screens propagate IME focus.

Tested with Pi 0.99.0. Host-provided Pi packages are wildcard peers, not bundled dependencies; development uses exact 0.99.0 versions.