Hanzo
OpenapiUsage

Is the PER-PROVIDER view: one connected account's own consumption of its own…

Is the PER-PROVIDER view: one connected account's own consumption of its own plan — "my plan is 47% through its 6h window, resets at 14:20".

GET /v1/usage/samples

Addresshttps://api.hanzo.ai/v1/usage/samples
MethodGET
Operationget_usage_samples
AuthAuthorization: Bearer $HANZO_API_KEY

Is the PER-PROVIDER view: one connected account's own consumption of its own plan — "my plan is 47% through its 6h window, resets at 14:20".

current is the newest instance of each lane (the headline); windows is the history behind it. Both come from ONE deduped read, so they can never disagree. The rows are the caller's OWN linked accounts, scoped to the validated principal and its subject — never another user's, and never another org's.

Request

4 fields.

FieldInTypeRequiredDescription
accountquerystringAccount narrows to ONE linked account of that provider.
providerquerystringProvider is the upstream to read, e.g.
rangequerystringRange is the window to read: a count and a unit — 1h, 24h, 90d, any <N>h or <N>d — or day, week, month, all. Empty means 24h.
windowquerystringWindow narrows to ONE window class: 6h, day, week or month.

Response

StatusBodyMeaning
200dashRespok

200 body — 48 fields.

FieldInTypeAlwaysDescription
accountbodystringAccount is the linked account that was asked about, when one was named.
availablebodybooleanAvailable is false when the warehouse could not be read.
currentbodyusageWindowView[]Current is the newest window instance of each lane — the dash headline.
current[].accountbodystringAccount is the linked provider account the window belongs to.
current[].cachedInputTokensbodyintegerCachedInputTokens is the prompt tokens served from the provider's cache; omitted when unknown.
current[].confidencebodystringConfidence says how much the counters beside it mean — a meter that reported only a percentage leaves them at zero, and this is how a reader tells that from a…
current[].costCentsbodyintegerCostCents is what the window cost on the PROVIDER's own plan, in US cents.
current[].costLimitCentsbodyintegerCostLimitCents is the plan's spend ceiling for the window, in US cents.
current[].currencybodystringCurrency is the provider's currency when it is not US cents.
current[].inputTokensbodyintegerInputTokens is prompt tokens consumed in the window; omitted when unknown.
current[].lanebodystringLane is the meter lane this instance belongs to, e.g.
current[].machinebodystringMachine is the host whose meter reported the window.
current[].outputTokensbodyintegerOutputTokens is completion tokens produced in the window; omitted when unknown.
current[].planbodystringPlan is the subscription plan the account is on, as the provider names it.
current[].requestsbodyintegerRequests is how many requests were made in the window; omitted when the meter did not report it.
current[].resetsAtbodystringResetsAt is when this window rolls over, RFC3339 UTC; omitted when unknown.
current[].syntheticbodybooleanSynthetic marks an instance the meter inferred rather than read.
current[].totalTokensbodyintegerTotalTokens is the window's total tokens; omitted when unknown.
current[].usedPctbodynumberUsedPct is how much of the window's allowance is consumed, 0–100.
current[].windowbodystringWindow is the window class: 6h, day, week or month.
current[].windowMinutesbodyintegerWindowMinutes is the window's real length in minutes when the meter reported one; omitted when it did not.
current[].windowStartbodystringWindowStart is when this window opened, RFC3339 UTC; omitted when unknown.
frombodystringFrom is the inclusive start of that window, RFC3339 UTC.
providerbodystringProvider is the upstream that was asked about, echoed back.
rangebodystringRange is the window that was served: 1h, 24h, 7d or 30d.
scopebodystringScope says whose rows these are: the caller's own linked accounts.
sourcebodystringSource names the meter of record — the provider's own login, not Hanzo.
tobodystringTo is the exclusive end of that window, RFC3339 UTC.
windowsbodyusageWindowView[]Windows is every instance in range, newest first — the history behind it.
windows[].accountbodystringAccount is the linked provider account the window belongs to.
windows[].cachedInputTokensbodyintegerCachedInputTokens is the prompt tokens served from the provider's cache; omitted when unknown.
windows[].confidencebodystringConfidence says how much the counters beside it mean — a meter that reported only a percentage leaves them at zero, and this is how a reader tells that from a…
windows[].costCentsbodyintegerCostCents is what the window cost on the PROVIDER's own plan, in US cents.
windows[].costLimitCentsbodyintegerCostLimitCents is the plan's spend ceiling for the window, in US cents.
windows[].currencybodystringCurrency is the provider's currency when it is not US cents.
windows[].inputTokensbodyintegerInputTokens is prompt tokens consumed in the window; omitted when unknown.
windows[].lanebodystringLane is the meter lane this instance belongs to, e.g.
windows[].machinebodystringMachine is the host whose meter reported the window.
windows[].outputTokensbodyintegerOutputTokens is completion tokens produced in the window; omitted when unknown.
windows[].planbodystringPlan is the subscription plan the account is on, as the provider names it.
windows[].requestsbodyintegerRequests is how many requests were made in the window; omitted when the meter did not report it.
windows[].resetsAtbodystringResetsAt is when this window rolls over, RFC3339 UTC; omitted when unknown.
windows[].syntheticbodybooleanSynthetic marks an instance the meter inferred rather than read.
windows[].totalTokensbodyintegerTotalTokens is the window's total tokens; omitted when unknown.
windows[].usedPctbodynumberUsedPct is how much of the window's allowance is consumed, 0–100.
windows[].windowbodystringWindow is the window class: 6h, day, week or month.
windows[].windowMinutesbodyintegerWindowMinutes is the window's real length in minutes when the meter reported one; omitted when it did not.
windows[].windowStartbodystringWindowStart is when this window opened, RFC3339 UTC; omitted when unknown.

Failure carries the platform error shape — see Errors.

Examples

hanzo usage samples

Usage API · All Hanzo APIs · Interactive reference

How is this guide?

On this page