Pi extension: remaining subscription/context usage in the status bar (Codex, Kimi, z.ai, Claude).
  • TypeScript 88.1%
  • JavaScript 11.9%
Find a file
2026-10-21 11:56:54 -04:00
.forgejo ZLAB-10: Enroll owner PRs for CI-gated auto-merge 2026-10-21 11:56:54 -04:00
assets docs: refresh extension screenshot 2026-10-02 10:00:57 -04:00
extensions/subscription-left fix: keep SuperGrok weekly meter instead of xAI rate-limit headers 2026-08-29 19:45:03 -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 docs: make installation one command 2026-10-02 10:02:37 -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

pi install git:forgejo.supportportal.org/hex/pi-subscription-left@main

Commands

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

License

MIT