Skip to content

feat: move usage to a usage tab in provider settings - #151

Merged
cheetahbyte merged 1 commit into
mainfrom
feat/usage-settings-tab
Nov 21, 2026
Merged

cheetahbyte merged 1 commit into
mainfrom
feat/usage-settings-tab

Conversation

@lauragarden

Copy link
Copy Markdown
Contributor

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/usage returns the figures.

GET /v1/usage
  Bots.usage
    for each bot with a conversation: runtime.usage(bot) → harness.usage()  // every conversation's pi.usage
    usageSummary(states) → { models: [{ provider, model, tokens, cost }], tools: [{ name, tokens, cost }] }  // most tokens first

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.
  • New tests: usage-summary.test.ts covers summing across bots, ordering, and splitting provider/modelId at the first slash. usage.dom.test.tsx covers provider grouping and totals, subscription providers without a cost, and the empty state.
  • Pre-push suite, including fallow audit and the docs build, passed.
  • Not verified in a browser: no screenshots.

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.

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.
@github-actions

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 8b51f6a.

@cheetahbyte
cheetahbyte merged commit 3284efa into main Nov 21, 2026
10 checks passed
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.

2 participants