Appearance
账户与余额
| 方法 | 路径 | 说明 |
|---|---|---|
| GET | /api/v1/user/profile | 账户信息:余额、并发上限、状态等 |
| GET | /api/v1/auth/me | 同上,另含 payment_visible(能否充值) |
| PUT | /api/v1/user | 修改资料:用户名、余额提醒、用量日报收件邮箱 |
| PUT | /api/v1/user/locale | 设置通知邮件的语言 |
| GET | /api/v1/user/platform-quotas | 各平台的消费额度与已用 |
认证方式、错误格式等通用约定见 账户 API 概览。示例里的 $BASE 是 https://www.fastaitoken.com/api/v1。
查询账户信息
GET /api/v1/user/profile
查余额最常用的接口。
bash
curl -s "$BASE/user/profile" -H "x-api-key: $ACCOUNT_KEY"返回示例(节选):
json
{
"code": 0,
"message": "success",
"data": {
"id": 10086,
"email": "[email protected]",
"username": "示例科技",
"role": "user",
"balance": 1250.5,
"frozen_balance": 0,
"total_recharged": 3000,
"concurrency": 20,
"rpm_limit": 0,
"status": "active",
"allowed_groups": [12],
"balance_notify_enabled": true,
"balance_notify_threshold": 100,
"daily_usage_report_email": "[email protected]",
"locale": "zh",
"created_at": "2026-06-01T10:20:30+08:00",
"updated_at": "2026-11-18T09:00:00+08:00"
}
}| 字段 | 类型 | 说明 |
|---|---|---|
id | int | 用户 ID |
email | string | 登录邮箱 |
username | string | 用户名 |
balance | number | 可用余额(USD) |
frozen_balance | number | 暂扣中的金额(USD):进行中的批量生图等任务先从余额里暂扣,任务结束后多退少补 |
total_recharged | number | 累计充值到账(USD) |
concurrency | int | 账户并发上限:同一时刻最多有多少个模型请求在处理 |
rpm_limit | int | 每分钟请求数上限,0 表示不限;分组自己设了上限时以分组为准 |
status | string | active 正常,disabled 已停用 |
allowed_groups | int[] | 为你开通的专属分组 ID |
balance_notify_enabled | bool | 是否开启余额不足提醒邮件 |
balance_notify_threshold | number / null | 余额低于多少(USD)时提醒;null 表示使用系统默认值 |
daily_usage_report_email | string | 用量日报的收件邮箱,空表示不接收 |
locale | string | 通知邮件语言,例如 zh、en |
created_at / updated_at | string | 注册时间 / 最后修改时间 |
返回里的其他字段(登录方式绑定情况、头像来源等)供网页使用,可以忽略。
查询当前账户(含充值入口)
GET /api/v1/auth/me
返回内容与 /user/profile 相同,另外多两个字段:
| 字段 | 类型 | 说明 |
|---|---|---|
payment_visible | bool | 当前账户能否使用在线充值 |
run_mode | string | 站点运行模式,可忽略 |
修改资料
PUT /api/v1/user
只传要改的字段,没传的字段保持不变。返回修改后的账户信息(同 /user/profile)。
| 字段 | 类型 | 说明 |
|---|---|---|
username | string | 用户名 |
avatar_url | string | 头像图片地址;传空串 "" 删除头像 |
balance_notify_enabled | bool | 余额不足提醒开关 |
balance_notify_threshold | number | 提醒阈值(USD);传 0 恢复系统默认值 |
daily_usage_report_email | string | 用量日报收件邮箱。只能是登录邮箱,或在网页上验证过的通知邮箱;传空串 "" 表示不再接收 |
只能提交上表里的字段
请求体里出现 balance、role、status、concurrency、allowed_groups 等字段会被视为提权尝试,账号立即停用(返回 403,message 为 Account disabled)。不要把查询接口的返回原样提交回来。
bash
curl -s -X PUT "$BASE/user" \
-H "x-api-key: $ACCOUNT_KEY" -H "Content-Type: application/json" \
-d '{"balance_notify_enabled": true, "balance_notify_threshold": 200}'| HTTP | reason | 说明 |
|---|---|---|
| 400 | DAILY_USAGE_REPORT_EMAIL_INVALID | 日报邮箱格式不对 |
| 400 | DAILY_USAGE_REPORT_EMAIL_NOT_VERIFIED | 日报邮箱既不是登录邮箱,也不是验证过的通知邮箱 |
| 400 | AVATAR_NOT_IMAGE | 头像地址的内容不是图片 |
设置通知语言
PUT /api/v1/user/locale
设置余额提醒、用量日报等通知邮件使用的语言。
bash
curl -s -X PUT "$BASE/user/locale" \
-H "x-api-key: $ACCOUNT_KEY" -H "Content-Type: application/json" \
-d '{"locale": "zh"}'可选 zh(中文)、en(英文)、ru(俄文)、kk(哈萨克文)、ur(乌尔都文)。成功返回 {"locale": "zh"};格式不对返回 400 USER_LOCALE_INVALID。
平台消费额度
GET /api/v1/user/platform-quotas
管理员可以按平台(如 anthropic、openai)给账户设置每天、每周、每月的消费上限。这个接口返回设了上限的平台;没有出现在列表里的平台不限。
json
{
"code": 0,
"message": "success",
"data": {
"platform_quotas": [
{
"platform": "anthropic",
"daily_usage_usd": 12.8,
"daily_limit_usd": 50,
"daily_window_resets_at": "2026-11-19T00:00:00+08:00",
"weekly_usage_usd": 80.2,
"weekly_limit_usd": null,
"weekly_window_resets_at": "2026-11-23T00:00:00+08:00",
"monthly_usage_usd": 230.5,
"monthly_limit_usd": 1000,
"monthly_window_resets_at": "2026-12-05T14:12:00+08:00"
}
]
}
}| 字段 | 说明 |
|---|---|
platform | 平台标识 |
daily_usage_usd / weekly_usage_usd / monthly_usage_usd | 当前窗口已用(USD) |
daily_limit_usd / weekly_limit_usd / monthly_limit_usd | 上限(USD),null 表示这一档不限 |
daily_window_resets_at / weekly_window_resets_at / monthly_window_resets_at | 窗口重置时间;null 表示这个窗口还没有消费 |
三个窗口的算法:日窗口按北京时间的自然日,每天 0 点重置;周窗口每周一 0 点(北京时间)重置;月窗口是滚动 30 天,从窗口内第一笔消费起算。某一档用满后,这个平台按余额计费的模型请求会被拒绝,直到该窗口重置。