Usage summary
Show month-to-date spend, tokens, and request count for a user, with 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 | Tokens metered this period, input plus output. |
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, and since no identity resolution happens, an unconnected user reads as zeros too.
Scope, and freshness
- This app only. The summary covers the single
(app, user)your key andx-fleeex-userassert, not everything that user has spent across every app they connected. That total is theirs to see in their Fleeex account, not yours. - A call made a moment ago may not be counted yet. The read is eventually consistent, so
don't use it to decide whether the request you just made was billed. The
streaming usage chunk or the response's own
usageblock is the answer for that. Treat this as a dashboard figure, which is what it's for. - Refunds are not netted here.
spentMicrosis what was charged for AI usage this period; money moving back out of the wallet is a balance movement rather than negative usage.
Amounts are exclusive of tax, like the wallet itself. See Balance and payments. Show a user-facing invoice total from their Fleeex account rather than reconstructing one from this figure.