cost_ledger, which is written exclusively by the internal cost-record path — there are no public write endpoints. See the Paymaster guide for the cost ledger and budget model, and the Sidecar coverage section for the known limitation around agent CLI bypass.
Cost figures are
OWNER / ADMIN only, on every endpoint. The four spend endpoints here (spend/by-crew, spend/by-agent/{crewId}, spend/by-mission/{missionId}, top-spenders) answer 403 to every other role (MANAGER, MEMBER, VIEWER, GUEST); subscriptions is OWNER / ADMIN as well. An empty window returns "rows": [], never null. Other endpoints that carry a cost next to data everyone may read leave the cost out — see Who sees cost figures.All read endpoints require authentication and are workspace-scoped. The write path is exclusively internal via the LLM middleware — there are no POST endpoints on the public surface.
Endpoints
Time window parameters
Most endpoints accept the same window parameters:
Two exceptions, both visible in the responses below: top spenders applies
the lower bound only and ignores
until, and spend by mission takes no
window at all — it reports one mission’s lifetime total.
Spend by crew
range, since, and until are the query parameters
described above; the workspace is taken from the authenticated session.
Response: 200 OK
Errors:
401 no workspace; 403 caller is not OWNER / ADMIN; 500 DB error.
Spend by agent (within a crew)
Response:
200 OK
Spend by mission
missionId is required and must identify a mission in
the caller’s workspace. The request has no body. This endpoint does not accept
a time-window query because it reports the mission’s full ledger history.
Mission-scoped spend. Window-less — sums the full mission.
Response: 200 OK
first_ts / last_ts span the activity window for the mission. When no
spend has been recorded they come back as the zero time
("0001-01-01T00:00:00Z"); the other numeric fields are 0.
Errors:
Top spenders
Unlike the
spend/* endpoints, this one applies only the lower bound: it ranks
everything from since (or the start implied by range) up to now. ?until=
is parsed and discarded, and the response echoes since without until for
that reason. Send it and nothing changes.200 OK
Subscriptions
(subscription_plan, provider). Returned rows carry call counts and token totals only — no $ figure. The subscription is a flat fee paid up front, so the marginal token cost is structurally $0; rendering “$0.00” would imply the calls are free, which they are not.
Query parameters:
Response:
200 OK
Errors:
401 no workspace; 500 DB error.
Credential spend
range (including month),
since and until, as described under time windows above.
What each API key cost, from the metered ledger: one row per credential_id, highest spend first. range=month is the calendar month so far in UTC, the window a provider bills by; 1h, 24h, 7d, 30d, since and until work as on the other endpoints. Flat-rate seats are excluded (their cost is $0 by construction, see Subscriptions), and so are ledger rows with no credential attribution. OWNER or ADMIN only (403 otherwise), like the provider accounts it describes. The response carries ids and sums, never a value.
Response: 200 OK
401 no workspace; 403 below ADMIN; 500 DB error.
Internal: cost record
Internal only —
X-Internal-Token required. This is how the sidecar reports parsed LLM usage from inside a crew container. Agents cannot reach this endpoint directly; the sidecar runs as UID 1002 and holds the token. Authoritative scope (workspace / crew / agent IDs) is taken from the sidecar’s IPCConfig set at exec time, so an agent that captures the token still cannot forge cross-tenant attribution.Who sees cost figures
One rule for the whole API (#3590): workspaceOWNER and ADMIN read money amounts; MANAGER, MEMBER, VIEWER and GUEST do not.
- Cost-only endpoints answer
403(“Spend requires OWNER or ADMIN”): the spend endpoints on this page,GET /api/v1/journal/spendandGET /api/v1/metrics/timeseries?metric=cost_usd. The other metrics (issues_closed,runs_count,active_missions) stay open to members. - Mixed endpoints answer as usual with the cost fields omitted. The field is absent from the JSON, not
0and notnull, so a client cannot read “hidden” as “free”. Formatted amounts inside journalsummarytext are removed too ("$0.0040 spent on p/m"becomes"Spend recorded on p/m").
Not covered by the rule, on purpose: token counts (not money), a routine definition’s authored per-run cap
max_cost_usd (configuration), model list prices, and the instance admin console (/api/v1/admin/*, already OWNER / ADMIN / instance admin). The field list lives in internal/costvis; the role check is canReadCosts in internal/api/cost_visibility.go.