Skip to content

Per-call usage log

Path: /admin/reports/ai-metering/log (Views-based, view ID ai_usage_log; permission view ai metering dashboard to view, export ai metering usage log to export).

Columns: user, timestamp, provider, operation, caller (the calling feature/context; empty shows as ), model, input tokens, output tokens, latency (ms; empty shows as "n/a"), cost in USD at 8-decimal precision, and a token_details column (hidden when empty) carrying provider-specific breakdowns such as reasoning tokens. Every numeric/date column is independently clickable to sort.

Exposed filters: Provider, Model, Caller, Filter by role, and Period (month picker). All are optional and remembered per session for authenticated users. The Provider/Model/Caller/Role selects are progressively enhanced client-side with Choices.js for a compact, searchable widget (search box appears once a field has more than 6 options); this is purely cosmetic, it operates on the existing <select> elements so the submitted query parameters and Views' own filter handling are unchanged.

Pager: 10 rows per page.

Export: a single dropbutton ("Export CSV" / "Export JSON") injected into the view header, replacing the two separate buttons the log page used to have. CSV goes through Views Data Export with batch processing (private filesystem, automatic download); JSON is served by a dedicated controller so token_details comes back as real decoded JSON rather than an HTML-encoded string. Both honor whichever filters are currently active on the page, including a contextual /log/{uid} user argument (used by the "View calls" link on Dashboard by User).