Pi extension: remaining subscription/context usage in the status bar (Codex, Kimi, z.ai, Claude).
  • TypeScript 95%
  • JavaScript 5%
Find a file
HexC0d3rz ac2431b476 feat: show SuperGrok weekly + monthly usage for xAI OAuth
xai was falling through to context-only because subscription-left had no
Grok fetcher. Pull the same grok.com gRPC-web GetGrokCreditsConfig meter
Settings uses, plus legacy monthly build credits when present.
2026-08-08 13:39:29 -04:00
assets docs: add status-bar screenshot of the extension running 2026-07-21 01:44:03 -04:00
extensions/subscription-left feat: show SuperGrok weekly + monthly usage for xAI OAuth 2026-08-08 13:39:29 -04:00
tests feat: show SuperGrok weekly + monthly usage for xAI OAuth 2026-08-08 13:39:29 -04:00
.gitignore feat: pi-subscription-left extension (Codex, Kimi, z.ai, Claude usage in status bar) 2026-07-21 01:40:27 -04:00
LICENSE feat: pi-subscription-left extension (Codex, Kimi, z.ai, Claude usage in status bar) 2026-07-21 01:40:27 -04:00
package-lock.json Show 5h window alongside longer quota, colored independently 2026-07-25 20:39:42 -04:00
package.json feat: show SuperGrok weekly + monthly usage for xAI OAuth 2026-08-08 13:39:29 -04:00
README.md feat: show SuperGrok weekly + monthly usage for xAI OAuth 2026-08-08 13:39:29 -04:00

pi-subscription-left

A Pi extension that shows your remaining subscription / context usage in a dedicated row below the editor — colored by how much you have left, with the reset time and last-updated timestamp.

subscription-left running below the Pi editor

Supported providers

Provider Auth source (~/.pi/agent/auth.json) Usage endpoint
OpenAI Codex (ChatGPT sub) openai-codex.access chatgpt.com/backend-api/codex/usage
Kimi Coding kimi-coding.key api.kimi.com/coding/v1/usages
z.ai GLM Coding Plan zai.key api.z.ai/api/monitor/usage/quota/limit
Anthropic / Claude (OAuth sub) anthropic.access api.anthropic.com/api/oauth/usage
MiniMax minimax.key api.minimax.io/v1/token_plan/remains
xAI / Grok (OAuth sub) xai.access grok.com gRPC-web GetGrokCreditsConfig (+ monthly build credits)

For providers that expose rate-limit headers on responses (Anthropic/OpenAI API keys), the tightest window is read straight from response headers. Providers without a subscription endpoint fall back to showing context window remaining.

Behavior

  • Refreshes on session_start, model_select, after each agent response, and on a 60-second poll while a long response is streaming.
  • API fetches are throttled to once every 5 minutes per provider (the Anthropic and Codex usage endpoints rate-limit aggressively).
  • Last-known values are cached to disk (~/.pi/agent/subscription-left-cache.json) so the display survives restarts and Cloudflare challenge waves.
  • Stale-context safe: the poll timer stops itself on /reload instead of crashing Pi.

Install

This package is distributed via Forgejo (not npm). Add it to your Pi settings.json:

{
  "packages": [
    "git:forgejo.supportportal.org/hex/pi-subscription-left@main"
  ]
}

Then restart Pi or run /reload.

Commands

  • /usage-left — force a refresh (bypasses the 5-minute throttle) and show current usage.

License

MIT