JSPM

@robhowley/pi-openrouter

0.6.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 982
  • Score
    100M100P100Q86450F
  • License MIT

Live OpenRouter TUI overlays for spend, credits, key limits, burn rate, model usage, and session tagging.

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 (@robhowley/pi-openrouter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    pi-openrouter

    A Pi extension for live OpenRouter visibility: TUI overlays for spend, credits, key limits, burn rate, and model usage, plus automatic session_id tagging for dashboard grouping.

    Installation

    pi install npm:@robhowley/pi-openrouter

    Requirements

    Set one of these environment variables:

    • OPENROUTER_MANAGEMENT_KEY (preferred), provides full usage data including model breakdowns
    • OPENROUTER_API_KEY, basic usage data only
    export OPENROUTER_MANAGEMENT_KEY=sk-or-...

    Usage

    Type /openrouter-usage in Pi to open the usage overlay.

    The overlay shows:

    • Month spend vs cap with percentage
    • 7-day spend with burn rate projection
    • Today's spend from live tracked turns while Activity API data catches up
    • Top models (7d and 30d)
    • Usage by provider (30d)
    • Daily spend (30d)

    The extension refreshes data in the background every 30 seconds (with exponential backoff on errors).

    OpenRouter Usage Overlay

    Account health

    Type /openrouter-account in Pi to open the account health overlay.

    The overlay shows:

    • Credits balance
    • Total usage against available credits
    • Status by key
    • Selected key details
    • Key spend vs configured limit
    • Reset cadence
    • BYOK limit behavior
    • All visible keys, when a management key is configured

    Select a key from the list to inspect its limit, usage, reset cadence, and BYOK behavior.

    OpenRouter Account Overlay

    Session tracking

    pi-openrouter automatically tags OpenRouter requests with session_id field set to the Pi session's ID.

    View the Pi session ID with

    /session  # [uuid]

    The session can be tracked in OpenRouter's logs under the following ID:

    /openrouter-session
    
    # OpenRouter session_id
    pi:[uuid]

    This enables session-level tracking in the OpenRouter Logs → Sessions page.

    License

    MIT