Skip to main content
GET
Balance Query

Endpoint details

This endpoint takes no request parameters. Send the authorization header with each request.

1. Authentication

Send a Bearer credential in the HTTP header. Use either of the following credentials.
Authentication fails if the credential is missing, invalid, deleted, or disabled, or if the account is disabled.

2. Common response structure

Application status codes

Check code in the response body to determine whether the request succeeded.

Amount format

  • All amounts are in US dollars (USD) and are returned as strings to avoid loss of floating-point precision.
  • Balance amounts always have four decimal places, for example "986.9275".
  • Model unit prices have no zero padding, for example "40", "2.5", and "0.00075".

3. Balance query

The response structure depends on the credential. Use data.type to identify it.

3.1 Account balance with a system access token (type = account)

An enterprise sub-account can retrieve only its own balance.

3.2 Key quota with an API key (type = token)

A key with unlimited = true has no key-level quota, so balance can be negative. Use usedAmount to track key usage and the account balance to determine available funds.

4. Request examples


5. Notes

  1. Refresh interval. Balance data refreshes within about one minute. Top-ups and charges may take a short time to appear.
  2. Final charges. Use the endpoint for queries and estimates. Refer to your bill for final charges.
  3. Credential security. Keep system access tokens private because they provide access to account-wide information. To query one keyโ€™s quota, use that API key.