Skip to content
Main Site News Console

Balance Inquiry API

4ALL API provides two OpenAI-compatible query interfaces. You can use an API token to directly query the remaining quota and cumulative usage, which is convenient for setting up balance alerts or usage dashboards on the business side.

Query Quota

Terminal window
curl https://api.4allapi.com/v1/dashboard/billing/subscription \
-H "Authorization: Bearer $AIPROXY_KEY"

Example response:

{
"object": "billing_subscription",
"has_payment_method": true,
"soft_limit_usd": 25.0,
"hard_limit_usd": 25.0,
"system_hard_limit_usd": 25.0,
"access_until": 0
}
  • hard_limit_usd: the total quota available to this token (used + remaining);
  • access_until: token expiration timestamp, 0 means indefinitely valid;
  • If the token is configured with unlimited quota, this field will return a fixed large number.

Query Used Usage

Terminal window
curl https://api.4allapi.com/v1/dashboard/billing/usage \
-H "Authorization: Bearer $AIPROXY_KEY"

Example response:

{
"object": "list",
"total_usage": 123.45
}
  • The unit of total_usage is cents (0.01 USD), so 123.45 equals $1.2345;
  • Remaining quota = hard_limit_usdtotal_usage / 100.

Notes and Considerations

  • The paths without the /v1 prefix (/dashboard/billing/…) are also supported by both endpoints;
  • The numeric scope is calculated by token by default: the returned quota and usage are for the current token, not the entire account;
  • This interface is compatible with the fields of OpenAI’s official billing API, and most third-party clients that support “balance display” (such as Cherry Studio, Chatbox) can use it to display the balance directly;
  • Frequent polling is meaningless; it is recommended to query at minute-level intervals or less frequently.