pi-auch
v0.1.6
Published
Compact quota status for Codex, GitHub Copilot, and OpenCode Go in Pi's footer
Maintainers
Readme
pi-auch
Compact quota visibility for Pi's standard footer. It supports OpenAI Codex, GitHub Copilot, and OpenCode Go without sending model probes.
Install
pi install npm:pi-auchTo try it for one session without installing it:
pi -e npm:pi-auchUsage for every configured provider is shown in Pi's existing footer. Run /auch to refresh and display full provider details.
Authentication
- OpenAI Codex: uses Pi's
openai-codexOAuth login and the ChatGPTwham/usageendpoint. - GitHub Copilot: uses Pi's resolved
github-copilotauthentication to detect configuration. After Copilot is used in the session, quota/rate-limit information is read passively from its response headers. No model request is sent by pi-auch. - OpenCode Go: uses Pi's resolved
opencode-goauthentication to detect configuration. Dashboard quota requires a workspace ID and browserauthcookie because OpenCode does not expose that data through its API key.
For OpenCode Go dashboard quota, set both:
export OPENCODE_GO_WORKSPACE_ID="your-workspace-id"
export OPENCODE_GO_AUTH_COOKIE="your-auth-cookie-value"Alternatively, create $PI_CODING_AGENT_DIR/pi-auch-opencode-go.json (normally under Pi's agent directory), or point OPENCODE_GO_QUOTA_CONFIG at another file:
{
"workspaceId": "your-workspace-id",
"authCookie": "your-auth-cookie-value"
}On POSIX systems the file must be a regular file with mode 0600. The workspace ID appears in https://opencode.ai/workspace/<workspaceId>/go; obtain the auth cookie from browser developer tools. Without dashboard configuration, Go remains visible as configured and can acquire passive quota headers if OpenCode returns them.
pi-auch never opens Pi's credential files or stores provider credentials itself. Pi authentication is resolved through Pi's provider API. The optional OpenCode cookie is read only from the explicit environment/configuration above and used only for the bounded dashboard request. pi-auch does not log credentials or provider response bodies.
Behavior
Quota is fetched at session start, every 15 minutes, and on /auch. Passive provider data updates after normal model responses. Requests have deadlines and body-size limits. Concurrent refreshes are deduplicated. A transient failure keeps the last successful value marked as stale.
The OpenCode dashboard and passive-header implementation is adapted from MIT-licensed @mtrojnar/pi-usage; see THIRD_PARTY_NOTICES.md.
Development
npm install
npm run check
npm pack --dry-runRun the opt-in live smoke test from a development checkout to check the supported providers configured in the current Pi installation:
npm run smoke
# or: make smokeThe smoke test resolves authentication through Pi's ModelRuntime; it does not inspect credential
files, print authentication, or send model probes. Providers without a local subscription are
skipped. Codex performs a bounded live quota request and requires weekly percentage and reset data.
Copilot validates Pi authentication but cannot obtain passive quota until normal Copilot use returns
quota headers. OpenCode Go fetches live dashboard quota when its optional dashboard configuration is
present; otherwise it validates Pi authentication and reports configured.
