Skip to content

Add the account Usage page to Maple Research - #1359

Merged
AnthonyRonning merged 7 commits into
masterfrom
usage/research-page
Nov 2, 2026
Merged

AnthonyRonning merged 7 commits into
masterfrom
usage/research-page

Conversation

@AnthonyRonning

@AnthonyRonning AnthonyRonning commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

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/status plus the billing window's daily credits):

  • Pro and Max: a meter, a cumulative chart with the allowance line and a projection, a pace note, and the Extra credits balance with Buy credits.
  • Team: the pool, split into You and the rest of the team.
  • Free: messages today against the daily limit, plus a 14-day chart in UTC days, because the limit resets at midnight UTC.

Usage in this range: last 30 days or any of the last 13 calendar months, in the browser's time zone.

  • Totals: credits, requests, Maple apps vs API keys, Extra credits used, and tokens split into input, cached input and output.
  • Daily chart: Show credits, requests or tokens; Split by model, apps/API, plan/extra, or token type. The controls sit in the chart's header.
  • By model table: every model that ran, including background requests, with the token split. Cached input shows — when a model doesn't report it.

Also on the page:

  • Recent requests, with Load more.
  • Current model prices: shows — for models without a listed price.
  • The last 12 months.
  • An "About these numbers" section: background requests, Auto/Quick/Powerful, cached input, current vs historical prices, and what doesn't use credits.

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

  • Format, lint, typecheck and bun test pass (1,068 tests). The new unit tests cover every split and metric, folding, the projection and Free UTC days.
  • End to end on a local mde stack: billing on the fix: clear dismissal flags when manually checking for updates #147 stack, with synthetic usage seeded for the Pro and Free fixtures.
    • Status, /usage, /usage/requests and /usage/prices all return 200.
    • Switching range (month:2026-09 in America/Chicago) works.
    • Load more goes from 50 to 100 rows.
    • The Tokens view shows the Token type split.
    • Light, dark and 390 px layouts render, with no console errors.
  • Not covered: the Tauri desktop and iOS builds; a real Team account (no local fixture); hosted Dev and Prod.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

AnthonyRonning and others added 4 commits October 29, 2026 00:54
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>
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Maple development preview: https://af89236d.maple-ca8.pages.dev

Commit: bdc4f4e85c98842dc442e394028503c1dd27cd42

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>
@AnthonyRonning
AnthonyRonning marked this pull request as ready for review November 2, 2026 03:42
@AnthonyRonning
AnthonyRonning merged commit 88ef58d into master Nov 2, 2026
22 checks passed
@AnthonyRonning
AnthonyRonning deleted the usage/research-page branch November 2, 2026 03:42

This branch was successfully deployed

1 active deployment
pages-pr-1359 — bdc4f4e8 Deployed Nov 2, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant