成员与推理 Key 管理

所有路径以下述基址为准:https://api.token360.ai/enterprise/v1。使用有对应 scope 的 MANAGEMENT Key;PROVISIONING Key 仅支持成员和 Key 操作,不支持模型策略。推理 Key、JWT 不能调用此机器接口。

subAccountId 使用 API 返回的公开子账号标识,hash 使用 Key 元数据中的 hash;不得使用内部自增 ID 或明文 Key。

GET/sub-accountstenant:members:read
POST/sub-accountstenant:members:write
PATCH/sub-accounts/{subAccountId}/statustenant:members:write
DELETE/sub-accounts/{subAccountId}tenant:members:write
GET/sub-accounts/{subAccountId}/model-accesstenant:policies:read
PUT/sub-accounts/{subAccountId}/model-accesstenant:policies:write
GET/sub-accounts/{subAccountId}/api-keystenant:keys:read
POST/sub-accounts/{subAccountId}/api-keystenant:keys:write
PATCH/sub-accounts/{subAccountId}/api-keys/{hash}tenant:keys:write
DELETE/sub-accounts/{subAccountId}/api-keys/{hash}tenant:keys:write

请求与响应

请求使用 camelCase 字段;成功响应为 { "code": 200, "data": ... } 信封,不能仅凭 HTTP 200 判断业务成功。

  • 创建成员:username 必填(2–50 字符),displayName 可选。审批流程不接受机器提供的密码,应使用系统生成的凭证流程。
  • 修改成员状态:{"status":"active"} 或 {"status":"suspended"}。
  • 设置模型策略:{"restriction":"INHERIT"} 或 {"restriction":"ALLOWLIST","modelNames":["<PUBLIC_MODEL_NAME>"]}。
  • 创建成员推理 Key:name 必填;可选 workspaceCode(默认 DEFAULT)、expiresAt、allowedIps、spendLimit(正数,USD)、limitReset(daily/weekly/monthly/null)。
  • 更新成员推理 Key:status 必填(ACTIVE/DISABLED);可选 name、allowedIps。变更限额必须传 spendLimitPresent:true,变更周期必须传 limitResetPresent:true;搭配 null 可清除相应设置。省略 present 标志保留旧值。
  • Key 列表和更新返回元数据,不包含明文。直接创建 Key 成功时 data.apiKey 为新密钥,data.credential 为元数据;仅安全保存一次。

Key 限额按 UTC 日、周一开始的周或自然月重置;null 周期按累计消费。Key 限额不划拨企业资金,也不能覆盖账户限制。

写操作可能需要审批

以上读操作直接返回;启用企业控制面审批的租户,七类写操作需要 Idempotency-Key,可能返回 HTTP 409、serviceCode: APPROVAL_REQUIRED 和 data.operation,此时操作尚未执行。请阅读同组的「审批与重试」,不要将审批等待误认为创建成功。

此页面对您有帮助吗?
成员与推理 Key 管理 · Token360