List workspace usage
The workspace’s usage rows, one per measurement, joined with their cost. Rows are ordered by id, which is assigned before a row commits, so a row can appear behind a cursor already passed: walking this listing forward can miss rows. To account usage, read the usage report instead.
GET
/v1/workspaces/{workspace_id}/usageAuthorization
AuthorizationBearer token · headerrequiredPath parameters
workspace_idstring<uuid>requiredWorkspace id
Query parameters
limitinteger<int64>min 1 · max 200
afterstring<uuid>Rows past this id in `order`'s direction: a page's `next_cursor`.
beforestring<uuid>Rows just before this id, still in `order`'s direction: a page's `prev_cursor`.
orderOrderParamNewest first when omitted.
Allowed:
ascdescstarting_atstring<date-time>Only rows accounted at or after this instant.
ending_atstring<date-time>Only rows accounted before this instant.
metadataobjectOnly rows whose metadata holds each pair, matched exactly:
`metadata[tenant_id]=t_123`. Several pairs must all hold.
Responses
200One page, newest recorded first unless order=asc.
itemsUsageEventBody[]requiredShow propertiesHide properties
Array of
UsageEventBodyaccounted_atstring<date-time>requiredThe instant the row counts toward, which `starting_at` and `ending_at`
filter on: `occurred_at`, unless the row was recorded after the usage
report had already finalized that instant.
adjustsstring<uuid> | nullrequiredThe event this one corrects.
billingUsageBillingBodyrequiredHow a row was priced. `rated`: a charge landed with it, which `cost` names.
`byok`: a call through the workspace's own model provider, which is never
charged. `unrated`: a charge was due but no rate priced it.
Stable vocabulary for v1: adding a value requires a new API version.
Allowed:
ratedbyokunratedcostinteger<int64> | nullrequiredHundred-millionths of a credit, as `balance`. Absent for a byok call
or a platform one nothing priced.
idstring<uuid>requiredmetadataobjectrequiredThe metadata of the session the row was spent in, copied when it was
recorded.
occurred_atstring<date-time>requiredrecorded_atstring<date-time>requiredresourceUsageResourceBodyrequiredWhat an event measured; `kind` names the shape.
Show propertiesHide properties
One of:
object
kindstringrequiredAllowed:
llm_tokensmodelstringrequiredmodel_call_idstring<uuid>requiredmodel_provider_idstring<uuid>requiredprovider_ownerModelProviderOwnerBodyrequiredWho owns the provider: Subako publishes a `platform` provider with its own
catalog, while a `workspace` provider is one you bound with your own key.
Allowed:
platformworkspacerun_idstring<uuid>requiredsession_idstring<uuid>requiredusageModelUsageBodyrequiredShow propertiesHide properties
One of:
object
formatstringrequiredAllowed:
anthropicusageAnthropicUsageBodyrequiredShow propertiesHide properties
cache_creation_input_tokensinteger<int64>requiredcache_read_input_tokensinteger<int64>requiredinput_tokensinteger<int64>requiredoutput_tokensinteger<int64>requiredobject
formatstringrequiredAllowed:
openai_responsesusageOpenaiResponsesUsageBodyrequiredShow propertiesHide properties
cache_write_input_tokensinteger<int64>requiredcached_input_tokensinteger<int64>requiredinput_tokensinteger<int64>requiredoutput_tokensinteger<int64>requiredreasoning_output_tokensinteger<int64>requiredobject
duration_msinteger<int64>requiredharnessstringrequiredkindstringrequiredAllowed:
harness_runtimerun_idstring<uuid>requiredsession_idstring<uuid>requiredobject
classstringrequiredduration_msinteger<int64>requiredkindstringrequiredAllowed:
sandbox_runtimesession_idstring<uuid>requiredobject
bytesinteger<int64>requiredduration_msinteger<int64>requiredkindstringrequiredAllowed:
storagesession_idstring<uuid>requiredsubjectStorageSubjectBodyrequiredWhat a storage event held.
Allowed:
archivevolumeobject
elapsed_msinteger<int64>requiredgrantstringrequiredThe grant the call went through, as the agent's config names it.
kindstringrequiredAllowed:
function_runtimerun_idstring<uuid>requiredsession_idstring<uuid>requiredtoolstringrequiredobject
bytesinteger<int64>requiredgrantstring | nullkindstringrequiredAllowed:
volume_writerun_idstring<uuid> | nullsession_idstring<uuid>requiredtoolstring | nullworkspace_idstring<uuid>requirednext_cursorstring<uuid> | nullrequiredPass back as `after` for the next page; `null` on the last page.
prev_cursorstring<uuid> | nullrequiredPass back as `before` for the previous page; `null` on the first page.
400Bad limit, cursor, order, filter, or path parameter.
errorErrorDetailrequiredWhat went wrong: a `code` to branch on and a `message` to show. The
message is written for a person and may change; the code will not.
Show propertiesHide properties
codeErrorCoderequiredThe machine-readable half of an error response, and the field a client
branches on. Closed: every error carries exactly one of these.
Allowed:
unauthorizedforbiddennot_foundinvalid_requestconflictclient_outdatedprecondition_failedtoo_many_requestsinternalmessagestringrequired401Missing, malformed, or invalid bearer token.
errorErrorDetailrequiredWhat went wrong: a `code` to branch on and a `message` to show. The
message is written for a person and may change; the code will not.
Show propertiesHide properties
codeErrorCoderequiredThe machine-readable half of an error response, and the field a client
branches on. Closed: every error carries exactly one of these.
Allowed:
unauthorizedforbiddennot_foundinvalid_requestconflictclient_outdatedprecondition_failedtoo_many_requestsinternalmessagestringrequired403Caller lacks usage.read.
errorErrorDetailrequiredWhat went wrong: a `code` to branch on and a `message` to show. The
message is written for a person and may change; the code will not.
Show propertiesHide properties
codeErrorCoderequiredThe machine-readable half of an error response, and the field a client
branches on. Closed: every error carries exactly one of these.
Allowed:
unauthorizedforbiddennot_foundinvalid_requestconflictclient_outdatedprecondition_failedtoo_many_requestsinternalmessagestringrequired404No such workspace, or the caller cannot see it. An API key sees only its own workspace.
errorErrorDetailrequiredWhat went wrong: a `code` to branch on and a `message` to show. The
message is written for a person and may change; the code will not.
Show propertiesHide properties
codeErrorCoderequiredThe machine-readable half of an error response, and the field a client
branches on. Closed: every error carries exactly one of these.
Allowed:
unauthorizedforbiddennot_foundinvalid_requestconflictclient_outdatedprecondition_failedtoo_many_requestsinternalmessagestringrequired