Hanzo
OpenapiUsage

Ingests a batch of account-usage samples — what a developer's OWN AI accounts…

Ingests a batch of account-usage samples — what a developer's OWN AI accounts have consumed of their OWN plans, metered from each provider's own login —…

POST /v1/usage

Addresshttps://api.hanzo.ai/v1/usage
MethodPOST
Operationpost_usage
AuthAuthorization: Bearer $HANZO_API_KEY

Ingests a batch of account-usage samples — what a developer's OWN AI accounts have consumed of their OWN plans, metered from each provider's own login — and appends them to the warehouse series. Answers 202.

Send either a samples array or one sample's fields at the top level. Every sample needs a provider, a machine and a known window class; an unknown window or kind is refused rather than silently rewritten, because a dash filled with a class nobody reported is worse than an error. There is no timestamp field: the server owns the observation clock, and a sample says which window it measured with windowStart or resetsAt.

It is FAIL-SOFT on storage: a warehouse outage costs a poll of history (stored:false), never a failed request. It records usage ONLY — the link registry is refreshed separately via POST /v1/link, so there is one and only one way to update an account row.

Request

43 fields, body application/json (required).

FieldInTypeRequiredDescription
accountbodystringAccount is the linked account the window was metered from.
cachedInputTokensbodyintegerCachedInputTokens is the prompt tokens the provider served from cache.
confidencebodystringConfidence says how much the counters below mean.
costCentsbodyintegerCostCents is what the window cost on the PROVIDER's own plan, in US cents.
costLimitCentsbodyintegerCostLimitCents is the plan's spend ceiling for the window, in US cents.
currencybodystringCurrency is the provider's currency when it is not US cents.
inputTokensbodyintegerInputTokens is prompt tokens consumed in the window.
kindbodystringKind is subscription or apikey.
lanebodystringLane is the meter lane within the account.
machinebodystringMachine is the host whose meter read the window.
outputTokensbodyintegerOutputTokens is completion tokens produced in the window.
planbodystringPlan is the subscription plan the account is on, as the provider names it.
providerbodystringProvider is the upstream the account belongs to, e.g.
requestsbodyintegerRequests is how many requests the window covers.
resetsAtbodystringResetsAt is when the measured window rolls over, RFC3339.
samplesbodysampleReq[]Samples is the batch form: every lane a poller measured, in one call.
samples[].accountbodystringAccount is the linked account the window was metered from.
samples[].cachedInputTokensbodyintegerCachedInputTokens is the prompt tokens the provider served from cache.
samples[].confidencebodystringConfidence says how much the counters below mean.
samples[].costCentsbodyintegerCostCents is what the window cost on the PROVIDER's own plan, in US cents.
samples[].costLimitCentsbodyintegerCostLimitCents is the plan's spend ceiling for the window, in US cents.
samples[].currencybodystringCurrency is the provider's currency when it is not US cents.
samples[].inputTokensbodyintegerInputTokens is prompt tokens consumed in the window.
samples[].kindbodystringKind is subscription or apikey.
samples[].lanebodystringLane is the meter lane within the account.
samples[].machinebodystringMachine is the host whose meter read the window.
samples[].outputTokensbodyintegerOutputTokens is completion tokens produced in the window.
samples[].planbodystringPlan is the subscription plan the account is on, as the provider names it.
samples[].providerbodystringProvider is the upstream the account belongs to, e.g.
samples[].requestsbodyintegerRequests is how many requests the window covers.
samples[].resetsAtbodystringResetsAt is when the measured window rolls over, RFC3339.
samples[].syntheticbodybooleanSynthetic marks a window the meter inferred rather than read.
samples[].totalTokensbodyintegerTotalTokens is the window's total tokens.
samples[].usedPctbodynumberUsedPct is how much of the window's allowance is consumed, 0–100.
samples[].windowbodystringWindow is the window class: 6h, day, week or month.
samples[].windowMinutesbodyintegerWindowMinutes is the window's real length in minutes, as the meter reports it.
samples[].windowStartbodystringWindowStart is when the measured window opened, RFC3339.
syntheticbodybooleanSynthetic marks a window the meter inferred rather than read.
totalTokensbodyintegerTotalTokens is the window's total tokens.
usedPctbodynumberUsedPct is how much of the window's allowance is consumed, 0–100.
windowbodystringWindow is the window class: 6h, day, week or month.
windowMinutesbodyintegerWindowMinutes is the window's real length in minutes, as the meter reports it.
windowStartbodystringWindowStart is when the measured window opened, RFC3339.

Response

StatusBodyMeaning
202reportRespaccepted

202 body — 2 fields.

FieldInTypeAlwaysDescription
acceptedbodyintegerAccepted is how many samples passed validation.
storedbodybooleanStored is whether the warehouse actually persisted them.

Failure carries the platform error shape — see Errors.

Examples

hanzo usage create

Usage API · All Hanzo APIs · Interactive reference

How is this guide?

On this page