report_usage
Records a retry-safe usage heartbeat for your thread claim, logging token counts and USD charges so Maidan can enforce budgets and stop the run when limits are exceeded.
Instructions
Record one retry-safe usage heartbeat for the claim you hold on a thread: token counts, the USD charge and the prices behind it. Maidan takes the reporter from your credential and the payer from the thread's workspace, and refuses the call unless you are the active holder of claim_lease_id. usd_micros must equal the charge computed from price_snapshot and tokens. Repeating an identical report returns the first outcome without charging twice; reusing the usage_report_id with different content is a conflict. If the thread's budget (tokens, USD, turns or wall time) is now exceeded, the run stops: the claim is released, a ClaimFailed event is appended and a dead-letter entry is recorded (see list_dlq). Returns the ledger entry with the updated budget, stopped and reason. Requires thread:transition.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"thread_id": "<thread_id>",
"usage_report_id": "<usage_report_id>",
"claim_lease_id": "<claim_lease_id>",
"model": "<model>",
"tokens": "<tokens>",
"usd_micros": "<usd_micros>",
"price_snapshot": "<price_snapshot>"
},
"name": "report_usage"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | Model id the provider's response named, 1 to 255 characters after trimming. | |
| turns | No | Model turns this report adds to the thread's turn count, a non-negative integer. Default 0. | |
| tokens | Yes | Token counts for this call as {input, output, cache_read, cache_write_5m, cache_write_1h}, all required non-negative integers. input is uncached input only. A token budget counts input, output and both cache-write tiers; cache reads are priced into the charge but do not count toward a token budget. | |
| evidence | No | Optional context about the call: provider, service_tier, batch, harness, harness_version, effort, cache_key, cache_miss_reason, pack_sha256 (up to 32 SHA-256 hex digests of Maidan packs the call used) and standard_price. standard_price is allowed only for a cheaper-lane call (batch true, or service_tier batch or flex) and must price the same tokens at or above usd_micros. | |
| thread_id | Yes | UUID of the thread you hold a claim on. | |
| usd_micros | Yes | Charge for this call in micro-USD ($1 = 1000000), a non-negative integer. Must equal the sum over the five token kinds of count times rate per million, rounded up to a whole micro-dollar; a mismatch is refused. | |
| claim_lease_id | Yes | The fencing token of your active claim, from the claim response's thread.claim_lease_id. A stale or foreign token is refused. | |
| price_snapshot | Yes | Rates used for this call in micro-USD per million tokens: input_usd_micros_per_million, output_usd_micros_per_million, cache_read_usd_micros_per_million, cache_write_5m_usd_micros_per_million and cache_write_1h_usd_micros_per_million, all required non-negative integers. Maidan stores them as reporter-supplied evidence and keeps no rate card. | |
| usage_report_id | Yes | UUID you generate for this report, unique across all reports. Reuse it only to retry the exact same report. |