← Catalog

openrouter-statusbar

Minimal one-line Pi status bar: directory, git branch, model, context bar and OpenRouter credits. One file, zero dependencies, zero config.

Extension

Install

Install with PiG

pig install npm:openrouter-statusbar

Install with Pi

pi install npm:openrouter-statusbar
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.

{
  "extensions": [
    "./extensions/openrouter-statusbar.ts"
  ]
}

README

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

openrouter-statusbar

A minimal one-line status bar for Pi. One file, zero dependencies, zero config.

../projects/my-app (main)          kimi-k2.6 · high · ━━━━━━━━━━────────── 52% · 11k/200k · $0.00/$3.41

Why this one

Most status bars show you how much you have used. This one shows how much is left — OpenRouter account credit, live from the API — right next to the context window. When you are deciding whether to start one more long turn, what's left is the number that matters.

It is also deliberately tiny: a single TypeScript file, no build step, no runtime dependencies, no configuration required. If you have logged into OpenRouter through Pi, it works immediately.

Install

pi install npm:openrouter-statusbar

Then restart Pi, or run /statusbar-openrouter to mount the bar in the current session.

What it shows

SegmentMeaning
../projects/my-appLast two path segments of the session directory
(main)Current git branch, hidden outside a repository
kimi-k2.6Model, without the provider/ prefix
highThinking level
━━━━━━━━━━ 52%Context window usage
11k/200kContext tokens used / context window
$0.00/$3.41Session cost / OpenRouter credits remaining

Colour

Quiet by default, with one accent reserved for state:

ElementColour
Everything elsedim gray #6b7280
Directorynormal foreground (the only non-dim text)
· separatorsone shade darker #4b5563
Context below 50%dim gray
Context 50–80%yellow
Context above 80%red
  • NO_COLOR (set to a non-empty value) turns all colour off.
  • Without truecolor support the bar falls back to 16-colour ANSI (90, 33, 31), which also reads correctly on 256-colour terminals.

Formatting

  • Tokens: 999, 11k, 1M, 1.5M — a decimal only below 10, and never a trailing .0.
  • Money: 3 decimals below $0.01, otherwise 2 ($0.003, $3.41).
  • Percent: whole numbers only.

Credits

The remaining balance is read from https://openrouter.ai/api/v1/credits (cached for 60 seconds, refreshed after every agent turn). The API key is taken from:

  1. the OPENROUTER_API_KEY environment variable, or
  2. Pi's own auth store (~/.pi/agent/auth.json), which is populated by /login.

The second source means there is nothing to configure: if Pi can talk to OpenRouter, the bar can show the balance. If no key is found, the balance shows as $?.

Command

CommandEffect
/statusbar-openrouterRe-mount the bar and force a credits refresh

License

MIT