Skip to content

Balance & keys API

Check remaining balance with your key at any time — useful for automated top-up alerts:

Balance check

curl
curl https://api.tokport.io/v1/dashboard/billing/subscription \
  -H "Authorization: Bearer $TOKPORT_API_KEY"
# -> { "object": "billing_subscription", "hard_limit_usd": 25.0, "access_until": 0, ... }

curl https://api.tokport.io/v1/dashboard/billing/usage \
  -H "Authorization: Bearer $TOKPORT_API_KEY"
# -> { "object": "list", "total_usage": 1250 }   # spend in cents (OpenAI legacy shape)

These follow OpenAI's legacy billing shape. For a key with a spending cap, hard_limit_usd is the cap (spent + remaining) and total_usage is what that key has spent, in cents; remaining = hard_limit_usd − total_usage / 100. Uncapped keys report the sentinel 100000000 and your account-wide spend. access_until is the key's expiry as a unix timestamp, 0 when it never expires. Exact balance is always on the dashboard.

Key management

Key creation and management happen in the dashboard.