# Usage explorer

The records behind the totals: requests, provider aggregates and billing lines, their cost basis, and grouped views.

AI Spendbook documentation, Analysis & planning. Web page: https://www.aispendbook.com/docs/usage-explorer

The Usage explorer lists the records behind the totals. It has two views, **Records** and **Grouped**, and uses the same date range and filters as [Analytics](https://www.aispendbook.com/docs/analytics).

## Records

| Kind | What one row is |
| --- | --- |
| Requests | One API call captured by the SDK, the ingestion API or an import. Shown by default. |
| Provider aggregates | A usage total the provider reported for a time bucket, usually one day. It covers many requests. |
| Billing lines | A charge from the provider's cost report or invoice. It is a billed amount, not a request. |

- Rows are newest first, 25, 50, 100 or 200 per page. Times are UTC.
- Search matches the start of an event ID or request ID, and for requests also a customer ID or feature. Feature, customer and category filters apply to requests only.
- Environment, API key and Run filters sit in the filter bar. The choices are the 100 values with the most spend in the range; any other value, such as a run id, can be typed in. Environment and run match request telemetry only; API key also matches provider-reported usage.
- Opening a row shows its tokens, attribution and provenance, and its **Cost basis**: billed by the provider, estimated at the published list price for that day, estimated at your contract rate, an incomplete estimate when some token types had no price, or unpriced.
- Each request shows where its category came from: Tagged by your code, a Rule, AI classification, an Override, or Unclassified. Analysts and above can override the category of one request; the change is recorded in the audit log.

## Grouped

- Group by one or more of Provider, Model (the default), Customer, End user, Feature, Category, Project, Environment, API key and Run. End user can be combined with customer only; it uses calendar-month activity, ignores the other filters and has no token figures.
- Groups come a page at a time by spend (Groups 1-200 of N, with Previous and Next), with the total of every group after the page, so a month with hundreds of thousands of agent runs can be grouped.
- Each group shows spend, share, requests, average input and output tokens, cache hit rate and cost per request. The three highest-spend groups are listed first.
- A group is marked as an outlier when its cost per request is 3 times the median or more, across groups with at least 5 requests. At least 3 such groups are needed.
- Grouped spend is estimated from request telemetry, or from provider-reported usage when no telemetry exists, so it can differ from billed totals. See [reconciliation](https://www.aispendbook.com/docs/reconciliation).

## Export and access

- Both views export to CSV. A records export holds up to 50,000 rows. Exports need the Analyst role or higher.
- A grouped request reads at most 5,000,000 dimension buckets; beyond that it asks for a shorter range. Filters by run read at most 400,000 aggregate documents per request.
- The explorer is in every plan and viewers and above can read it.
