---
title: "Get User Usage"
method: GET
path: "/api/admin/usage/{user_id}"
tags: ["admin"]
---

# Get User Usage

`GET /api/admin/usage/{user_id}`

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.

## Path parameters

- `user_id` string, required

## Response `200`

Successful Response

- AdminUsageSummary — Admin-only variant that adds aggregate LLM spend. Kept separate from the user-facing ``UsageSummary`` because we do not want to surface raw API cost back to end users via ``/account/usage``: the app is free to them, and the dollar figure is operational data for Mozilla.ai. Costs are formatted decimal strings (``"82.553261"``) to match the per-row ``LLMUsageLogItem.cost_usd`` shape and avoid float precision loss.
  - `messages` UsageBucket, required
    - `used` integer, required
    - `limit` integer, required
  - `tokens` UsageBucket, required
    - `used` integer, required
    - `limit` integer, required
  - `period_start` string, nullable, required
  - `period_cost_usd` string, required
  - `lifetime_cost_usd` string, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/mozilla-ai/apis/clawbolt.md) · [All operations](https://skmtc.net/mozilla-ai/apis/clawbolt/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mozilla-ai/clawbolt/revisions/0e52fe5f8d33/schema)
