控制面 Key 与权限
企业主登录态 JWT 用于签发和撤销控制面 Key;控制面 Key 不能自行签发新的管理 Key。
POST /enterprise/control-keys | 创建 MANAGEMENT / PROVISIONING Key |
GET /enterprise/control-keys | 列出当前企业主的控制面 Key 元数据,不返回明文 |
DELETE /enterprise/control-keys/{hash} | 撤销控制面 Key |
GET /enterprise/control-keys/{hash}/mcp-status | 查询该 Key 最近的 MCP 认证读取状态 |
创建只读余额监控 Key
使用企业主登录态 Authorization: Bearer <USER_JWT>。请求字段使用 camelCase:
JSON
1{
2 "name": "billing-monitor",
3 "keyType": "MANAGEMENT",
4 "scopes": ["tenant:billing:read"]
5}name 和 keyType 必填。可选 allowedIps(IP/CIDR 列表)和 expiresAt(未来时间,UTC ISO-8601)。默认有效期 90 天,最长 365 天。不要使用本示例创建真实凭证,除非你确实需要新的 Key。
成功返回 HTTP 201、code: 200。data.apiKey 为仅本次返回的完整密钥,data.credential 为元数据;后续列表不返回明文。撤销和状态查询路径使用返回的 hash,不要使用明文密钥。
Scope 范围
tenant:members:read / tenant:members:write | 支持 | 支持 |
tenant:keys:read / tenant:keys:write | 支持 | 支持 |
tenant:policies:read / tenant:policies:write | 支持 | 不支持 |
tenant:billing:read | 支持 | 不支持 |
tenant:audit:read | 可配置 | 不支持 |
省略 scopes 或传空列表会使用该类型的默认 scope 集合,其中包含写权限。监控 Key 应显式只选择 billing read。Scope 可配置不代表存在同名 REST 接口;本节不声明尚未公开的审计或费用明细管理接口。
控制面凭证仅用于 /enterprise/v1/** 和 /enterprise/mcp/**。模型调用、/v1/key、/v1/billing/** 以及登录态管理接口不能使用它。
此页面对您有帮助吗?