用 sk- 密钥查询所属账号的余额、套餐与账号信息。
账号余额查询 用任意有效 sk- 密钥,查询该密钥所属账号的余额(不是密钥额度)。
有什么用:脚本/工具里实时监控余额,余额不足时自动告警或停止调用;用户端展示剩余金额。
GET /v1/balance 是 /v1/me 的别名,两者完全等价。
| 项目 | 值 |
|---|---|
| 请求方法 | GET |
| 请求路径 | https://103.236.87.35/v1/mehttps://103.236.87.35/v1/balance(别名) |
| 请求头 | Authorization: Bearer <你的密钥> |
| 是否需要鉴权 | 必需 |
| 是否计费 | 不计费 |
本接口为 GET 请求,无需请求体参数,只需携带鉴权头。
curl https://103.236.87.35/v1/me \
-H "Authorization: Bearer <你的密钥>"
import requests
resp = requests.get(
"https://103.236.87.35/v1/me",
headers={"Authorization": "Bearer <你的密钥>"},
)
data = resp.json()
print("总余额(分):", data["total_balance"])
print("余额显示:", data["balance_txt"])
const resp = await fetch("https://103.236.87.35/v1/me", {
headers: { Authorization: "Bearer <你的密钥>" },
});
const data = await resp.json();
console.log("总余额(分):", data.total_balance);
{
"ok": true,
"user_id": 2,
"username": "3842605633",
"balance": 2501755,
"gift_balance": 0,
"total_balance": 2501755,
"balance_txt": "25.02",
"balance_mode": 0,
"plan_id": 1,
"plan_expires_at": "2026-09-07 13:38:17",
"created_at": "2026-09-06 09:21:25"
}
| 字段名 | 类型 | 说明 |
|---|---|---|
ok | boolean | 是否成功 |
user_id | integer | 用户 ID |
username | string | 用户名 |
balance | number | 充值余额(分,÷100 为元) |
gift_balance | number | 赠送余额(分,套餐赠送) |
total_balance | number | 总余额 = 充值 + 赠送(分) |
balance_txt | string | 显示文本:金额(元)/ ∞(无限大)/ ∞负(无限负) |
balance_mode | integer | 余额模式:0 正常 / 1 无限大不扣费 / 2 无限负允许欠费 |
plan_id | integer | 当前套餐 ID(无套餐为 0) |
plan_expires_at | string/null | 套餐到期时间;过期后赠送额度自动收回 |
created_at | string | 账号注册时间 |
注意:查询时会同步检查套餐是否过期,过期自动收回赠送额度,所以返回的余额始终准确。
{
"error": {
"message": "Invalid API key provided",
"type": "new_api_error",
"param": "",
"code": "invalid_api_key"
}
}
密钥无效 / 未携带 Token 返回 401;密钥所属账号被禁用返回 403 user_disabled。