Skip to main content
GET
Account Balance
查询当前钱包余额,以及发起请求的 API Key 实际可用的额度。该接口为只读接口, 不接受查询参数。

请求

curl
接口要求在 Authorization 请求头中提供标准 AIsa API Key,不接受 MPP 支付授权。

响应

所有金额均使用整数微美元。一美元等于 1,000,000 微美元,以避免自动化客户端 出现浮点舍入误差。

顶层字段

GTM 字段

媒体赠额字段

media_promo.balance_micros_usd 仅能用于赠额批次指定的提供商,不计入通用账户余额及可用余额。next_expires_at 是最近一批赠额的到期时间,无适用时间时省略。媒体赠额为正,不代表任意 API 请求都可由其支付。

余额计算

PAYG 余额是有效 cash、Trial、promo 和 credit 余额之和。已经过期的 Trial 余额 不会计入。 go_to_market_balance_micros_usd 是 GTM 余额。该金额也会作为 gtm.balance_micros_usd 返回,gtm 对象还包含试用、订阅及可用加购余额明细。冻结的加购余额单独展示,不计入这一总额。 account_balance_micros_usd 是 PAYG 余额与 go_to_market_balance_micros_usd 之和。 对于有限额度 API Key,available_balance_micros_usd 等于 PAYG 余额与 api_key.remaining_micros_usd 中的较小值,再加上 GTM 余额。对于无限额度 API Key,它等于 PAYG 余额加 GTM 余额。当 PAYG 余额或 Key 余额为负数时,Key 可用 的 PAYG 部分最低为零。 已过期的 Trial 金额不会计入有效余额。

错误

  • 401 Unauthorized — API Key 缺失、无效、已撤销或已过期。
  • 403 Forbidden — 用户已被禁用,或当前请求 IP 不在 Key 的允许列表内。
  • 500 Internal Server Error — 无法读取余额快照。
该接口的错误响应使用字符串类型的 error 字段:
有关状态码和重试的一般说明,请参阅错误代码;有关请求 限制,请参阅速率限制。

请求规范

  • 方法与路径: GET /credits/balance
  • 请求 URL 模板: https://api.aisa.one/v1/credits/balance
完整 OpenAPI 定义 有效请求与价格声明(包括认证和引用的 schema):

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

响应

200 - application/json

Current balance snapshot.

account_balance_micros_usd
integer<int64>

Effective PAYG balance plus the GTM balance, in micro-USD.

api_key
object

Per-key limit view for the calling API key (absent for OAuth callers).

as_of
string<date-time>

Snapshot timestamp (RFC 3339, UTC).

available_balance_micros_usd
integer<int64>

PAYG balance available to the authenticated API key plus the GTM balance, in micro-USD. For a limited key this is min(PAYG balance, key remaining balance) + GTM balance.

currency
string

ISO currency code (always USD).

go_to_market_balance_micros_usd
integer<int64>

Total GTM balance in micro-USD. Equal to gtm.balance_micros_usd.

gtm
object

GTM balance details. The total includes GTM trial and subscription balances.