Repository navigation
feat: add showAllProviders, offerResetCredits and showAllProvidersCacheMinutes to /usage - #4
Open
postpersonality wants to merge 3 commits into
Open
postpersonality wants to merge 3 commits into
postpersonality wants to merge 3 commits into
Conversation
postpersonality
force-pushed
the
feat/usage-all-providers
branch
from
November 16, 2026 22:12
f31cd51 to
2ee49c3
Compare
added 2 commits
November 17, 2026 01:23
`/usage` reports the active provider only. A new `showAllProviders` setting in `subscription-usage.json` lists the other providers Pi is signed in to as well, each rendered as its usual block. The active provider stays first and is still forced, so its numbers are fresh; the others read the five-minute cache and share the failure backoff, so a list does not turn every `/usage` into a burst of requests. Providers without a Pi credential are skipped rather than reported as auth failures, which is what "signed in" means here. Claude has no endpoint to query, so it appears as `Waiting` once the bridge registers models in the session. The footer keeps tracking the active provider, and reset credits are still offered for the active OpenAI or Codex account only. `queryAdapterState` now returns undefined when Pi holds no credential, and the single-provider path turns that into the existing `No Pi runtime credential available` state, so nothing else changes.
`/usage` asks whether to redeem a reset credit whenever the active OpenAI or Codex account has one. The new `offerResetCredits` setting, on by default, turns that question off for people who would rather not be asked: the account section still lists how many tickets are left, and redeeming needs the setting turned back on. The prompt is skipped before any provider or status work, so nothing else about `/usage` changes.
postpersonality
force-pushed
the
feat/usage-all-providers
branch
from
November 16, 2026 22:24
c363584 to
b2aa4cd
Compare
postpersonality
marked this pull request as ready for review
November 16, 2026 22:24
The providers after the active one in `/usage` reused a fixed five-minute cache. `showAllProvidersCacheMinutes` sets that window in minutes, five by default; `0` fetches every time. The footer keeps its own five-minute refresh, so the setting only changes how stale the list may be. The cache accepts a per-read window now and keeps entries as long as the longest window anyone asks for.
postpersonality
force-pushed
the
feat/usage-all-providers
branch
from
November 16, 2026 22:35
8650996 to
e623a3e
Compare
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.
Independent of #3: based on
main, no Mistral code in the diff.Two
/usagesettings, both off the default path:showAllProviderslists the other providers Pi is signed in to.offerResetCredits(on by default) turns off the "Reset Credits: N Available" prompt.showAllProvidersCacheMinutessets how long the list reuses a provider's report, five minutes by default.showAllProviders
/usagereports the active provider only. This adds an opt-in setting that lists the other providers Pi is signed in to as well:{ "showAllProviders": true }Default stays as it is: without the setting,
/usageprints the active provider alone.offerResetCredits
/usageasks whether to redeem a reset credit whenever the active OpenAI or Codex account has one. WithofferResetCredits: falsethe question is skipped; the account section still lists how many tickets are left. The check sits before the provider and status work, so nothing else about/usagechanges.{ "offerResetCredits": false }showAllProvidersCacheMinutes
The providers after the active one reused a fixed five-minute cache.
showAllProvidersCacheMinutessets that window in minutes,5by default;0fetches every time. The footer keeps its own five-minute refresh, so the setting only changes how stale the list may be.{ "showAllProvidersCacheMinutes": 10 }Behavior
/usageinto a burst of requests.pi-claude-bridgeregisters models in the session, it appears asWaitinguntil Claude Code reports usage in that session.Implementation
src/config-core.ts: the three keys, each defaulted, project overriding global, with the same warning path asdisplayMode.src/usage.ts:queryAdapterStatereturnsundefinedwhen Pi holds no credential; the single-provider path turns that into the existingNo Pi runtime credential availablestate, so nothing else changes.showUsageappends the other providers when the setting is on.test/usage-all.test.ts: extension-level tests for the default, the list, the cache (including0), and the skip of providers without a credential.test/usage-reset-credits.test.tscovers the reset prompt with the setting on and off.test/config.test.tscovers parsing and precedence of all three keys.README.md,README.zh-CN.md: a key table in the Configuration section and the matching notes in/usageand Reset Credits.Verification
node --test test/*.test.ts: 126 pass, 1 fail. The failure istest/claude-bridge.test.ts"extension shows observed Claude usage without any request", which also fails onmainat cff2bdd (its fixture resets are in the past); this branch does not touch it.