Repository navigation
Description
Summary
Add a Usage screen to bighelp that shows how much of each AI plan or balance you've used, for every AI tool on the connected Hermes computer: Claude, Codex, GitHub Copilot, OpenCode, OpenRouter, DeepSeek, Nous Portal, Google AI Studio, and any Hermes provider plugin that reports usage.
You open it from the bottom of the ☰ menu. It appears as a Liquid Glass sheet with one card per provider: plan, usage bars with reset times, balances, and a link to manage the account.
The host side is done. The bighelp plugin finds the tools on its own and does all the provider calls. The app only reads one route.
- Plugin request: Auto discover current providers and display usage in app bighelp-plugin#3 (includes the design sketch)
- Plugin work: feat: provider usage for the bighelp app (2.18.0) bighelp-plugin#63, plugin 2.18.0, feature
native-provider-usage-v1 - Full route contract:
docs/PROVIDER_USAGE.md
Why
People run several AI subscriptions and keys at once: Claude Code, Codex, Copilot, OpenRouter credits and so on. Today they check each one in a different app or website. bighelp already talks to the computer they all run on, so it can show them together in one place, on the phone.
What people see
Entry point
- A Usage row at the bottom of the ☰ menu (
BighelpMenu), below Go to and Recent.- Symbol:
gauge.with.dots.needle.50percent - Detail line: "Plans and balances on this computer"
- UI test id:
menu.usage
- Symbol:
- It's for everyone, not behind Nerd Mode.
- Don't add a second menu or a Settings copy. This is the one place.
The sheet
- Liquid Glass modal (medium and large detents, grabber visible), matching the app's existing glass surfaces (
BighelpSurface,FloatingTabBar). - Header
- Host name
- "Updated 2 min ago"
- A refresh button
- Pull to refresh
- One card per provider, in the plugin's order. The provider the current agent chats with comes first and carries an "In use by agent name" badge.
- Logo from
ProviderLogoStore, with an SF Symbol fallback. - Name, and plan as a small badge (e.g. "Pro", "Max 5x", "Enterprise").
- Windows, one bar each:
- label (e.g. "Session (5 hours)", "Week")
- percent used
- "Resets in 3 h 12 min" (relative time from
resetsAt) - optional detail line (e.g. "250,000 of 1,000,000 used")
- Bar color changes at 75% and 90% used. Use theme colors, not raw red and yellow.
- Facts: label and value rows, already formatted by the plugin (e.g. "Balance · $25.00", "Last 30 days · $42.10 · 45 sessions").
- A small "via Codex CLI / Hermes" line from
detectedVia. - "Manage" opens
manageUrlin the browser. approximate: trueadds a quiet "about" before the numbers. Copilot's CLI fallback rounds.
- Logo from
- Status cards (anything but
ok): show the plugin's plainmessageinstead of numbers.signInNeeded: e.g. "Claude Code's sign-in has expired. Open Claude Code on this computer to refresh it."notShared: e.g. Google AI Studio, "Your API key works. Google shows AI Studio usage only on its website." Keep the Manage link.error: message plus a retry.- Keep these visually lighter than working cards. Don't make them look like failures of the app.
- Empty state: "No AI tools found on host." Then a short line on what's detected: coding tools installed on the computer (Claude Code, Codex, Copilot, OpenCode, Gemini CLI) and providers set up in Hermes.
- Older plugin (feature missing from
/native/context): "Update the bighelp plugin on host to see usage." Add a button into the existing Settings › Hosts plugin update flow (HostPluginUpdateModel). - Offline or host unreachable: show the last result from this session with its age, plus the usual connection message.
Plugin contract (summary)
POST /api/plugins/loopdy/native/usage/list
- Uses the normal native headers:
If-Match(context ETag) andX-Loopdy-Request-ID. - Body:
{"agentId": "<current agent>", "refresh": false}. - Needs
native-provider-usage-v1in/native/contextfeatures.
{
"agentId": "default",
"fetchedAt": "2026-10-01T18:00:00Z",
"cached": false,
"providers": [
{
"id": "claude",
"name": "Claude",
"status": "ok",
"message": null,
"plan": "Pro",
"detectedVia": ["cli"],
"activeInHermes": true,
"windows": [
{"label": "Session (5 hours)", "usedPercent": 42.0, "resetsAt": "2026-10-01T21:00:00Z", "detail": null},
{"label": "Week", "usedPercent": 61.0, "resetsAt": "2026-10-04T09:00:00Z", "detail": null}
],
"facts": [],
"manageUrl": "https://claude.ai/settings/usage",
"approximate": false
},
{
"id": "openrouter",
"name": "OpenRouter",
"status": "ok",
"message": null,
"plan": null,
"detectedVia": ["hermes"],
"activeInHermes": false,
"windows": [],
"facts": [{"label": "Balance", "value": "$25.00"}, {"label": "Spent this month", "value": "$3.40"}],
"manageUrl": "https://openrouter.ai/settings/credits",
"approximate": false
}
]
}status:ok,signInNeeded,notSharedorerror. Treat an unknown status likeerrorwith its message.ids: stable, used for logos and test ids. Values:claude,codex,codex-hermes(only when Hermes uses a different ChatGPT account than the Codex CLI),copilot,gemini,opencode,openrouter,deepseek,nous,hermes-<provider>. Unknown ids must still render.- Times: UTC, whole seconds, ending in
Z. The defaultISO8601DateFormatterparses them. - Caching:
- The host caches for 5 minutes.
refresh: trueskips the cache, but not more than once every 15 seconds.cached: truetells you which you got.- Each provider gets up to 20 seconds. A slow one comes back as
errorwith "took too long", so the whole call finishes in about 20 seconds at most (typically 1–3 seconds).
- Response size: a few KB. Use the usual 196 KB native response cap.
- Privacy: no keys, emails or account IDs are ever in the response. Nothing needs redacting on the phone.
Implementation plan
- Route: add
.usageListto the native route table inDirectHermesNativeContext.swift.- path
usage/list, featurenative-provider-usage-v1 isMutation: false,maximumResponseBytes: 196_608
- path
- Models:
ProviderUsageSnapshot,ProviderUsageReport,ProviderUsageWindowandProviderUsageFact.- Decodable and tolerant: unknown statuses, missing optional fields, extra keys.
- Clamp
usedPercentto 0–100.
- Client and store: an
@Observablestore keyed by host and agent.- Load when the sheet opens. Refresh from the button or pull (
refresh: true). - On
412 context_changed, reload context once and retry, the same way board requests do. - Keep the last good result in memory while a refresh runs, so the sheet never flashes empty.
- Load when the sheet opens. Refresh from the button or pull (
- Menu row in
BighelpMenu, shown whenever a host is connected. The sheet handles the older-plugin case. - Sheet UI:
ProviderUsageSheetplus card and bar components in the design system, and reuse existing ones where possible.- Put large lists behind
BighelpDeferredSection, like other big screens. See "Device-only SwiftUI stack overflow" in the notes.
- Put large lists behind
- Plugin pin: once bighelp-plugin#63 is merged and released, set
BighelpNotificationPluginVersionto2.18.0andBighelpNotificationPluginRevisionto the merge commit, together with the plugin ref in.github/workflows/ios-ci.yml. - Demo data:
-use-demo-fixturesgets a usage fixture that covers every status, a Codex/Codex (Hermes) pair, an approximate Copilot card, a long plan name, 0% and 100% bars, and a missingresetsAt.
Accessibility
- Each bar is one VoiceOver element. Example: "Claude, session, 42 percent used, resets in 3 hours 12 minutes."
- Facts read as "label, value".
- Dynamic Type up to the accessibility sizes: bars stay full width and labels wrap.
- Reduce Transparency falls back to the solid surface. Increase Contrast keeps bar colors distinguishable, and color is never the only signal (the percent is always in text).
- The Manage link is announced as a link that opens outside the app.
Acceptance criteria
- Usage is at the bottom of ☰ and opens a Liquid Glass sheet.
- The current agent's provider is first and badged. Switching agents changes which one is first.
- Every
statusrenders with its message, andnotSharedorsignInNeededcards keep their Manage link. - Refresh works, shows "Updated just now", and doesn't spin forever when the host throttles (
cached: true). - Older plugin: a clear update prompt that leads into the existing update flow. No raw error text.
- Unknown provider ids and statuses render without crashing.
- Looks right on iPhone 16 Pro and Pro Max, light and dark, largest Dynamic Type, and with Reduce Transparency.
- Plugin version and revision are pinned together in Info.plist and CI.
Testing
- Unit: decoding (real 2.18.0 sample, unknown fields and statuses), percent clamping, relative reset text, sort and badge logic, and the store's retry on
context_changed. - UI (demo fixtures): open from
menu.usage, check each status card, and capture screenshots on iPhone 16 Pro and Pro Max. - Release small-stack walkthrough: the new sheet must open without the device-only stack overflow (Release build, 1 MB stack harness).
- Live: against a real host with the plugin branch. Check that numbers match each provider's own page (Claude
/usage, ChatGPT Codex usage, GitHub Copilot settings).
Known limits (host side, by design)
- Google AI Studio has no usage API for API keys, so the card only confirms the key works and links to AI Studio's usage page.
- Borrowed logins aren't refreshed. The plugin never refreshes another tool's saved sign-in: those refresh tokens rotate, so refreshing would sign the tool out. An expired Claude Code login shows "open Claude Code once" instead.
- Copilot: numbers are exact from GitHub. The Copilot CLI fallback is rounded and marked
approximate. - OpenCode: shows local spend from
opencode stats(7 and 30 days). Only OpenCode Go has plan limits.
Later (not in this issue)
- A Home Screen or Lock Screen widget with the top one or two bars.
- An optional alert when a limit passes 90%.
- A usage history chart over time (the host keeps no history today).
- Apple Watch complication.
Activity
promptclickrun commentedon Sep 28, 2026
Shipped in bighelp 2.3.0 (26) (TestFlight), with the bighelp plugin 2.18.0 (promptclickrun/bighelp-plugin#63, merged). The app pins that version and revision in Info.plist and CI together. The route contract now lives on the plugin's main branch:
docs/PROVIDER_USAGE.md.What shipped
signInNeeded,notSharedanderrorcards show the plugin's message and keep Manage. Unknown ids and statuses still render.Changed from the plan above (owner's direction)
Tested
Still for later, as listed above: widget, 90% alert, history chart, Watch.