ToAPIsToAPIs
Account Queries

Get account balance

Read your account data with a system access token

GET
/api/v1/account/balance

Note for users in mainland China: Please use https://toapis.cn as the API endpoint (Base URL). Replace https://toapis.com with https://toapis.cn in the examples in this document.

See Getting started for authentication, pagination, and errors.

Behavior

balance_kind=account_balance identifies the account balance; subaccount_budget identifies the subaccount's own budget, not its parent's funds. The remaining_* and used_* values share one quota snapshot. Use the returned credits_per_usd.

Authentication

Authorizationstringheaderrequired

Use Bearer YOUR_SYSTEM_ACCESS_TOKEN. Model API keys are not accepted. X-User-Id is not required.

Parameters

This endpoint accepts no path or query parameters and requires no request body.

requestExample

curl --request GET \
  --url 'https://toapis.com/api/v1/account/balance' \
  --header 'Authorization: Bearer YOUR_SYSTEM_ACCESS_TOKEN'
import requests

response = requests.get(
    "https://toapis.com/api/v1/account/balance",
    headers={"Authorization": "Bearer YOUR_SYSTEM_ACCESS_TOKEN"},
    timeout=30,
)
response.raise_for_status()
print(response.json())
const url = new URL("https://toapis.com/api/v1/account/balance");

const response = await fetch(url, {
  headers: { Authorization: "Bearer YOUR_SYSTEM_ACCESS_TOKEN" },
  signal: AbortSignal.timeout(30_000),
});

if (!response.ok) {
  throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());

Response fields

Examples use fictional data and assume credits_per_usd="100". Use the conversion rate returned by the API.

codeinteger

Numeric result code; 0 means success.

messagestring

Response message; empty on success. Error messages are localized.

dataobject

Result object for this query.

data.remaining_creditsstring

Remaining account quota in credits. Returned as a decimal string to preserve precision.

data.used_creditsstring

Used quota in credits. Returned as a decimal string to preserve precision.

data.remaining_usdstring

Remaining quota expressed in USD. Returned as a decimal string to preserve precision.

data.used_usdstring

Used quota expressed in USD. Returned as a decimal string to preserve precision.

data.credits_per_usdstring

Credits per 1 USD. Use this rate for conversion. Returned as a decimal string to preserve precision.

data.balance_kindstring

account_balance is the account balance; subaccount_budget is the subaccount budget, not its parent balance.

responseExample

{
  "code": 0,
  "message": "",
  "data": {
    "remaining_credits": "1000",
    "remaining_usd": "10",
    "used_credits": "100",
    "used_usd": "1",
    "credits_per_usd": "100",
    "balance_kind": "account_balance"
  }
}