Skip to content

Balance and usage

  • Account balance: the console home page or the Wallet page.
  • Charges per request: the Logs page (/console/log). You can filter by token, model and time, and export the results.
  • Token usage and remaining quota: the list on the Tokens page.

The gateway provides two endpoints in the format of OpenAI’s legacy billing API. They accept an ordinary sk- token:

终端窗口
# Quota and expiry
curl https://api.openpalmlab.com/v1/dashboard/billing/subscription \
-H "Authorization: Bearer sk-xxxx"
# Usage
curl https://api.openpalmlab.com/v1/dashboard/billing/usage \
-H "Authorization: Bearer sk-xxxx"

/v1/dashboard/billing/subscription returns:

Field Meaning
soft_limit_usd / hard_limit_usd For a token with a quota: that token’s total quota (used + remaining). For an unlimited token: always the placeholder 100000000, which is not a balance.
access_until Token expiry as a Unix timestamp in seconds. 0 means it never expires.

/v1/dashboard/billing/usage returns:

Field Meaning
total_usage Amount used, in hundredths of a US dollar. Divide by 100 to get dollars.
Token with a quota: remaining = soft_limit_usd − total_usage / 100
Unlimited token: not available from these endpoints; check your balance in the console

Example: soft_limit_usd = 100 and total_usage = 3500 means $35 used and $65 remaining.

const base = 'https://api.openpalmlab.com';
const headers = { Authorization: `Bearer ${process.env.OPENPALMLAB_API_KEY}` };
const sub = await fetch(`${base}/v1/dashboard/billing/subscription`, { headers }).then((r) => r.json());
const usage = await fetch(`${base}/v1/dashboard/billing/usage`, { headers }).then((r) => r.json());
const total = sub.soft_limit_usd ?? sub.hard_limit_usd;
const used = (usage.total_usage ?? 0) / 100;
const unlimited = total >= 1e8;
console.log({
used,
remaining: unlimited ? null : +(total - used).toFixed(4),
unlimitedToken: unlimited,
expiresAt: sub.access_until ? new Date(sub.access_until * 1000).toISOString() : 'never',
});

When your balance drops below a threshold, the gateway sends a reminder. Choose how you are notified under Personal settings in the console.