get_usage
Return the credit balance, per-operation totals, and recent ledger. Free.
Args: recent_limit (1-200, default 50), offset (>=0, pages `recent` past the newest
rows), request_id (scope recent to that call's charges), tag + key_prefix (WP-J
fleet filters), api_key. Returns {credits, totals:{by_operation}, recent:[...]}
(each row carries key_prefix; tags in metadata).
Errors: unauthorized, invalid_request, rate_limited.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tag | No | Filter to rows carrying EXACTLY this fleet tag (exact match, not a substring). Omit for every tag. | |
| offset | No | Rows to skip before `recent` starts, for paging past the newest page. Page with offset += recent_limit, exactly like list_hooks and list_outcomes; an offset past the end is an empty `recent`, never an error. `totals` always covers all history and is never paged away. For the WHOLE ledger in one call use export_usage instead. | |
| api_key | No | API key for this call. Omit to fall back to the Authorization: Bearer / X-API-Key request header (streamable-HTTP only), then the VHGENGINE_API_KEY env var (the stdio default). No key resolvable -> unauthorized. | |
| key_prefix | No | Filter to charges made with ONE api key, identified by the 12-char prefix from list_keys (e.g. vhg_sk_ab12). Omit for every key. | |
| request_id | No | Scope `recent` to the charges of ONE earlier call: pass the request_id that call RETURNED (or its X-Request-Id header), never a freshly minted id. An id that charged nothing matches no rows and comes back as an empty `recent`, not an error. Omit for all recent charges. | |
| recent_limit | No | Max recent ledger rows to return, 1-200. Totals are unaffected by this; it only sizes `recent`. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| recent | No | Recent charge rows, newest first, sized by recent_limit. Each carries the operation, credits, key_prefix, request_id and tags in metadata. | |
| totals | No | {by_operation: {op: {calls, credits}}} over the whole account lifetime. | |
| credits | No | Current balance. | |
| unreported_hooks | No | How many bought hooks still have no outcome, i.e. how much free reward is on the table. Find them with list_hooks(unreported=true). |