Usage breakdown (Pro)
ProIncluded in $99Who and what is driving usage and what changed: ranked by member, model or feature, compared with the period before, and drillable.
On this page
Installation
Needs chatcn Pro
This command works with a Pro license, along with every Pro component.
Or start free: sign up and get three Pro components on us, with a new one every month.
Usage
import { UsageBreakdown } from "@/components/ui/chatcn/pro/usage-breakdown"
<UsageBreakdown
records={records} // { day, model, member, feature, cost, tokens, requests }, one per day and group
ranges={[7, 30, 90]}
defaultMetric="cost"
defaultDimension="member"
currency="USD"
/>Pick spend, tokens or requests and a range. Rows rank members, models or features by that metric with their share of the total, a small trend across the range and the change against the same number of days before; groups with nothing before are marked New. Click a row to look inside it: a member opens their models, a model opens its features, and each step stays as a filter chip that can be removed. It answers the follow up questions to cost-explorer, which charts spend by day. Records are summed in the browser, so pass daily rollups, not raw requests.
Examples
States
Props
| Prop | Type | Notes |
|---|---|---|
records | UsageRecord[] | { day, model, member, feature, cost, tokens, requests } |
ranges, defaultRange | number[], number | In days; default 7, 30 and 90 |
defaultMetric | "cost" | "tokens" | "requests" | |
defaultDimension | "member" | "model" | "feature" | |
now | Date | The last day of every range |
currency, locale | string | Formatting |
labels | Partial<UsageBreakdownLabels> | Every string, for translation |
Accessibility
- Metric, range and breakdown are native radio groups.
- Each row is a button named with its value, share and what clicking it shows.
- Changes read as up or down, not only as an arrow.
Motion
None.