# Usage and spend

`GET /apix/usage` returns today's counters, all-time totals, remaining quota and
a per-provider breakdown for the authenticated key:

```bash
curl "$APIX_BASE/apix/usage" -H "Authorization: Bearer $APIX_KEY"
```

Headers on a JSON reply (in streaming, use the final `: apix {...}` comment):

| Header | Meaning |
|---|---|
| `x-apix-input-tokens`, `x-apix-output-tokens`, `x-apix-total-tokens` | tokens of this request |
| `x-apix-spend-usd` | cost of this request |
| `x-apix-requests-remaining`, `x-apix-tokens-remaining`, `x-apix-spend-remaining` | quota left today |
| `x-apix-max-output-tokens` | output cap for the model |

Add `x-apix-include-spend: 1` to a JSON request to get an `apix` object in the
body with provider, model, usage and spend.

`/apix/usage` also returns the key's limits exactly as they are applied:

```json
"limits": {
  "label": "Jose",
  "allowed_models": ["*"],
  "requests_per_day": 1000,
  "tokens_per_day": 1000000,
  "spend_per_day_usd": 1,
  "max_tokens_per_request": 100000
}
```

The per-request values (`max_media_bytes_per_request`,
`max_media_units_per_request`, `max_video_seconds_per_request`) appear only when
the key sets them.
