JSPM

pi-tokenrouter

1.0.5
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12
  • Score
    100M100P100Q73936F
  • License MIT

TokenRouter provider extension for pi — dynamic model discovery with OpenRouter-compatible pricing

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pi-tokenrouter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    pi-tokenrouter

    A pi provider extension for TokenRouter.

    Models are derived from TokenRouter's /v1/models list and enriched with metadata from models.dev first, then OpenRouter.

    Install

    pi install npm:pi-tokenrouter

    Or run directly:

    pi -e /path/to/pi-tokenrouter

    Authentication

    Resolve via /login, environment variable, or auth.json:

    # Option 1: Interactive login
    /login tokenrouter
    
    # Option 2: Environment variable
    export TOKENROUTER_API_KEY=sk-...
    
    # Option 3: auth.json (~/.pi/agent/auth.json)
    # "tokenrouter": { "type": "api_key", "key": "sk-..." }

    How it works

    1. Registers TokenRouter as an API-key provider, so /login tokenrouter is handled under Use an API key.
    2. Uses a checked-in snapshot generated from TokenRouter's authenticated /v1/models response.
    3. Enriches each model with metadata from models.dev when available, then falls back to OpenRouter for pricing, context window, max output tokens, reasoning support, and image support.

    License

    MIT