Skip to content

Get Credit Usage

GET
/api/v1/admin/credit-usage

Per-tool credit usage breakdown for the trailing window.

Args: window_hours: How many trailing hours to aggregate. tenant_id: Optional tenant filter. user: Caller context. Must be a chairman. session: Async DB session.

Returns: :class:CreditUsagePayload with one row per tool_name.

Authorizations

Parameters

Query Parameters

window_hours

Trailing window in hours (1 to 720 = 30 days).

integer
default: 24 >= 1 <= 720

Trailing window in hours (1 to 720 = 30 days).

tenant_id
Any of:
string

Optional tenant filter. When omitted, the aggregation is cross-tenant (chairman-only).

Responses

200

Successful Response

Frozen response shape for /admin/credit-usage.

object
generated_at
required
string
grand_total_credits
required
integer
grand_total_invocations
required
integer
rows
required
Array<object>

One row of the per-tool credit breakdown.

object
canonical_cost
required

Documented per-call cost from src.core.agent_tools.credit_costs. Zero when the tool is not in the canonical table (legacy / dynamically-priced).

integer
credits_consumed
required
integer
error_count
required
integer
invocation_count
required
integer
success_count
required
integer
tool_name
required
string
tenant_id
required
Any of:
string
window_hours
required
integer

422

Validation Error

object
detail
Array<object>
object
ctx
object
input
loc
required
Array
msg
required
string
type
required
string