feat: usage panel — the key's own spend in the sidebar - #13
Merged
Merged
Conversation
…at=json Closes #12; resolves #8 once the OmniRoute side (OmniRoute PRs #11190 + #11192) ships in a release. The reporter could not see their own daily/weekly spend or reset, and saw one provider at 0% with Codex and Claude absent. The server already had all of it — behind a text/plain terminal command. This adds the extension half: a 'My usage' section in the panel reading the self-service endpoint with the connection's own Bearer key. The three reachable states are rendered distinctly, because each is the honest answer to a different situation: 'usage not enabled for this key' (allowUsageCommand is off by default — an admin toggles it), 'nothing cached yet', and — on a server that predates ?format=json — the section hides rather than parse the text form. Rendering builds rows with textContent/createElement only; quota numbers come from the server and never reach innerHTML. New usage module (client + shaping + formatters mirroring the server's formatResetIn), 7 tests (71 total), README section, 41 locales.
|
atmediallc
pushed a commit
to atmediallc/OmniCopilot
that referenced
this pull request
Aug 23, 2026
…at=json (diegosouzapw#13) Closes diegosouzapw#12; resolves diegosouzapw#8 once the OmniRoute side (OmniRoute PRs #11190 + #11192) ships in a release. The reporter could not see their own daily/weekly spend or reset, and saw one provider at 0% with Codex and Claude absent. The server already had all of it — behind a text/plain terminal command. This adds the extension half: a 'My usage' section in the panel reading the self-service endpoint with the connection's own Bearer key. The three reachable states are rendered distinctly, because each is the honest answer to a different situation: 'usage not enabled for this key' (allowUsageCommand is off by default — an admin toggles it), 'nothing cached yet', and — on a server that predates ?format=json — the section hides rather than parse the text form. Rendering builds rows with textContent/createElement only; quota numbers come from the server and never reach innerHTML. New usage module (client + shaping + formatters mirroring the server's formatResetIn), 7 tests (71 total), README section, 41 locales.
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.



Closes #12. Resolves the reporter's complaint in #8 once the OmniRoute side ships — this is the
extension half and depends on those two server PRs.
The reporter's complaint
The server already had all of that — behind
GET /api/usage/om-usage, a self-service endpointany key can call with itself. But it answered
text/plain, which a UI cannot parse. The serverside is:
?format=jsonunder
providers[](Codex + Claude side by side, not one)This PR
A My usage section in the Activity Bar panel: daily/weekly spend vs limit, reset time, and
each provider connection's quota. The three normal states are surfaced, not flattened into a 0%:
allowUsageCommandis off by default — an admin toggles it. A setting, not an error.?format=json— hides rather than parse the text formSafety
textContent/createElementonly; server-supplied numbers neverreach
innerHTML.providers[]falls back to the singleprovideron a server that has #11190 but not #11192.Verification
npx vitest run— 71/71 (7 new intest/usage.test.ts).tsc --noEmitandeslintclean.Production bundle builds. Usage strings translated across all 41 locales.
Held for merge until the OmniRoute PRs land in a release — the panel degrades to hidden against
older servers, so it is safe to merge earlier, but the feature only lights up on v3.8.50+.