@aiti-ai/pi-models-respect

Keep your model list tidy: for providers with an explicit models list in models.json, only those models stay visible. A pi package.

Packages

Package details

extension

Install @aiti-ai/pi-models-respect from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@aiti-ai/pi-models-respect
Package
@aiti-ai/pi-models-respect
Version
0.1.2
Published
Aug 20, 2026
Downloads
105/mo · 23/wk
Author
nightwend
License
MIT
Types
extension
Size
11.5 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

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

README

pi-models-respect

A small pi package that keeps your model list tidy.

🇨🇳 中文版:README.zh-CN.md

For providers where you explicitly configure a models list in models.json, only the models you configured stay visible — the hundreds of built-in catalog models (e.g. openrouter's full catalog) quietly step aside.

Nothing is deleted: provider definitions, model definitions, and credentials are all preserved. This only affects which models are shown in pi's model views.

Why

pi's models.json is additive: built-in providers keep their full catalog and your explicit models entries are merged on top. For providers such as openrouter, that means 300+ built-in models show up even though you only configured a handful. There is no built-in way to shrink that list from models.json alone.

This package fills that gap without changing how pi resolves providers.

Install

pi install npm:@aiti-ai/pi-models-respect

Or point pi at this repository directly:

pi install git:github.com/aiti-ai/pi-models-respect

How it works

The extension wraps the model query entry points on ModelRuntime and ModelRegistry (getModels, getAvailable, getAvailableSnapshot, getAll, find). For every provider that has an explicit models list in ~/.pi/agent/models.json, only those explicitly configured model ids remain visible. Providers without an explicit models list are left completely untouched.

The allowlist is generated 100% from models.json (re-read automatically by file mtime). Add or remove models via your model wizard and the next query reflects the change — no extension edits, no restarts.

Example

With this in ~/.pi/agent/models.json:

{
  "providers": {
    "openrouter": {
      "baseUrl": "https://openrouter.ai/api/v1",
      "api": "openai-completions",
      "models": [
        { "id": "z-ai/glm-5.2:free" },
        { "id": "openai/gpt-oss-20b:free" }
      ]
    }
  }
}

Only z-ai/glm-5.2:free and openai/gpt-oss-20b:free remain visible for openrouter — the rest of the built-in catalog is hidden from model selection, modelRegistry.getAll(), modelRegistry.getAvailable(), and modelRegistry.find().

Configuration

There is no separate config file. The allowlist follows models.json.

Requirements

  • pi (the coding agent) — this package is a pi extension
  • ~/.pi/agent/models.json with explicit models lists on the providers you want to narrow

License

MIT