Repository navigation
feat: move usage to a usage tab in provider settings - #151
Merged
Merged
Conversation
Settings > Providers has Setup and Usage tabs. Usage lists tokens and cost for each model across all of the account's bots, grouped by provider, plus tools that call a model of their own, with totals. GET /v1/usage sums each bot's harness usage, which covers its chat, jobs, and other conversations. The bot details sidebar no longer shows usage.
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
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
Usage moves from the bot details sidebar to a Usage tab in Settings > Providers, next to Setup. It shows tokens and cost for each model across all of the account's bots, grouped by provider with a total for each, then Tools for tools that call a model of their own. A new
GET /v1/usagereturns the figures.Why
The sidebar section showed one bot chat's lifetime usage, without its jobs. With a subscription provider such as Claude Code, which reports no cost, it was a model ID next to a token count, which looked out of place in the bot's details. Per-provider totals for the account sit naturally next to the providers that bill for them.
Evidence
bun run check: lint, format, typecheck, OpenAPI drift, and 1326 unit tests pass.usage-summary.test.tscovers summing across bots, ordering, and splittingprovider/modelIdat the first slash.usage.dom.test.tsxcovers provider grouping and totals, subscription providers without a cost, and the empty state.fallow auditand the docs build, passed.Risk and rollback
Reversibility: Reversible
Blast radius: Providers settings page, bot details panel, new
GET /v1/usage. No stored data changes.The endpoint opens the harness of every bot that has a conversation, like the sidebar's chat previews, so on accounts with many bots the first load may be slow. Totals are all-time, and a deleted bot's usage leaves with it.