Usage summary
Show month-to-date spend, tokens, and request count for a user — no metering of your own.
getUsageSummary() returns month-to-date usage for the configured (app, user), so
you can show "spent this month" in your own UI without building any metering.
const { spentMicros, totalTokens, requestCount, periodStart, periodEnd } =
await client.getUsageSummary();It returns a UsageSummary:
| Field | Type | Meaning |
|---|---|---|
spentMicros | number | Charged this period, in EUR micro-units (1_000_000 = €1.00). |
totalTokens | number | Total tokens across the period's requests. |
requestCount | number | Number of billed requests. |
currency | "EUR" | Currency of spentMicros. |
periodStart | string | ISO 8601, first instant of the month (inclusive), UTC. |
periodEnd | string | ISO 8601, first instant of next month (exclusive), UTC. |
The period is a half-open interval [periodStart, periodEnd) in UTC.
const spentEur = spentMicros / 1_000_000;
console.log(`Spent €${spentEur.toFixed(2)} across ${requestCount} requests`);getUsageSummary() never raises a 402 — a user with no usage this month simply
reads as zeros.