What this key has spent, and what is left
usage answers "can I keep going?". It returns this key’s own lifetime cost, the workspace it belongs to over a window, what each store cost inside that window, and the prepaid balance that gates the next call.
Counts
One call. days sets the window for the workspace and store figures; the key’s own figure is lifetime and does not move with it.
u = mem.usage(days=7)
# {"window_days": 7, "key": {"requests": 26, "cost_cents": 1.19, …}, …}
if u["balance_cents"] <= 0:
# top up before the next write| Field | What it means |
|---|---|
| key | This key only — never a roster of the account’s other keys. since is always "lifetime". |
| workspace | The workspace this key belongs to, over the requested window. |
| stores | Per-store spend over the window, busiest first, at most 50 rows. other is the overflow bucket once an account meters more than 200 distinct stores in a day, not a real store. |
| balance_cents | Prepaid balance left on the account. Negative means overdrawn. |
| expiring_soon_cents | Of what is left, how much expires within 90 days. |
| days | Window for the workspace and store figures. 1–365, default 7. Out of range is clamped rather than refused. |
Free, like every Won call: no token charge, no per-request fee, and it skips the balance gate — an account at zero must still be able to find out why. Ten per minute for this endpoint, and 300 an hour shared across all Won calls on the account.