Repository navigation
Add the account Usage page to Maple Research - #1359
Merged
Merged
Conversation
Research can now read the billing usage endpoints: daily usage for a range and time zone (with the status usage window for the plan chart), recent requests with keyset paging, and the public current price list. The authenticated calls go through BillingService's per-account token and its single 401 retry; prices need no token. React Query hooks key usage per account, keep the previous range on screen while a new one loads, and stay out of the per-chat-turn status refresh. BillingStatus gains the optional usage_period_start field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Settings gains a Usage page under Plan (/settings/usage) that follows the approved design and reads real billing data for the whole account. - Plan card from subscription status: Pro and Max show the plan meter, the cumulative chart with the allowance line and a projection, the pace note and Extra credits with Buy credits; Team shows the shared pool split into you and the rest of the team; Free shows messages today against the daily limit and 14 UTC days of messages. - A range picker scopes the stat tiles, the daily chart (show credits, requests or tokens; split by model, apps and API keys, plan and Extra credits, or token type) and the per-model table. - Recent requests with Load more, current model prices, the last 12 months and notes on what the numbers include. Model colors follow identity: current flagship models have fixed slots and every other model folds into a gray "More models" series in charts, while tables list every model. Models that never report cached tokens show a dash instead of 0. Chart primitives and the data pivots live in components/settings/usage, with unit tests for the pivots, totals, folding, projection and Free UTC days, plus page state tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Maple development preview: https://af89236d.maple-ca8.pages.dev Commit: Uses development API, billing, flags and PCR configuration. Cloudflare Access applies. |
The Settings nav item and /settings/usage show only when the user's usage_page flag is on. While the flag loads the route renders nothing; when it is off or the flag service is unreachable it redirects to Billing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s 10 then 50 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
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
Adds Settings → Usage to Maple Research: one page for the whole account (Research and Maple Work on every device, plus API keys). It's built on new billing endpoints in MaplePrivacyLabs/maple-billing-server stack #144 → #147. Merge and deploy that stack first; without it the page shows its error state.
Plan card (from
/subscription/statusplus the billing window's daily credits):Usage in this range: last 30 days or any of the last 13 calendar months, in the browser's time zone.
—when a model doesn't report it.Also on the page:
—for models without a listed price.Colors follow the model, not its rank. Models without a color slot fold into a gray "More models" series in charts; tables still list each one.
Validation
bun testpass (1,068 tests). The new unit tests cover every split and metric, folding, the projection and Free UTC days./usage,/usage/requestsand/usage/pricesall return 200.month:2026-09in America/Chicago) works.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.