@kmiyh/pi-codex-plan-limits

Pi extension that shows live Codex plan usage: remaining 5h and weekly limits, reset times, and cached fallback snapshots.

Package details

extension

Install @kmiyh/pi-codex-plan-limits from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@kmiyh/pi-codex-plan-limits
Package
@kmiyh/pi-codex-plan-limits
Version
1.0.1
Published
Apr 15, 2026
Downloads
268/mo · 13/wk
Author
kmiyh
License
MIT
Types
extension
Size
91.8 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

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

README

@kmiyh/pi-codex-plan-limits

@kmiyh/pi-codex-plan-limits is a Pi extension that shows your OpenAI Codex subscription limits in Pi's footer.

It replaces the less useful subscription footer segment with:

  • 5h remaining limit
  • Weekly remaining limit
  • reset time for both windows

codex-plan-limits.jpg

Installation

pi install npm:@kmiyh/pi-codex-plan-limits

What it does

When Pi is using:

  • provider: openai-codex
  • auth mode: OAuth / subscription auth

the extension modifies the footer and shows Codex plan limits.

If Pi is using any other model, or openai-codex without subscription auth, the extension disables itself and the default Pi footer is restored.

How it works

The extension uses Pi's own auth session for openai-codex and fetches usage from OpenAI's backend:

https://chatgpt.com/backend-api/wham/usage

It does not depend on a separate Codex CLI login and does not read ~/.codex/sessions.

If a live refresh fails, it keeps the last successful snapshot fetched through Pi.

Refresh behavior

The limits are refreshed:

  • on session start
  • when the model changes
  • after turns finish
  • every 60 seconds

Event-driven refreshes are throttled to avoid excessive requests.

Local development

npm install
npm run typecheck

For testing:

pi -e ./src/index.ts

License

MIT