Skip to content

Glossary ​

Glossary of One API Pro terms. One API Pro 常用术语解释。

Grouped by topic; each entry has zh / en, meaning, source location, related code.

按主题分组;每条给出中英对照、含义、出现位置、相关代码。

Roles & Permissions / 角色与权限 ​

TermMeaningValueConstantSource
Guest / 访客Not signed in0model.RoleGuestUserdefault
User / 普通用户Signed in, authenticated1(implicit)default
Admin / 管理员Admin console access10model.RoleAdminUsermiddleware/auth.go::AdminAuth
Root / 超级管理员System settings + admin management100model.RoleRootUsermiddleware/auth.go::RootAuth

The frontend uses useAuthStore().isAdmin / isRoot to gate UI; the backend middleware is the source of truth.

前端通过 useAuthStore().isAdmin / isRoot 控制 UI 显隐;后端中间件兜底。

User Status / 用户状态 ​

ValueMeaningConstant
0Default value (new user)—
1Enabledmodel.UserStatusEnabled
2Disabledmodel.UserStatusDisabled
3Deletedmodel.UserStatusDeleted

Note: the constant values differ from the role values to avoid colliding with "Enabled" (which is 1).

Token Status / 令牌状态 ​

ValueMeaningConstant
1Enabledmodel.TokenStatusEnabled
2Disabledmodel.TokenStatusDisabled
3Expiredmodel.TokenStatusExpired
4Quota exhaustedmodel.TokenStatusExhausted

Orders / 订单 ​

TermMeaningValuePrefix
Plan Subscription / 套餐订阅New plan purchaseOrderTypePlanSubscription = 1TB
Topup / 充值Online top-upOrderTypeTopup = 2TP
Upgrade Differential / 差价升级Plan upgrade differentialOrderTypePlanSubscription = 1UP
StatusMeaningConstant
0Pendingmodel.OrderStatusPending
1Paidmodel.OrderStatusPaid
2Canceledmodel.OrderStatusCanceled
3Refundedmodel.OrderStatusRefunded

Source / 来源:

EnumMeaningConstant
1User self-servicemodel.OrderSourceUserSelf
2Admin-placedmodel.OrderSourceAdmin

Pay-method constants / 支付方式常量:

text
OrderPayMethodWechat  = "wechat"
OrderPayMethodAlipay  = "alipay"
OrderPayMethodBank    = "bank"      // reserved / 预留
OrderPayMethodOffline = "offline"   // offline collection
OrderPayMethodFree    = "free"      // admin free grant

Log Type / 日志类型 ​

model/log.go:

ValueMeaningConstant
0UnknownLogTypeUnknown
1TopupLogTypeTopup
2ConsumeLogTypeConsume
3ManageLogTypeManage
4SystemLogTypeSystem
5TestLogTypeTest

The Dashboard / Admin Dashboard only count LogTypeConsume by default.

「个人仪表盘」与「运营仪表盘」默认只统计 LogTypeConsume。

System Settings / 系统设置 ​

The system_settings table is a KV store with (key, value, category). Common keys:

system_settings 表是 key / value / category 的 KV 库;常见 key:

ConstantDefaultCategoryNotes
payment.wechat.enabledfalsepayment{"enabled": bool}
payment.wechat.config—payment{app_id, mch_id, api_key, notify_url, cert_file, key_file}
payment.alipay.enabledfalsepaymentsame
payment.alipay.config—payment{app_id, private_key, public_key, notify_url}
payment.bank.enabledfalsepaymentreserved
payment.bank.config—payment{account_name, account_no, bank_name, branch, note}
plan.upgrade_modeprice_diffplanprice_diff / stack
topup.enabledtruetopupMaster switch for top-up
topup.allow_customtruetopupAllow custom amount
topup.presets—topupJSON: [{amount, bonus_quota}, ...]
topup.exchange_rate1topup1 CNY = X quota

Plan Upgrade Mode / 套餐升级模式 ​

ModeMeaningConstant
price_diff (default)Differential: new price minus remaining value of the current planOrderUpgradeModePriceDiff
stackStack: pay full price for the new plan; the old plan keeps running until expiryOrderUpgradeModeStack

See Subscription Upgrade & Downgrade.

详见 套餐升降级。

Quota / 配额 ​

TermMeaningField
QuotaInternal billing unit; the CNY ratio is QuotaPerUnit = 500_000 (1 CNY = 500_000 quota)—
Token quotaPer-API-key budgettokens.remain_quota
User quotaUser-level balance (top-up + unspent plan balance)users.quota
Plan quotaPlan-assigned budget (daily_quota + total)plans.quota / plans.daily_quota

Cache / 缓存 ​

KeyMeaningTTL
token:<key>Token JSONSyncFrequency
user_group:<id>User group (determines visible models)SyncFrequency
user_quota:<id>User balanceSyncFrequency
user_status:<id>User statusSyncFrequency
group_models:<group>Group → models mappingSyncFrequency

SyncFrequency defaults to 600s; userQuotaLowWaterMark = 50_000 decides when to fall back to DB.

Cluster / 集群 ​

TermMeaningField
Node / 节点A deployed One API Pro instancecluster_nodes.node_id
Heartbeat / 心跳MarkHeartbeat() writes last_heartbeatcluster_nodes.last_heartbeat
Ping Failure / Ping 失败Cumulative ping failurescluster_nodes.ping_failures
Push / 主动推送GORM callbacks capture table changes → HTTP POST sync—

Auth / 鉴权 ​

TermMeaningHeader
Cookie SessionBrowser-side session cookieCookie
Access TokenUUID, user-level admin tokenAuthorization: <uuid>
API Keysk-…-style, OpenAI-compatible keyAuthorization: Bearer sk-…

See API Overview · Auth.

详见 API 总览 · 鉴权机制。

Next: Troubleshooting · Contribute.