pi-usage-lite1.0.0
A minimal Pi Coding Agent extension that shows Claude, Codex, Kimi, and OpenCode Zen usage limits in a row below the editor.
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.
Reports 0
No reports yet.
Readme
pi-usage-lite
A minimal, dependency-free Pi Coding Agent extension that keeps selected provider usage and quota information visible in a dedicated row below the editor.
claude claude-sonnet-4-5 · 5h [██░░░░░░] 23% ↻2h14m · wk [█░░░░░░░] 12% ↻4d3h
The extension is intentionally small: one TypeScript file, no runtime package dependencies, automatic display refreshes, and two commands.
Packages: Pi package · npm package
Install
Install the latest release from npm using Pi:
pi install npm:pi-usage-lite
Then restart Pi or run:
/reload
To pin a specific version, use an exact npm version:
pi install npm:pi-usage-lite@1.0.0
Features
- Shows usage in its own row below Pi's editor for the active model provider, keeping it separate from other extensions' footer statuses without replacing Pi's footer.
- Refreshes when a session starts, when the model changes, after each agent run, and every 60 seconds.
- Keeps the last known values visible when a later refresh fails.
- Provides
/usageto refresh the active provider. - Provides
/usage-allto show usage for every supported provider currently connected to Pi.
Supported providers
| Provider | Information shown |
|---|---|
| Kimi for Coding | Five-hour and weekly plan windows |
| OpenAI Codex | Available rate-limit windows and reset times |
| Claude Code Bridge | Five-hour, weekly, Opus, Sonnet, and extra-usage information when available |
| OpenCode Zen | Numeric credit balance and spending information |
The row shows the active model's provider. Example rows for each provider:
kimi kimi-k2 · 5h [███░░░░░] 42% ↻2h30m · wk [█░░░░░░░] 10% ↻3d0h
codex gpt-5.5 · 5h [██░░░░░░] 23% ↻2h14m · wk [█████░░░] 62% ↻4d3h
claude claude-sonnet-4-5 · 5h [██░░░░░░] 23% ↻2h14m · wk [█░░░░░░░] 12% ↻4d3h · extra 12.50/50.00 USD
zen grok-code · 75.00/100.00 credits · 25% used
Quota-window providers use the same display style: window label, usage bar, used percentage, and time until the window resets (↻). OpenCode Zen remains numeric because it is credit-based rather than quota-based.
Provider data is shown only when Pi has compatible credentials configured.
Commands
/usage
Refreshes the usage row for the currently selected model's provider.
/usage-all
Checks every supported provider that appears connected and displays the available usage information in a notification.
OpenCode Zen dashboard fallback
The extension first tries OpenCode's official credits API using Pi's configured opencode provider credentials. Credit information is displayed numerically, without a quota bar.
If that API is unavailable, it can use an optional dashboard configuration. Create this file only if you need the fallback:
~/.pi/agent/usage-zen.json
Example shape:
{
"workspaceId": "your-workspace-id",
"authCookie": "your-open-code-auth-cookie"
}
The authCookie is a sensitive credential. Keep the file private:
chmod 600 ~/.pi/agent/usage-zen.json
Do not commit this file. It is listed in this repository's .gitignore in case it is accidentally copied into a checkout.
You can also provide the fallback configuration through environment variables:
export OPENCODE_ZEN_WORKSPACE_ID="your-workspace-id"
export OPENCODE_ZEN_AUTH_COOKIE="your-open-code-auth-cookie"
Security and privacy
- This repository does not contain provider API keys, OAuth tokens, cookies, or workspace credentials.
- At runtime, the extension reads credentials from Pi's provider authentication, supported environment variables, Claude Code's OAuth configuration, or the optional local configuration files described above.
- Credentials are used only to request usage information from their corresponding provider endpoints.
- Like every Pi extension, this extension runs with your operating-system user permissions. Review the source before installing it.
- The OpenCode dashboard fallback relies on web-session cookies and undocumented page/server behavior. It is more fragile than the official credits API and may stop working after an OpenCode deployment.
Compatibility notes
- The extension registers
/usage. Do not load it alongside another extension that registers the same command. - Usage endpoints and response formats are provider-controlled, and some are undocumented. They may change without notice.
- The usage row displays the last successful value if a refresh fails, so values can be stale until the next successful refresh.
- The extension uses Pi's widget API below the editor and does not replace Pi's built-in footer renderer.
- This project is not affiliated with Pi, OpenAI, Anthropic, Moonshot AI, Kimi, or OpenCode.
Development
The extension source is src/index.ts.
Useful local commands:
# Install development dependencies
bun install
# Typecheck the extension and tests
bun run typecheck
# Run the tests
bun run test
# Try the package locally
pi -e .
# Inspect the extension source
${EDITOR:-nano} src/index.ts
There is no build step for users; Pi loads the TypeScript source through Jiti. Development dependencies are used only for local typechecking, tests, and release validation.
The tests in tests/ load the extension into a fake Pi session with mocked provider responses. They run sandboxed: credential and config paths point at a temporary directory, and real network requests are blocked.