Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add explicitly requested subscription-quota reporting for GitHub Copilot and OpenAI Codex, alongside the existing balance endpoints and passive rate-limit headers.
/usage quotachecks only the active model's provider. An unused configured OpenRouter key is no longer resolved or queried when Copilot is active.pify-usageand add/pify-usageas a stable alias for coexistence with another usage extension./usageremains available when unambiguous; Pi's existing duplicate-command disambiguation is documented.Authentication and request boundaries
Credentials come from Pi's public APIs; this package does not parse an auth file or maintain another credential store.
github.com→api.github.com; a GHE Cloud data-residency login on<tenant>.ghe.com→api.<tenant>.ghe.com.usage_statusdo not initiate quota requests. Explicit auth failures for the active provider are displayed rather than silently omitted.Existing OpenRouter/DeepSeek balances, local token/cost reporting and passive Anthropic subscription warnings remain supported. No dependencies or lockfile changes.
Endpoint-policy note
This intentionally extends the current balance-endpoints-only policy to subscription endpoints published in official client documentation/source:
copilot_internal/useris published asentitlementUrlin Microsoft's contributor documentation.backend-api/wham/usageis used by OpenAI's client.Publication in a client is not a stable, versioned third-party HTTP API guarantee. The separately documented Codex app-server
account/rateLimits/readinterface is not being presented as that guarantee. The README records this compatibility risk and the opt-in behavior. Opening as a draft for maintainer review of this policy extension.Validation
bun run typecheck— passed.bun test— 77 passed, 0 failed.node --test test/*.test.ts— 77 passed, 0 failed.Tests use synthetic credentials and mocked responses. They cover active-provider selection with an unused OpenRouter key, original-vs-inference token separation, public/GHE authority binding, spoofed authorities, no fallback after 403, Codex token mismatch, malformed data, cache/reset expiry, model switching and status/command coexistence through the real SDK resolver.
No authenticated quota requests or model launches are part of these tests. Windows is covered by the repository's existing CI matrix, not claimed as locally verified. No successful live-server quota result or real TUI rendering is claimed by the automated checks.