Usage Service
Querying and Summary
Query the current user's daily Credits and AI usage.
Usage exposes one user endpoint: GET /v1/usage/me. Identity comes from the user_token; callers cannot select another user with a parameter.
const usage = await city.service("usage").get("me", {
from: "2026-03-01",
to: "2026-03-31",
timezone: "America/Los_Angeles",
});Days are grouped as local calendar days in the supplied time zone, including daylight-saving transitions. Dates must be real YYYY-MM-DD values in ascending order, and the range cannot exceed 400 days.
Response shape
{
timezone: "America/Los_Angeles",
from: "2026-03-01",
to: "2026-03-31",
credits_per_usd: 1_000_000,
data_available_from: { credits: "2026-03-02", ai: "2026-03-02" },
summary: {
credits: { used: 2500, charge_count: 3 },
ai: { execution_count: 3, metered_request_count: 3, total_tokens: 12400 }
},
days: [/* dates with Credits or AI activity only */]
}Use days[].credits.used for product heatmaps and trends. Token and media fields explain actual AI consumption; they are not converted into Credits, and Credits cannot be used to infer them.
Each data_available_from value is the earliest local date available from that fact owner, or null when no data exists.