Fleeexdocs

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:

FieldTypeMeaning
spentMicrosnumberCharged this period, in EUR micro-units (1_000_000 = €1.00).
totalTokensnumberTotal tokens across the period's requests.
requestCountnumberNumber of billed requests.
currency"EUR"Currency of spentMicros.
periodStartstringISO 8601, first instant of the month (inclusive), UTC.
periodEndstringISO 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.