Hanzo AI
OpenapiAgent

List spend

Answers what one of your org's agents has spent, in integer micro-USD.

GET /v1/agent/{ref}/spend

Addresshttps://api.hanzo.ai/v1/agent/{ref}/spend
MethodGET
Operationget_agent_by_ref_spend
AuthAuthorization: Bearer $HANZO_API_KEY

Answers what one of your org's agents has spent, in integer micro-USD.

It answers the agent's budget — cap_micro_usd per period, max_task_micro_usd per run — with what the current period has consumed, what remains, and by_component: the spend attributed to model (every completion the agent bought), computer (the runtime it was resident for) and tool. A component with no spend is absent, not zero. Every amount is an integer number of micro-USD (1,000,000 = 1);11902000is1); 11902000 is 11.902. Pass by=component to ask for the breakdown by name — it is the one grouping, and the default.

Request

2 fields.

FieldInTypeRequiredDescription
refpathstringyesRef is the agent's public id or its org-unique name.
byquerystringBy groups the answer: "component" is the only grouping today.

Response

StatusBodyMeaning
200agent.spendViewok
defaultproblem-detailsrefused

200 body — 9 fields.

FieldInTypeAlwaysDescription
by_componentbodyobjectByComponent holds only the components with spend.
by_component.*bodyinteger (int64)
cap_micro_usdbodyinteger (int64)CapMicroUSD is the total this agent may spend within one Period, as an integer number of micro-USD (1,000,000 = $1).
consumed_micro_usdbodyinteger (int64)ConsumedMicroUSD is what has been spent in the current period, in micro-USD.
max_task_micro_usdbodyinteger (int64)MaxTaskMicroUSD is the ceiling for a single run, in micro-USD.
periodbodystringPeriod is the window the cap resets on: day, week or month.
period_started_atbodyinteger (int64)PeriodStartedAt is when the current period began, as a Unix second.
refbodystringRef names the agent this spend belongs to.
remaining_micro_usdbodyinteger (int64)RemainingMicroUSD is what the cap still allows this period, in micro-USD.

Failure carries the platform error shape — see Errors.

Examples

hanzo agent spend <ref>

Agent API · All Hanzo APIs · Interactive reference

How is this guide?

On this page