pi-cliproxy-usage

Compact CLIProxyAPI account usage meters for Pi Coding Agent

Packages

Package details

extension

Install pi-cliproxy-usage from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-cliproxy-usage
Package
pi-cliproxy-usage
Version
0.3.0
Published
Aug 25, 2026
Downloads
192/mo · 24/wk
Author
villoh
License
MIT
Types
extension
Size
39.5 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

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

README

pi-cliproxy-usage

Compact CLIProxyAPI account usage meters for Pi Coding Agent.

Shows one colored line below editor per enabled account:

● Claude │ user │ S ━━━━━━━─── 70%  │  W ━━━━────── 40%
● Codex  │ user │ S ━━━━━━━━━─ 90%
● Grok   │ user │ W ━━━━━───── 50%

Percentages and filled bars show usage consumed. Colors shift green → yellow at 70% → red at 90%. Codex shows Session (5-hour window) and Weekly (7-day window), same as Claude, now that OpenAI restored the 5-hour rate limit window.

Requirements

Install

From npm:

pi install npm:pi-cliproxy-usage

After installing or updating, run /reload in Pi.

Try it without installing:

pi -e npm:pi-cliproxy-usage

Or from a local checkout, useful while developing:

pi install /absolute/path/to/pi-cliproxy-usage
# or, without installing, from this package directory:
pi -e ./index.ts

Settings

User file: <getAgentDir()>/pi-cliproxy-usage.json (normally ~/.pi/agent/pi-cliproxy-usage.json). Missing file uses defaults. Changes from interactive UI apply immediately. Settings reload on session start and /reload.

Older ~/.pi/agent/extensions/pi-cliproxy-usage/config.json files migrate automatically when canonical file does not exist.

{
  "accountsDir": "~/.cli-proxy-api",
  "refreshMinutes": 5,
  "maxVisibleAccounts": 4,
  "providers": {
    "claude": true,
    "codex": true,
    "grok": true
  },
  "accounts": {
    "claude-user@example.com.json": false
  }
}

Extension reads top-level CLIProxyAPI auth JSON files with type equal to claude, codex, or xai. Disabled auth files are skipped. Credentials stay local and are sent only to official provider usage endpoints documented by OpenUsage.

providers toggles a whole provider on or off. accounts toggles individual accounts within an enabled provider, keyed by the auth file name in accountsDir. An account missing from accounts is enabled by default. In /cliproxy-usage settings, open the "Accounts" row to see every discovered account and check/uncheck it (space to toggle, enter to confirm) instead of editing the file by hand.

Accepted values: accountsDir is a non-empty string; refreshMinutes and maxVisibleAccounts are integers of at least 1; provider and account values are booleans. Widget prioritizes errors, then accounts with highest usage, and shows an overflow row when more accounts exist. Invalid values are ignored with a warning. Unknown fields are preserved when saving.

Commands

  • /cliproxy-usage — open settings
  • /cliproxy-usage settings — interactively edit refresh interval and provider toggles
  • /cliproxy-usage config — compatibility alias for settings
  • /cliproxy-usage refresh — refresh and show detailed percentages
  • /cliproxy-usage status — show effective values, source, and settings path
  • /cliproxy-usage help — show commands and manual settings path

Token refresh is deliberately left to CLIProxyAPI. If provider returns 401/403, let CLIProxyAPI refresh account or log in again.

Support

Report bugs and request features in GitHub Issues.