@robhowley/pi-openrouter

Terminal overlay for OpenRouter usage: caps, spend, burn rate, and model breakdowns.

Package details

extension

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

$ pi install npm:@robhowley/pi-openrouter
Package
@robhowley/pi-openrouter
Version
0.1.0
Published
May 5, 2026
Downloads
not available
Author
robhowley
License
unknown
Types
extension
Size
30.1 KB
Dependencies
2 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions/openrouter"
  ]
}

Security note

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

README

pi-openrouter

A Pi extension that adds an /openrouter-usage command for viewing OpenRouter spend, caps, burn rate, and model breakdowns in a terminal overlay.

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
  • Top models (7d and 30d)
  • Usage by provider (30d)
  • Usage by day (last 7 days)

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

Press q, Esc, or Ctrl+C to close the overlay.

Features

  • Ephemeral TUI overlay — doesn't clutter chat history
  • Auto-refreshing cache — data stays fresh without repeated API calls
  • Graceful degradation — works with API key only (no model breakdowns)

License

MIT