Usage API, team wallets, and callbacks

The public Coda API now exposes remaining credits, post-hoc run cost, Enterprise team wallets, and an optional signed usage callback.

Usage

Authenticated with the same bearer token (mcp:read or agents:run). Not available on /mcp.

  • GET /usage/credits returns remaining free and paid credits.
  • GET /usage returns the remaining balance, token totals, daily[] buckets, a teams[] breakdown, and recent runs (since / until / limit).
  • GET /usage/runs/{run_id} looks up settled cost for X-Run-Id / job_id.
  • GET /usage/threads/{thread_id} looks up cost for X-Thread-Id.
  • GET /usage/teams/{team_id} looks up cost billed to one team.

charged_credits is the 1:1 settled deduction. The public API does not expose the internal rate formula. thread_id attach is best-effort; a charge can settle with thread_id null.

Team wallets

  • Optional team_id on POST /agents and POST /qpus bills a staff-loaded Enterprise team wallet (billed_team_id).
  • Personal tokens bill the personal wallet unless team_id is set. Team service-account keys always bill their team. A mismatched team_id returns 400. There is no fallback to the personal wallet.
  • GET /teams, GET /teams/{team_id}, and GET /teams/{team_id}/members return the roster. Keys cannot be minted through the API.
  • There is no Coda project entity. Teams are the grouping axis.

Usage callbacks

Enterprise team owners can set an https:// callback under Settings → Teams → Keys → Usage callback. Coda POSTs usage.settled, usage.released, and usage.test events signed with X-Coda-Signature. The pull usage API remains the ledger.