余额查询 API
查询当前 API Key 对应的普通账户余额或企业项目预算使用情况,系统根据 API Key 类型自动返回对应的数据结构。新老网关均支持,无需请求参数。
端点列表
响应字段说明 · 普通网关(gateway_type=common)
{
"success": true,
"data": {
"gateway_type": "common",
"account_balance_cny": 12.5,
"voucher_balance_cny": 2.5,
"gateway_voucher_balance_cny": 3.7,
"cash_balance_cny": 10,
"credit_limit_cny": 8,
"locked_balance_cny": 1.5
}
}| 字段 | 类型 | 说明 |
|---|---|---|
success | boolean | 查询是否成功 |
gateway_type | string | 网关类型,common 表示普通网关 |
account_balance_cny | number | 账户总余额,不包含业务专属代金券和授信额度 |
voucher_balance_cny | number | 通用代金券余额 |
gateway_voucher_balance_cny | number | Gateway 专属代金券余额 |
cash_balance_cny | number | 充值形成的人民币余额 |
credit_limit_cny | number | 当前有效授信额度 |
locked_balance_cny | number | 尚未最终扣除的待扣或预扣金额 |
所有金额字段的单位均为人民币元。
响应字段说明 · 企业网关(gateway_type=enterprise)
{
"success": true,
"data": {
"gateway_type": "enterprise",
"scope": "account_in_project",
"project_id": 65,
"ram_user_id": 222,
"budget_kind": "monthly",
"period_kind": "monthly",
"period_start": "2026-09-01T00:00:00+08:00",
"period_end": "2026-10-01T00:00:00+08:00",
"period_consumed_cny": 47.548226,
"period_limit_cny": 1000,
"remaining_percentage": 95.25,
"unlimited": false
}
}| 字段 | 类型 | 说明 |
|---|---|---|
success | boolean | 查询是否成功 |
gateway_type | string | 网关类型,enterprise 表示企业网关 |
scope | string | 统计范围,account_in_project 表示当前账号在当前项目中的消费 |
project_id | integer | 企业网关项目 ID |
ram_user_id | integer | RAM 用户 ID,0 表示主账号 |
budget_kind | string | 预算类型:daily、monthly 或 unlimited |
period_kind | string | 当前统计周期:daily 或 monthly |
period_start | string | 统计周期开始时间,使用北京时间 |
period_end | string | 统计周期结束时间,使用北京时间 |
period_consumed_cny | number | 当前周期已消费金额,单位为人民币元 |
period_limit_cny | number/null | 当前周期预算限额,单位为人民币元;不限额时为 null |
remaining_percentage | number/null | 剩余预算百分比;不限额时为 null |
unlimited | boolean | 是否不限额,true 表示没有金额预算限制 |
企业网关消费按当前账号、项目和预算周期统计,不包含 BYOK 消费。