admin
Get User Usage
Get quota usage and aggregate LLM spend for a specific user.
Existence-checks the user up-front. get_usage_summary calls get_current_quota which inserts a UsageQuota row for the user; without the check, a bogus user_id reaches that insert and 500s on the FK to users.id. 404 is the right answer for an admin endpoint queried with an unknown user.
Cost totals are scoped to the same period as the quota counters (period_cost_usd covers the current calendar month, matching messages.used / tokens.used). lifetime_cost_usd lets the admin spot a user whose monthly spend is fine but whose all-time spend is an outlier.
get/api/admin/usage/{user_id}
Path parameters
user_idstring required
Response
Successful Response