Skip to main content
The usage reports plugin adds a Usage Analytics admin page with sortable Models and Users tables, preset and custom date ranges, and request, token, and cost totals.

Install

Reports use paginated local reads and in-memory reduction. They do not access Drizzle or another database adapter directly, so the same implementation supports FrogBot’s SQL and MongoDB adapters.

Admin tools

The plugin extends the usage-log collection with:
  • Grouped list views
  • A Usage Analytics view with date-range filtering and models/users breakdown tables
The Usage Analytics page contains aggregated totals. To also export filtered raw usage rows as CSV, add @frogbotai/plugin-import-export yourself and point it at the usage collection:

Report API

Authenticated callers can request aggregated data directly:
groupBy accepts model, user, or day. apiKey is also accepted when @frogbotai/plugin-api-keys is installed, in any order, or when the usage collection has an apiKey relationship. Other values return 400. The endpoint allows any authenticated caller by default, matching FrogBot’s default access. Pass access to narrow it with an ordinary access function. Returning false forbids the request; returning a Where restricts the rows the report reads:
Because allow() returns an access function, the roles plugin composes here without being a dependency:

Options

Large date ranges scan every matching usage row. Add rollups only after deployment profiling demonstrates that this portable path is insufficient.