Skip to content

Admin Console — Usage Statistics

Read-only endpoints for token / request analytics. All require a session; CSRF is not required (read-only).

All wall-clock fields use the Asia/Seoul (UTC+09:00) timezone for day-bucketing.

GET /api/usage/summary

Token totals for the current Seoul-day across all keys.

Response

{
  "date": "2026-04-26",
  "request_count": 12345,
  "input_tokens": 9876543,
  "output_tokens": 234567
}

GET /api/usage/total

Cumulative totals since the keys were minted (read off api_keys.total_*).

Response

{
  "request_count": 12345678,
  "input_tokens": 1234567890,
  "output_tokens": 234567890
}

GET /api/usage/daily

Per-key, per-day token usage over a configurable window.

Query params

Param Type Default Range Notes
days int 90 7..365 Days back from today (Asia/Seoul).

Response

Array of rows:

[
  {
    "date": "2026-04-25",
    "key_id": 3,
    "key_name": "claude-code-laptop",
    "request_count": 41,
    "input_tokens": 234567,
    "output_tokens": 12345
  },
  ...
]

Ordered by date DESC, key_id ASC.

GET /api/usage/history

Time-series buckets for charting.

Query params

Param Type Default Range Notes
days int 7 1..30 Window backward from now.
bucket_minutes int 5 1..1440 Bucket size in minutes.

Response

{
  "days": 7,
  "bucket_minutes": 5,
  "points": [
    {
      "bucket_start": "2026-04-26T00:05:00+09:00",
      "key_id": 3,
      "key_name": "claude-code-laptop",
      "request_count": 12,
      "input_tokens": 14567,
      "output_tokens": 932
    },
    ...
  ]
}

bucket_start is the floor of the bucket window in Seoul-local time. A key with zero traffic in a bucket is omitted (rather than emitted as zeros), so consumers must tolerate sparse series.

Notes

  • The proxy persists per-bucket counters under usage_buckets with hourly retention pruning — older granular rows are rolled up into daily_usage. There is no public endpoint to query usage_buckets directly outside of usage/history.
  • All counters are written after the upstream response closes, so in-flight requests are not represented.
  • If the upstream omitted the usage block (some streaming tool-call responses do this), only request_count is incremented.