← Catalog

pi-tokenrouter-provider

Pi extension + token-router fork that adds tokenrouter.com as a model provider for pi

Package

Install

Install with PiG

pig install npm:pi-tokenrouter-provider

Install with Pi

pi install npm:pi-tokenrouter-provider
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.

{
  "skills": [
    "./skills"
  ],
  "extensions": [
    "./src/index.ts"
  ]
}

README

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

Pi TokenRouter Provider

A fork of token-router adapted to add tokenrouter.com as a model provider for pi.

It keeps the original lossless local line-routing Python router (scripts/router.py) and adds a TypeScript extension that lets you use tokenrouter.com models directly from pi.

Installation

From npm (appears in the Pi package gallery):

pi install npm:pi-tokenrouter-provider

From GitHub:

pi install git:github.com/rharagon/pi-tokenrouter-provider

Or with a local path for development:

pi -e ./pi-tokenrouter-provider

Authentication

Get an API key from your tokenrouter.com dashboard.

Then set it as an environment variable:

export TOKENROUTER_API_KEY=sk-...

On Windows PowerShell:

$env:TOKENROUTER_API_KEY="sk-..."

Or authenticate interactively in pi:

/login tokenrouter

and paste the API key when prompted.

Usage

Select a model:

/model tokenrouter

or start pi directly with:

pi --provider tokenrouter --model gpt-4o

Model discovery runs at startup and is cached. If the catalog is unreachable, the cached list is used as a fallback.

Refresh the model list:

/tokenrouter-refresh

Original token-router

The router still works as a standalone Python tool. See scripts/router.py and the original docs in docs/token-router/. A Pi skill is also included under skills/token-router/.

License

MIT