Skip to content

Get what a task used and what it cost

GET
/tasks/{id}/usage

Requires: tasks.read

id
required
string

Resource ULID.

x-uai-org
string

Org scope: me or an org slug. Absent means the caller’s active/personal org. It selects the workspace used for permission checks and for most resource filters; operation-specific access rules still apply.

Successful response.

object
summary
required

The task’s AI usage, over every agent turn recorded.

object
inputTokens
required
integer
outputTokens
required
integer
cacheReadTokens
required
integer
cacheCreateTokens
required
integer
costUsd
required

The engine CLI’s estimate at API list prices: separate from Managed Engine credit debits. A subscription may cost less. Summed over the turns that reported a cost (pricedTurns); 0 when none did.

number
turns
required
integer
pricedTurns
required

Turns that reported a cost estimate. When fewer than turns, costUsd is partial.

integer
connectionTurns

Turns that ran on a custom connection. Their cost is unknown unless OpenRouter’s public list price covered every part of the turn (catalogTurns).

integer
catalogTurns

Connection turns priced from OpenRouter’s public list prices: an estimate, not OpenRouter’s charge.

integer
agents
required

The task’s AI usage grouped by persona when known, with a conservative handle-family fallback for legacy rows.

Array<object>
object
personaId
required

Historical persona provenance when known; null for ad-hoc or legacy handles.

string | null
name
required

The persona/task label, or a readable legacy-handle fallback.

string
handles
required

The grouped task-local handles, with a base handle before its numbered successors.

Array<string>
>= 1 items
onRoster
required

True when any grouped handle is still on the crew.

boolean
details
required

Per-handle engine, model, account and ungrouped usage figures.

Array<object>
>= 1 items
object
handle
required

One task-local agent handle.

string
kind
required

The handle’s engine.

string
model
required

The handle’s selected or last-reported model.

string | null
onRoster
required

Whether this handle is still on the crew.

boolean
account
required
Any of:
object
id
required
string
label
required
string
inputTokens
required
integer
outputTokens
required
integer
cacheReadTokens
required
integer
cacheCreateTokens
required
integer
costUsd
required

The engine CLI’s estimate at API list prices: separate from Managed Engine credit debits. A subscription may cost less. Summed over the turns that reported a cost (pricedTurns); 0 when none did.

number
turns
required
integer
pricedTurns
required

Turns that reported a cost estimate. When fewer than turns, costUsd is partial.

integer
connectionTurns

Turns that ran on a custom connection. Their cost is unknown unless OpenRouter’s public list price covered every part of the turn (catalogTurns).

integer
catalogTurns

Connection turns priced from OpenRouter’s public list prices: an estimate, not OpenRouter’s charge.

integer
inputTokens
required
integer
outputTokens
required
integer
cacheReadTokens
required
integer
cacheCreateTokens
required
integer
costUsd
required

The engine CLI’s estimate at API list prices: separate from Managed Engine credit debits. A subscription may cost less. Summed over the turns that reported a cost (pricedTurns); 0 when none did.

number
turns
required
integer
pricedTurns
required

Turns that reported a cost estimate. When fewer than turns, costUsd is partial.

integer
connectionTurns

Turns that ran on a custom connection. Their cost is unknown unless OpenRouter’s public list price covered every part of the turn (catalogTurns).

integer
catalogTurns

Connection turns priced from OpenRouter’s public list prices: an estimate, not OpenRouter’s charge.

integer
aiAccounts
required

The AI accounts the agents are on, and the Moondeck Managed Engine’s credit when an agent runs on it.

object
accounts
required
Array<object>
object
id
required

The AI account’s id (Connections → AI Accounts).

string
engine
required
string
label
required
string
lane
required

How it is paid for. unknown: a Claude token, which may be a subscription sign-in or an API key; Moondeck does not record which. unverified: a billing class a runner hinted, or one whose writer was not recorded.

string
Allowed values: subscription api-key unknown unverified
usage
required
Any of:

The account’s latest usage, as an engine CLI reported it while an agent ran on it. Moondeck never asks the provider itself.

object
status
required

As the engine last reported it.

string
Allowed values: allowed warning limited
state
required

As it reads now: a warning or limit whose reset time has passed is probably_reset. Without a top-level resetsAt, the windows at or above 75% used decide (every window, when none is at or above 75%): probably_reset once all of them are past their reset.

string
Allowed values: allowed warning limited probably_reset
resetsAt
required
Any of:
integer
usingOverage
required

Whether the engine says it is billing past the plan; null when it did not say.

boolean | null
windows
required
Array<object>
object
window
required

The engine’s name for the window: Claude’s five_hour, seven_day, …; Codex’s primary, secondary; Cursor’s included, api.

string
windowMinutes
required
Any of:
integer
usedPercent
required
Any of:
number
<= 100
resetsAt
required
Any of:
integer
probablyReset
required

Its reset time has passed, so the share is probably spent.

boolean
source
required
string
Allowed values: claude-rate-limit-event codex-rate-limits error-text cursor-period-usage
observedAt
required

When the engine said it, epoch ms.

integer
seenAgoMs
required

How long before this response the reading was taken.

integer
stale
required

The reading is more than a day old.

boolean
connection

A custom connection: billed as a provider key, its account limits not reported.

boolean
usageUnknown

Why usage is null when the provider does not report account limits.

string
agents
required

Handles of the agents on it: as their runner last reported, else as pinned.

Array<string>
pins
required

Agents running on it while pinned to another account (that one was benched).

Array<object>
object
agent
required
string
pinnedTo
required

The label of the account it is pinned to.

string
managed
required
Any of:
object
credit
required
Any of:

The workspace’s credit for the Moondeck Managed Engine, which tasks fall back to.

object
balanceCents
required

Credit left, in minor units of currency.

integer
currency
required

The workspace’s billing currency, lowercase ISO 4217.

string
agents
required
Array<string>
notReportedYet
required

Agents whose account Moondeck has not heard of yet.

Array<string>
cloudAccountsApplicable
required

Whether this task’s runner leases the cloud AI-account list. False means it uses its own signed-in accounts: subscriptions only then refuses the Managed Engine and does not control those logins.

boolean
runnerNotice
required
Any of:
object
lead
required

Why no AI account can run on this task’s runner.

string
message
required

The whole notice as plain text.

string
creditNote
required

Set when the workspace’s Managed Engine credit is spent too, so not even it can run here: add credit in Billing.

string | null
runner
required
object
hostId
required
string
name
required
string
status
required

Update: the runner predates cloud AI accounts. waiting: it reports where its switch stands and what stops it. unreported: it has not switched and is too old to say why.

string
Allowed values: update waiting unreported
headline
required
string
why
required
string | null
details
required
Array<string>
composeProjects
required
Any of:
object
names
required
Array<string>
total
required
integer
command
required

A command to run on the runner that clears what stops it, or shows why.

string | null
since
required
Any of:
integer
machine
required
Any of:
object
currency
required
string
computeCents
required

Credits debited while the task’s machine ran, in minor units.

integer
parkedStorageCents
required

Credits debited while it was parked, in minor units.

integer
aiUsageCents

Token-meter ledger attribution, approximate due to workspace-wide cent carry; retained for older clients.

integer
webSearchCents

Web-search ledger attribution, approximate due to workspace-wide cent carry; retained for older clients.

integer
webSearchRequests

Search count from cent-crossing ledger rows; approximate and retained for older clients.

integer
legacyInference

Only ledger debits without a per-call record: approximate attribution before the recording cutover or from an old gateway.

object
aiUsageCents
required
integer
webSearchCents
required
integer
webSearchRequests
required
integer
exactInference

Exact per-call task costs and search count since recording began, including fractional-cent calls without ledger rows.

object
tokenCostMicrocents
required
integer
searchCostMicrocents
required
integer
webSearchRequests
required
integer

UNAUTHORIZED — missing or invalid token, or an org-scoped API key (only user-scoped keys are accepted).

object
error
required
object
code
required

Stable, machine-readable error code

string
message
required

Human-readable explanation

string
details
permission

Present on 403 — the permission the caller lacked

string
feature

Present on 402 — gated feature

string
limit

Present on 402 — the plan’s cap

number
plan

Present on 402 — the current plan

string
seats

Present on 402 when the cap is seat-derived

object
seats
required

Effective seats the cap was computed from

integer
seatsMax
required
Any of:
integer
perSeat
required

Units of the resource each seat carries

number
key
additional properties
any

PLAN_LIMIT — the workspace’s plan does not include API access. Every API-key call can return this; session-token calls never do.

object
error
required
object
code
required

Stable, machine-readable error code

string
message
required

Human-readable explanation

string
details
permission

Present on 403 — the permission the caller lacked

string
feature

Present on 402 — gated feature

string
limit

Present on 402 — the plan’s cap

number
plan

Present on 402 — the current plan

string
seats

Present on 402 when the cap is seat-derived

object
seats
required

Effective seats the cap was computed from

integer
seatsMax
required
Any of:
integer
perSeat
required

Units of the resource each seat carries

number
key
additional properties
any

FORBIDDEN (lacking the required permission) or SCOPE_REQUIRED (no workspace, or a membership change in progress).

object
error
required
object
code
required

Stable, machine-readable error code

string
message
required

Human-readable explanation

string
details
permission

Present on 403 — the permission the caller lacked

string
feature

Present on 402 — gated feature

string
limit

Present on 402 — the plan’s cap

number
plan

Present on 402 — the current plan

string
seats

Present on 402 when the cap is seat-derived

object
seats
required

Effective seats the cap was computed from

integer
seatsMax
required
Any of:
integer
perSeat
required

Units of the resource each seat carries

number
key
additional properties
any

SCOPE_REQUIRED — the x-uai-org scope names a workspace that does not exist, or one the caller is not a member of. The two are deliberately indistinguishable: a 403 would confirm the workspace exists.

object
error
required
object
code
required

Stable, machine-readable error code

string
message
required

Human-readable explanation

string
details
permission

Present on 403 — the permission the caller lacked

string
feature

Present on 402 — gated feature

string
limit

Present on 402 — the plan’s cap

number
plan

Present on 402 — the current plan

string
seats

Present on 402 when the cap is seat-derived

object
seats
required

Effective seats the cap was computed from

integer
seatsMax
required
Any of:
integer
perSeat
required

Units of the resource each seat carries

number
key
additional properties
any

SCOPE_REQUIRED — membership reconciliation required, or membership verification unavailable.

object
error
required
object
code
required

Stable, machine-readable error code

string
message
required

Human-readable explanation

string
details
permission

Present on 403 — the permission the caller lacked

string
feature

Present on 402 — gated feature

string
limit

Present on 402 — the plan’s cap

number
plan

Present on 402 — the current plan

string
seats

Present on 402 when the cap is seat-derived

object
seats
required

Effective seats the cap was computed from

integer
seatsMax
required
Any of:
integer
perSeat
required

Units of the resource each seat carries

number
key
additional properties
any