Skip to content
中

Read the account balance

Read your XiuAI account balance and cumulative spending with six-decimal precision through the Account API.

Updated Reviewed
View Markdown

Read the current balance and cumulative spending for the account assigned to your key. Requires balance:read. If you need a key, get one in the console first.

GET /open/v1/balance

There are no request parameters.

{
  "balance": "1.48",
  "balanceExact": "1.481480",
  "usedBalance": "0.518520",
  "currency": "USD"
}
Field Type Description
balance string Current balance with two decimal places, for display
balanceExact string The same balance with six decimal places, for calculations and balance checks
usedBalance string Cumulative spending with six decimal places
currency string Currency, currently USD

balance and balanceExact represent the same funds. Do not add them together. Balances are rounded down to the stated precision. Use balanceExact for programmatic checks so that two-decimal display values do not hide small differences. An account that has never been funded or used returns a zero balance.

Amounts are decimal strings. Use Python Decimal, Java BigDecimal, or a JavaScript decimal library for calculations. Do not convert them to float, Number, or parseFloat first. A temporarily unavailable balance returns 502 upstream_unavailable; a failed read is not reported as zero.

For authentication, see the first query. Handle failures using the error and rate-limit reference.

Navigation

Enter keywords to search

↑↓ Move↵ OpenEsc Close