Get Usage Summary
/v1/billingReturns account usage and cost summary rows for a date range.
Use this endpoint to build account-level usage reports. By default it returns a daily summary for the last 30 days.
Without member filters, results cover the currently authenticated account (the user behind the API key or JWT). Enterprise admins may pass sub_account_id or key_display to query usage for a tenant member or API key for charge allocation.
Authentication
Authorization Bearer
Send an API key (sk-...) or user JWT in the Authorization header.
Query Parameters
typeenum<string>Usage query type.
groupenum<string>Grouping granularity.
start_daystringStart day in YYYY-MM-DD format. Defaults to 30 days before today UTC.
end_daystringEnd day in YYYY-MM-DD format. Defaults to today UTC.
model_idintegerOptional internal model id filter.
pageintegerPage number, starting at 1.
page_sizeintegerPage size from 1 to 200.
sub_account_idstringOptional. Enterprise admin filter by member sub-account id (10 digits). Use @main for the enterprise admin's own usage. enterprise_admin only.
key_displaystringOptional. Enterprise admin filter by API key display (key_prefix + key_hint, e.g. sk-token360-inf-****). enterprise_admin only.
Enterprise allocation (member / API key)
- Default: normal users, enterprise members, and enterprise admins (without filters) see their own usage.
- Enterprise admin: pass
sub_account_idorkey_displayto summarize usage for one tenant member or one API key. - Mutually exclusive: do not pass
sub_account_idandkey_displaytogether. - Main account placeholder: when filtering the enterprise admin's own usage by member id, use
sub_account_id=@main. - key_display format: same as the enterprise console and audit lists —
key_prefixconcatenated withkey_hint(not the full secret).
Response
codeintegerResponse status code.
dataobject[]Usage summary rows.
data.periodstringGrouped period label.
data.hour_id_startstringStart timestamp for the group.
data.hour_id_endstringEnd timestamp for the group.
data.wallet_amountnumberAmount charged to wallet balance.
data.credit_amountnumberAmount charged to credit balance.
data.total_amountnumberTotal charged amount.
data.input_tokensstringInput token count.
data.output_tokensstringOutput token count.
data.request_numstringNumber of billed requests.
data.image_countstringGenerated image count.
data.video_secondsnumberGenerated video seconds.
data.model_idstring | nullModel id when grouped by model.
Error Handling
- 401 / unauthenticated: missing or invalid
Authorization. - INVALID_BILLING_USAGE_PAGINATION:
pageorpage_sizeis out of range. - NOT_ENTERPRISE_ADMIN: a non-enterprise-admin caller passed
sub_account_idorkey_display. - INVALID_BILLING_FILTER: both
sub_account_idandkey_displaywere provided. - Member / key not found:
sub_account_idorkey_displaycannot be resolved within the tenant.