pi-hide-providers
Hide providers and models from pi's model selector — filter the /model list and Ctrl+P cycling via a configurable blocklist
Package details
Install pi-hide-providers from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-hide-providers- Package
pi-hide-providers- Version
0.1.1- Published
- Jun 4, 2026
- Downloads
- not available
- Author
- monotykamary
- License
- MIT
- Types
- extension
- Size
- 38.9 KB
- Dependencies
- 0 dependencies · 0 peers
Pi manifest JSON
{
"extensions": [
"./hide-providers.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
🔇 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.
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.jsonor.pi/hide-providers.json) - On session start, the extension monkey-patches
modelRegistry.getAvailable(),getAll(), andfind()to filter out hidden models - The
/modelselector,Ctrl+Pcycling,--list-models, and session restoration all see only visible models /hide-models resetunpatches the registry — all models return immediately- Changes via
/hide-models addand/hide-models removetake effect immediately (no reload needed) - Interactive
/hide-modelscommand — no-args opens the TUI selector; subcommands for adding, removing, and inspecting rules
No settings.json is modified. No 250+ entry explosion. No allowlist semantics.
Usage
Interactive Commands
| Command | What it does |
|---|---|
/hide-models |
Open interactive TUI to select providers/models to hide |
/hide-models add ollama |
Hide the entire ollama provider |
/hide-models add openrouter/cheap-model |
Hide a specific model from openrouter |
/hide-models add openrouter/* |
Hide the entire openrouter provider (explicit) |
/hide-models remove ollama |
Remove the hide rule for ollama |
/hide-models status |
Show current rules, patch status, and hidden model count |
/hide-models apply |
Show current hide state (changes are already active) |
/hide-models reset |
Unpatch registry — all models return immediately |
/hide-models help |
Show 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:
| Rule | Effect |
|---|---|
{ "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).
Installation
With pi install (recommended):
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
→ Monkey-patches modelRegistry:
getAvailable() → original result filtered by isHidden()
getAll() → original result filtered by isHidden()
find(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 methods read latest rules via closure
→ Changes take effect immediately (no reload)
/hide-models reset:
→ Unpatches registry (restores original methods)
→ 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 modelRegistry.refresh() because they wrap the original methods. On reload, the extension detects the registry is already patched and just updates the rules source.
Comparison with Alternatives
| Approach | Pros | Cons |
|---|---|---|
| pi-hide-providers (this) | Blocklist — completely removes models from all lists; no settings.json writes; changes take effect immediately; survives refresh() |
Monkey-patches modelRegistry methods (not an official SDK mechanism) |
enabledModels in settings.json (manual) |
Built-in, no extension needed | Allowlist — must list every model you want individually; no blocklist support; clobbers settings with hundreds of entries |
--models CLI flag |
Per-session scoping | Must pass every time; no persistence |
pi.unregisterProvider() |
Restores built-in models after override | Only works for providers registered via pi.registerProvider(); can't hide entire providers (empty models array is a no-op) |
pi-model-router scope shim |
Dynamic scoping with routing | Heavyweight — 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