Install
aggregate call, so the database groups and sums the usage rows and none are loaded into memory. It works the same on 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
@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:
allow() returns an access function, the roles plugin composes here without being a dependency:
Retention
Usage rows are kept indefinitely by default. Setretention to delete old rows on a schedule:
frogbot-prune-<usage collection slug>.
- Schedule. It runs at midnight daily unless you set
cron. It is scheduled on thedefaultqueue, so a jobs runner that coversdefaultprunes without extra setup. - Each run deletes rows whose
requestedAtis older thandays, 100 at a time, and fails the job if any row can’t be deleted.
retention off, or set a long window, if you need longer history.