Source: https://crabglamp.com/docs/llm-proxy/how-to/monitor-usage
Last updated: 2026-06-09
Type: how-to

You want to know how much a virtual key has spent this month, broken down by model and provider, and you want to spot anomalies.

## From the dashboard

Open `/dashboard/usage`. The page shows:

- A summary card per virtual key with the spend cap, accrued spend, and percentage used.
- A stacked bar chart of daily spend, color-coded by model.
- A date-range picker (default: current month).
- A filter dropdown for provider and for individual keys.

Click any bar segment to drill down into the day's per-request log (request count, model, total cost).

## Reporting cadence

- The proxy records spend on every request in real time.
- Usage is aggregated and reported to your invoice within a couple of minutes.
- The dashboard chart reflects spend within that window, so it can lag live usage by up to ~2 minutes.

## From the API

`GET /api/usage` (Clerk auth, defaults to the current month) drives every dashboard chart. Supported query params: `month=YYYY-MM`, `accountId={uuid}` (org context), `agentId={uuid}` (filter), `model={name}`, `voiceModel={name}`, `admin=1`. The response carries three independent axes — compute, LLM, voice — with per-day, per-agent, per-plain-VM, and per-model breakdowns:

```text
{
  compute: {
    totalCents,       // monthly compute cost in cents (continuous, not floored)
    daily: [          // one entry per day in the month
      { date, agentCents, plainVmCents, totalCents,
        agents: [{ agentId, agentName, runningCents, pausedCents, … }],
        plainVms: [{ plainVmId, plainVmName, costCents, hours }] }
    ],
    agents: [...], plainVms: [...]
  },
  llm:   { totalCents, daily: [...], agents: [...], models: [...], hasKeys },
  voice: { totalCents, totalCharacters, daily: [...], agents: [...], models: [...], hasVoiceUsage }
}
```

Every `*Cents` field is a continuous value (not floored), so the dashboard can show sub-cent precision. The amount billed to your invoice is rounded to whole cents.

## Spotting anomalies

- **Sudden spike on a previously-quiet key** — possible leaked token. Rotate immediately (see [Rotate a virtual key](/docs/llm-proxy/how-to/rotate-a-virtual-key)).
- **Spend climbing toward the cap mid-month** — raise the cap (see [Raise a spend cap](/docs/llm-proxy/how-to/raise-a-spend-cap)) or investigate which Agent is consuming.
- **Mostly-zero days followed by a single huge day** — usually a runaway script. Check the day's per-request log to identify the model and request count.
