請求頭
| 請求頭 | 必填 | 說明 |
|---|---|---|
Authorization | ✓ | Bearer YOUR_ACCESS_TOKEN,帳號訪問令牌(控制台登入態,非 sk- API Key) |
Content-Type | ✓ | application/json |
POST /api/token/
建立一個新的 API Key。Key 由服務端生成,不在回應中回傳——需在控制台一次性複製保存。
請求體
| 欄位 | 必填 | 類型 | 說明 |
|---|---|---|---|
name | ✓ | string | Token 名稱(≤ 50 字符) |
expired_time | ✓ | integer | 過期時間 Unix 秒;-1 表示永不過期 |
remain_quota | ✓ | integer | 初始額度(quota);無限額度時配合 unlimited_quota: true |
unlimited_quota | ✓ | boolean | 是否不限額度 |
model_limits_enabled | boolean | 是否啟用模型白名單 | |
model_limits | string | 模型白名單(逗號分隔,空串不限制) | |
allow_ips | string | null | IP 白名單(空串 / null 不限制) | |
group | string | 分組,取自 GET /api/user/self/groups 的鍵;空串表示不指定 | |
cross_group_retry | boolean | 是否跨分組重試(僅 auto 分組有效) |
curl -X POST https://bearlab.ai/api/token/ \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"my-token","expired_time":-1,"remain_quota":-1,"unlimited_quota":true,"model_limits_enabled":false,"group":""}'
Response
{
"success": true,
"message": ""
}