Skip to main content
GET
/
api
/
v1
/
usage
/
balance
Get Token Balance
curl --request GET \
  --url https://api.copass.id/api/v1/usage/balance
{
  "credits_purchased": 123,
  "credits_used": 123,
  "credits_remaining": 123,
  "currency": "USD_microcents"
}

Response

Successful Response

Balance, computed entirely from the token_credits ledger.

Phase 2+ (OpenRouter-style billing) stores amounts as USD microcents (1e-6 USD). The legacy token-denominated balance (pre-Phase-0) is rolled forward via a one-time backfill migration.

Clients should read currency to disambiguate — the field name credits_* is kept for back-compat on the wire, but the unit changed from tokens to microcents.

credits_purchased
integer
required

Sum of positive ledger rows.

credits_used
integer
required

Absolute sum of negative ledger rows.

credits_remaining
integer
required

Net balance (sum of all rows).

currency
string
default:USD_microcents

Units of the credit counters. USD_microcents = 1e-6 USD (post-Phase-2). Clients SHOULD branch on this field rather than assuming tokens.