pi-openrouter-native

Native OpenRouter model sync for pi using built-in provider routing support

Packages

Package details

extension

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

$ pi install npm:pi-openrouter-native
Package
pi-openrouter-native
Version
0.1.1
Published
May 5, 2026
Downloads
55/mo · 15/wk
Author
adstastic
License
MIT
Types
extension
Size
18.1 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions/openrouter-native/index.ts"
  ]
}

Security note

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

README

pi-openrouter-native

OpenRouter model sync for Pi using native pi.registerProvider("openrouter", ...).

Install

Try from this checkout:

pi -e .

Install from GitHub:

pi install git:github.com/adstastic/pi-openrouter-native

After npm publish:

pi install npm:pi-openrouter-native

Auth

Use env:

export OPENROUTER_API_KEY=sk-or-...
pi

Or run Pi /login and select OpenRouter. Pi stores key under openrouter in ~/.pi/agent/auth.json.

Note: startup /models fetch can use OPENROUTER_API_KEY only because async extension factory has no command context. OpenRouter public /models works without key. /openrouter-sync can use Pi auth from auth.json.

Commands

  • /openrouter-status — model count, cache age, last sync, auth status
  • /openrouter-sync — refetch /models, re-register provider, keep last-good list on failure

Pi model picker still lists OpenRouter models when no auth is configured because provider must be registered with apiKey: "OPENROUTER_API_KEY". Requests need OPENROUTER_API_KEY or stored OpenRouter auth; /openrouter-status warns when missing.

Usage/cost viewer

For burn-rate/model spend, install companion package:

pi install npm:@robhowley/pi-openrouter

Then use /openrouter-usage.

Checks

npm run typecheck
npm audit --omit=dev
npm pack --dry-run
pi -e . --list-models