omp packages

@alexanderfortin/pi-openrouter-usage1.0.1

Pi extension for monitoring OpenRouter credit balance and usage

GitHub Actions Published 3 days ago MIT ~0 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-openrouter-usage

Pi extension that shows your current OpenRouter credit balance and usage in the status footer.

Built with @alexanderfortin/pi-usage-lib, which handles event registration, provider matching, caching, and footer lifecycle via its createUsageExtension factory.

screenshot

Features

  • Shows remaining credits ($X.XX) next to OpenRouter: in the footer
  • Color-coded by remaining balance (accent → warning → error, configurable thresholds)
  • Caches API responses with a 30s cooldown to avoid rate-limit churn
  • Sandbox-aware auth (real key, proxy-managed sentinel, or missing key)

Installation

pi install npm:@alexanderfortin/pi-openrouter-usage

Configuration

The extension reads the API key configured for the openrouter provider in your Pi model registry. If you use OpenRouter through a proxy that manages keys, the sentinel value is respected and no auth header is sent.

Color thresholds can be customized via ~/.pi/agent/usage-lib.json:

{
  "credit": {
    "warning": 5,
    "critical": 1
  }
}

Development

pnpm install
pnpm run test   # unit tests
pnpm run check  # typecheck + lint
pnpm run build  # build dist/

License

MIT