Skip to content

Balance and usage

  • Account balance: the console home page or the Wallet page. It has paid, bonus and invite parts; see Wallet and top-ups.
  • Subscription plan quota: the My Subscriptions page (/my-subscriptions); see Subscription plans.
  • Charges per request: the Usage Logs page (/usage-logs). You can filter by token, model and time, export the results, and see whether each charge came from a subscription or the wallet. See Usage logs.
  • Token usage and remaining quota: the list on the API Keys page (/keys).

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.openpalm.ai/v1/dashboard/billing/subscription \
-H "Authorization: Bearer sk-xxxx"
# Usage
curl https://api.openpalm.ai/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.openpalm.ai';
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',
});

If you use a subscription plan, check its remaining quota, used quota and next reset time on the My Subscriptions page in the console. The two endpoints above report token quota (or the wallet balance, when the site has per-token statistics turned off) and do not include plan quota.

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