mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-11-30 00:27:42 +08:00
8031 lines
269 KiB
YAML
8031 lines
269 KiB
YAML
openapi: 3.1.0
|
||
info:
|
||
title: MonkeyAI Admin API
|
||
version: 1.0.0
|
||
servers:
|
||
- url: /
|
||
security:
|
||
- AdminSession: []
|
||
paths:
|
||
/api/admin/v1/resource-import-uploads:
|
||
post:
|
||
summary: 创建资源包上传会话
|
||
description: 仅管理员可用,会话与创建者绑定,有效期 24 小时,每人最多 5 个未完成任务。普通 ZIP 或按字节拆分的 .zip.001 等分卷按顺序组成一个 ZIP,总大小不超过 2 GiB,最多 256 卷;不支持 .z01 或 7z 分卷。网络上传统一使用 64 MiB 传输块。
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [files]
|
||
properties:
|
||
files:
|
||
type: array
|
||
minItems: 1
|
||
maxItems: 256
|
||
items: {$ref: '#/components/schemas/ResourceImportUploadFile'}
|
||
responses:
|
||
'201':
|
||
description: 返回上传会话
|
||
content:
|
||
application/json:
|
||
schema: {$ref: '#/components/schemas/ResourceImportUpload'}
|
||
'400': {$ref: '#/components/responses/ResourceError400'}
|
||
'409': {description: 未完成任务数已达上限}
|
||
get:
|
||
summary: 查询当前管理员未完成的资源包上传任务
|
||
responses:
|
||
'200':
|
||
description: 返回尚未过期的 uploading 和 ready 任务
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [items]
|
||
properties:
|
||
items:
|
||
type: array
|
||
items: {$ref: '#/components/schemas/ResourceImportUpload'}
|
||
/api/admin/v1/resource-import-uploads/{id}:
|
||
parameters:
|
||
- {name: id, in: path, required: true, schema: {type: string, format: uuid}}
|
||
get:
|
||
summary: 查询上传进度及已保存的传输块
|
||
responses:
|
||
'200':
|
||
description: 刷新页面或重启服务后可据此续传;本地文件须重新选择并核对已上传块摘要
|
||
content:
|
||
application/json:
|
||
schema: {$ref: '#/components/schemas/ResourceImportUpload'}
|
||
'404': {$ref: '#/components/responses/ResourceError404'}
|
||
delete:
|
||
summary: 放弃未完成上传任务
|
||
description: 使任务立即失效,后台定期清理暂存对象;已导入任务不能取消。
|
||
responses:
|
||
'204': {description: 任务已取消}
|
||
'404': {$ref: '#/components/responses/ResourceError404'}
|
||
'409': {description: 任务已导入}
|
||
/api/admin/v1/resource-import-uploads/{id}/chunks/{index}:
|
||
put:
|
||
summary: 上传一个资源包传输块
|
||
description: index 从 0 开始,对应逻辑 ZIP 的 index × chunk_size 偏移;除末块外必须恰好 64 MiB。服务端核对实际大小和 SHA-256,同内容重复上传幂等,不同内容或已封存返回 409。分块可乱序上传。
|
||
parameters:
|
||
- {name: id, in: path, required: true, schema: {type: string, format: uuid}}
|
||
- {name: index, in: path, required: true, schema: {type: integer, minimum: 0, maximum: 31}}
|
||
- {name: X-Content-SHA256, in: header, required: true, schema: {type: string, pattern: '^sha256:[0-9a-f]{64}$'}}
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/octet-stream:
|
||
schema: {type: string, format: binary}
|
||
responses:
|
||
'204': {description: 传输块已保存或同内容已存在}
|
||
'400': {$ref: '#/components/responses/ResourceError400'}
|
||
'404': {$ref: '#/components/responses/ResourceError404'}
|
||
'409': {description: 块内容冲突或上传已封存}
|
||
/api/admin/v1/resource-import-uploads/{id}/complete:
|
||
post:
|
||
summary: 检查完整 ZIP 并封存上传内容
|
||
description: 收齐所有传输块后检查 ZIP 路径、展开限制及外层文件 CRC,计算完整 ZIP 的 package_sha256。成功后 ready 状态不可修改,重复完成幂等。本接口不导入资源,也不校验包内声明的发布协议摘要。
|
||
parameters:
|
||
- {name: id, in: path, required: true, schema: {type: string, format: uuid}}
|
||
responses:
|
||
'200':
|
||
description: 完整上传会话
|
||
content:
|
||
application/json:
|
||
schema: {$ref: '#/components/schemas/ResourceImportUpload'}
|
||
'400': {$ref: '#/components/responses/ResourceError400'}
|
||
'404': {$ref: '#/components/responses/ResourceError404'}
|
||
/api/admin/v1/resource-imports/preview:
|
||
post:
|
||
summary: 解析资源发布包并预览变更
|
||
description: 使用封存的 upload_id 或不超过2 GiB的ZIP。discover_only=true 仅发现分区,不产生可执行计划;新版设计包必须显式 sections,正式preview由服务端计算package_sha256和plan_digest。仅Agent时保留旧宽松解析;选择design时严格校验全外包CHECKSUMS、发布身份、JCS业务摘要和源映射。设计-only不解析Agent业务内容、不计划Agent退役;返回逐分区计划,Agent变更含声明的tags并参与变更判断,变更选项后须重新预览。
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema: {$ref: '#/components/schemas/ResourceImportInput'}
|
||
multipart/form-data:
|
||
schema:
|
||
type: object
|
||
required: [package]
|
||
properties:
|
||
package: {type: string, format: binary}
|
||
options: {type: string, description: JSON 编码的认证归属选项}
|
||
responses:
|
||
'200': {description: discovery返回available_sections和支持状态;正式preview返回sections/package_sha256/plan_digest/section_plans,设计计划在design对象中包含publisher_id/release_id/counts/changes/current_revision/snapshot_digest。已成功分区标记already_imported,不能以整包去重跳过未导分区。}
|
||
'400': {$ref: '#/components/responses/ResourceError400'}
|
||
'409': {description: 资源身份或现有数据关联冲突}
|
||
/api/admin/v1/resource-imports:
|
||
post:
|
||
summary: 按预览确认所选资源分区
|
||
description: 固定agent→design顺序,分区独立提交,允许部分成功;HTTP200仍须检查顶层status和逐分区结果。sections/package_sha256/总plan_digest/section_plan_digests须与正式preview一致,options.confirm_final必须true。成功回执与业务写入同事务,重放不重新激活;失败分区重新preview后重试。同upload可在保留期内补导另一分区,过期后保留历史但清理上传字节。旧Agent-only保持既有事务和请求兼容。Agent条目的tags按名称复用或创建标签并同步关联,空数组清空关联,未声明时保留原标签;已有使用授权不变。
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
allOf:
|
||
- {$ref: '#/components/schemas/ResourceImportInput'}
|
||
- {required: [options, package_sha256, plan_digest]}
|
||
multipart/form-data:
|
||
schema:
|
||
type: object
|
||
required: [package, package_sha256, plan_digest, options]
|
||
properties:
|
||
package: {type: string, format: binary}
|
||
package_sha256: {type: string}
|
||
plan_digest: {type: string}
|
||
options: {type: string}
|
||
sections: {type: string, description: JSON编码的分区数组;跨分区分次处理使用封存upload_id}
|
||
section_plan_digests: {type: string, description: JSON编码的逐分区计划}
|
||
responses:
|
||
'200':
|
||
description: 分区结果,status为succeeded或partial;不要仅凭HTTP200显示全部成功。旧Agent-only仍返回原Preview。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
status: {type: string, enum: [succeeded, partial]}
|
||
warning: {type: string, description: 业务已提交但上传状态同步失败的提示}
|
||
sections:
|
||
type: object
|
||
additionalProperties: {$ref: '#/components/schemas/ResourceSectionResult'}
|
||
'400': {$ref: '#/components/responses/ResourceError400'}
|
||
'409': {description: 并发变更冲突,需重新预览;无成功分区时error.references包含分区结果}
|
||
'503': {description: 存储/数据库暂不可用;无成功分区时返回错误,不假报成功}
|
||
get:
|
||
summary: 分页查询资源包导入批次
|
||
parameters:
|
||
- {name: cursor, in: query, schema: {type: string}, description: 上一页返回的 next_cursor}
|
||
- {name: limit, in: query, schema: {type: integer, minimum: 1, maximum: 500, default: 20}}
|
||
responses:
|
||
'200': {description: 返回items与next_cursor,支持每页最多500条;新分区批次含section_results,status支持succeeded/partial/failed,设计源release不改写为Agent内部版本。}
|
||
/api/admin/v1/resource-imports/{id}:
|
||
get:
|
||
summary: 读取资源包导入批次详情
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema: {type: string, format: uuid}
|
||
responses:
|
||
'200': {description: 批次详情}
|
||
'404': {description: 批次不存在}
|
||
/api/admin/v1/sessions/{id}:
|
||
parameters:
|
||
- {name: id, in: path, required: true, schema: {type: string, format: uuid}}
|
||
get:
|
||
summary: 查询会话统计详情
|
||
description: 已清除会话仅返回固定墓碑摘要,不返回轮次或调用明细。
|
||
responses:
|
||
'200': {description: 会话统计元数据,包含标题及来源}
|
||
'401': {$ref: '#/components/responses/Unauthorized'}
|
||
'404': {$ref: '#/components/responses/ResourceError404'}
|
||
'410': {description: 会话统计数据已清除}
|
||
delete:
|
||
summary: 清除会话及子会话统计明细
|
||
description: 仅管理员可操作;必须提供匹配的顶层会话完整 ID。清除会话与子会话统计明细,并在同一事务写审计;财务流水和会话墓碑保留。
|
||
parameters:
|
||
- {name: X-Confirm-Session-ID, in: header, required: true, schema: {type: string, format: uuid}}
|
||
responses:
|
||
'204': {description: 统计明细已清除}
|
||
'400': {$ref: '#/components/responses/ResourceError400'}
|
||
'403': {$ref: '#/components/responses/ResourceError403'}
|
||
'404': {$ref: '#/components/responses/ResourceError404'}
|
||
/api/admin/v1/statistics/session-reporting/sessions/{id}:
|
||
parameters:
|
||
- {name: id, in: path, required: true, schema: {type: string, format: uuid}}
|
||
get:
|
||
summary: 查询一期会话轮次和网关调用统计详情
|
||
description: 返回会话统计及客户端上报的轮次正文、标题和标题来源;已清除会话普通统计读取返回 410。
|
||
responses:
|
||
'200': {description: 会话标题及来源、轮次正文与截断标记、轮次标题及来源,以及工具、技能、资源、调用与子会话统计}
|
||
'404': {$ref: '#/components/responses/ResourceError404'}
|
||
'410': {description: 会话统计数据已清除}
|
||
/api/admin/v1/statistics/session-reporting/resources:
|
||
get:
|
||
summary: 按用户查询资源开启、使用、调用和失败指标
|
||
description: |
|
||
每行按用户、资源类别、资源 ID 和版本分别聚合;用户为会话所属用户,姓名和邮箱使用当前账户信息。
|
||
包含符合条件的子会话,时间范围为 [from, until),默认最近 24 小时。
|
||
user 按用户名、邮箱或用户 ID 做不区分大小写的字面子串匹配;可与 user_id、kind 及资源筛选组合。
|
||
kind 按原始类别精确筛选,包含快照、工具、技能事件和网关连接器指标;空值表示全部类别。
|
||
资源 ID 和版本按精确值筛选,包含仅有工具调用、没有资源快照条目的资源。
|
||
resource_name 优先采用未删除的后台资源名称,其次采用筛选范围内该用户、资源及版本的最新非空上报名称,最后回退到原始 ID。
|
||
内置工具始终以原始 ID 作为 resource_name;名称不参与分组、排序或 ID 筛选。
|
||
游标与全部筛选条件绑定,旧的跨用户资源聚合游标不再适用。
|
||
parameters:
|
||
- {name: from, in: query, schema: {type: string, format: date-time}}
|
||
- {name: until, in: query, schema: {type: string, format: date-time}}
|
||
- {name: user, in: query, description: 用户名、邮箱或用户 ID,首尾空白会被移除,最多 200 个 Unicode 字符。, schema: {type: string, maxLength: 200}}
|
||
- {name: user_id, in: query, description: 精确匹配会话所属用户 ID。, schema: {type: string, format: uuid}}
|
||
- {name: kind, in: query, description: 原始资源类别,首尾空白会被移除,最多 128 字节;兼容客户端自定义类别。, schema: {type: string, maxLength: 128}}
|
||
- {name: resource_id, in: query, schema: {type: string}}
|
||
- {name: resource_version, in: query, schema: {type: string}}
|
||
- {name: limit, in: query, schema: {type: integer, minimum: 1, maximum: 500, default: 50}}
|
||
- {name: cursor, in: query, schema: {type: string}}
|
||
responses:
|
||
'200':
|
||
description: 用户资源维度指标及 next_cursor
|
||
content:
|
||
application/json:
|
||
schema: {$ref: '#/components/schemas/StatisticsResourceUsage'}
|
||
'400': {$ref: '#/components/responses/ResourceError400'}
|
||
/api/admin/v1/statistics/session-reporting/clients:
|
||
get:
|
||
summary: 查询客户端平台、版本和结局指标
|
||
parameters:
|
||
- {name: from, in: query, schema: {type: string, format: date-time}}
|
||
- {name: until, in: query, schema: {type: string, format: date-time}}
|
||
- {name: client_type, in: query, description: 会话的客户端类型。, schema: {type: string, enum: [desktop, web, extension, mobile, runtime, unknown]}}
|
||
- {name: limit, in: query, schema: {type: integer, minimum: 1, maximum: 500, default: 50}}
|
||
- {name: cursor, in: query, schema: {type: string}}
|
||
responses:
|
||
'200': {description: 客户端维度指标及 next_cursor}
|
||
/api/admin/v1/statistics/session-reporting/clients/overview:
|
||
get:
|
||
summary: 查询客户端类型、平台和客户端版本的会话分布
|
||
description: |
|
||
使用与客户端列表一致的轮次筛选和可见范围,包含符合条件的子会话。
|
||
每个 session_id 只计一次,客户端版本取所有筛选条件匹配后的最后一轮,按 started_at、turn_index 降序确定。
|
||
平台为当前设备属性,不是历史快照。空白或缺失客户端版本归入 null;分类不截断。
|
||
三组分类数量之和均等于 total;同数量分类按值稳定排序,null 排最后。
|
||
默认最近 24 小时,时间区间为 [from, until)。不支持 cursor、limit、page、page_size。
|
||
parameters:
|
||
- {name: from, in: query, description: 窗口起点,包含;默认当前时间前 24 小时。, schema: {type: string, format: date-time}}
|
||
- {name: until, in: query, description: 窗口终点,不包含;默认当前时间。, schema: {type: string, format: date-time}}
|
||
- {name: client_type, in: query, description: 会话的客户端类型。, schema: {type: string, enum: [desktop, web, extension, mobile, runtime, unknown]}}
|
||
- {name: platform, in: query, description: 当前设备平台,按客户端上报原值精确匹配,最多 64 个 UTF-8 字节。, schema: {type: string, maxLength: 64}}
|
||
- {name: outcome, in: query, description: 轮次结束原因;先筛选再确定会话的最后匹配轮次。, schema: {type: string, enum: [complete, interrupted, error, max_turns, output_limit, unknown]}}
|
||
- {name: user_id, in: query, description: 会话所属用户 ID。, schema: {type: string, format: uuid}}
|
||
- {name: group_id, in: query, description: 会话所属分组 ID。, schema: {type: string, format: uuid}}
|
||
- {name: model_id, in: query, description: 匹配轮次使用的模型 ID。, schema: {type: string, format: uuid}}
|
||
- {name: expert_id, in: query, description: 会话的专家 ID。, schema: {type: string, format: uuid}}
|
||
- {name: resource_id, in: query, description: 匹配轮次资源快照中的资源 ID,最多 256 字节。, schema: {type: string, maxLength: 256}}
|
||
- {name: resource_version, in: query, description: 匹配资源的版本,最多 256 字节。, schema: {type: string, maxLength: 256}}
|
||
- {name: include_placeholders, in: query, description: 是否包含已上报且有匹配轮次的占位会话。, schema: {type: boolean, default: false}}
|
||
responses:
|
||
'200':
|
||
description: 全量筛选结果的三个分布;空数据 total 为 0,分类均为空数组。
|
||
content:
|
||
application/json:
|
||
schema: {$ref: '#/components/schemas/StatisticsClientOverview'}
|
||
'400': {$ref: '#/components/responses/ResourceError400'}
|
||
'401': {$ref: '#/components/responses/Unauthorized'}
|
||
'403': {$ref: '#/components/responses/Forbidden'}
|
||
'500': {$ref: '#/components/responses/ResourceError500'}
|
||
/oauth/connectors/{id}/callback:
|
||
get:
|
||
summary: 处理指定 MCP 的 OAuth 回调
|
||
description: 校验 MCP id 与 state 绑定、有效期及配置版本,单次消费授权事务并在服务端交换和保存 Token。无需浏览器会话或 Agent Token。
|
||
security: []
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
- name: state
|
||
in: query
|
||
required: true
|
||
schema:
|
||
type: string
|
||
- name: code
|
||
in: query
|
||
description: 授权成功时返回的授权码。
|
||
schema:
|
||
type: string
|
||
- name: error
|
||
in: query
|
||
description: 授权拒绝或取消时返回的错误码。
|
||
schema:
|
||
type: string
|
||
responses:
|
||
'200':
|
||
description: 凭证已保存,浏览器显示授权成功页面。
|
||
content:
|
||
text/html:
|
||
schema:
|
||
type: string
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
/api/auth/v1/methods:
|
||
get:
|
||
summary: 读取公开登录方式开关
|
||
security: []
|
||
responses:
|
||
"200":
|
||
description: 仅包含登录开关,不包含 SMTP 或 OAuth 密钥
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailLoginMethods"
|
||
"503":
|
||
description: 认证配置不可用
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
/api/auth/v1/branding:
|
||
get:
|
||
summary: 读取公开品牌信息
|
||
description: 公开返回团队名称、产品名称、授权机器码及有效商业授权标记。仅宿主确认合法且当前有效的付费授权时标记为 true;未配置校验器或读取失败时为 false。不会返回授权文件、客户信息、席位、有效期或密钥。
|
||
security: []
|
||
responses:
|
||
"200":
|
||
description: 公开品牌信息
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required:
|
||
- workspace_name
|
||
- product_name
|
||
- machine_code
|
||
- has_commercial_license
|
||
additionalProperties: false
|
||
properties:
|
||
workspace_name:
|
||
type: string
|
||
description: 团队名称。
|
||
product_name:
|
||
type: string
|
||
description: 工具名称。
|
||
machine_code:
|
||
type: string
|
||
description: 与管理员付费授权页面相同的授权机器码;宿主未提供时为空字符串,不是统计实例 ID。
|
||
has_commercial_license:
|
||
type: boolean
|
||
description: 是否已导入通过现有付费授权校验且当前有效的商业授权。缺失、无效、过期或无法确认时为 false。
|
||
/api/auth/v1/email/code:
|
||
post:
|
||
summary: 发送邮箱验证码
|
||
description: login 受 email_code_enabled 控制;reset 受 password_enabled 控制。每邮箱每分钟最多 1 次、每小时最多 10 次,每连接来源 IP 每小时最多 30
|
||
次;失败发送也计入限额。开启 email_code_auto_registration_enabled 时,新邮箱可获取 login 验证码;
|
||
未开启自动注册的未知邮箱、停用或不符合用途的账号返回相同成功响应但不发送邮件。
|
||
security: []
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required:
|
||
- email
|
||
- purpose
|
||
properties:
|
||
email: &a1
|
||
type: string
|
||
format: email
|
||
maxLength: 254
|
||
description: 邮箱会去除首尾空白并转为小写。
|
||
purpose:
|
||
type: string
|
||
enum:
|
||
- login
|
||
- reset
|
||
responses:
|
||
"200":
|
||
description: 操作成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required:
|
||
- message
|
||
- retry_after
|
||
properties:
|
||
message:
|
||
type: string
|
||
retry_after:
|
||
type: integer
|
||
const: 30
|
||
"400":
|
||
description: 请求无效,或验证码无效、过期、超过错误次数限制
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"401":
|
||
description: 邮箱密码不匹配或账号不符合登录入口角色
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"403":
|
||
description: 对应登录方式或注册开关关闭
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"409":
|
||
description: 邮箱已存在,注册冲突
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"429":
|
||
description: 验证码发送过于频繁
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
headers:
|
||
Retry-After:
|
||
schema:
|
||
type: integer
|
||
const: 60
|
||
"500":
|
||
description: 认证操作失败
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"502":
|
||
description: 邮件发送失败
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"503":
|
||
description: 认证配置或邮件服务不可用
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
/api/auth/v1/email/reset-password:
|
||
post:
|
||
summary: 通过邮箱验证码重置密码
|
||
description: 使用 reset 用途验证码,需要开启密码登录。重置后撤销全部旧浏览器会话、OAuth token
|
||
和未使用授权码,并使现有登录验证码失效。不会自动登录。
|
||
security: []
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required:
|
||
- email
|
||
- code
|
||
- password
|
||
properties:
|
||
email: *a1
|
||
code: &a2
|
||
type: string
|
||
pattern: ^[0-9]{6}$
|
||
description: 十分钟内有效的六位数字验证码,仅可使用一次。
|
||
password:
|
||
type: string
|
||
minLength: 12
|
||
maxLength: 1024
|
||
writeOnly: true
|
||
description: 新密码至少 12 个字符,长度按 UTF-8 字节校验。
|
||
responses:
|
||
"200":
|
||
description: 操作成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required:
|
||
- reset
|
||
properties:
|
||
reset:
|
||
type: boolean
|
||
const: true
|
||
"400":
|
||
description: 请求无效,或验证码无效、过期、超过错误次数限制
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"401":
|
||
description: 邮箱密码不匹配或账号不符合登录入口角色
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"403":
|
||
description: 对应登录方式或注册开关关闭
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"409":
|
||
description: 邮箱已存在,注册冲突
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"429":
|
||
description: 验证码发送过于频繁
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
headers:
|
||
Retry-After:
|
||
schema:
|
||
type: integer
|
||
const: 60
|
||
"500":
|
||
description: 认证操作失败
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"502":
|
||
description: 邮件发送失败
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"503":
|
||
description: 认证配置或邮件服务不可用
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
/api/auth/v1/admin/login:
|
||
post:
|
||
summary: 使用密码登录管理后台
|
||
description: 需要开启 password_enabled,仅允许启用状态的管理员;成功设置 HttpOnly、SameSite=Lax 会话
|
||
Cookie,HTTPS 环境附加 Secure。
|
||
security: []
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required:
|
||
- email
|
||
- password
|
||
properties:
|
||
email: *a1
|
||
password:
|
||
type: string
|
||
maxLength: 1024
|
||
writeOnly: true
|
||
responses:
|
||
"200":
|
||
description: 操作成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthUser"
|
||
headers:
|
||
Set-Cookie:
|
||
schema:
|
||
type: string
|
||
description: monkeyai_session 会话 Cookie,默认有效期 7 天。
|
||
"400":
|
||
description: 请求无效,或验证码无效、过期、超过错误次数限制
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"401":
|
||
description: 邮箱密码不匹配或账号不符合登录入口角色
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"403":
|
||
description: 对应登录方式或注册开关关闭
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"409":
|
||
description: 邮箱已存在,注册冲突
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"429":
|
||
description: 验证码发送过于频繁
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
headers:
|
||
Retry-After:
|
||
schema:
|
||
type: integer
|
||
const: 60
|
||
"500":
|
||
description: 认证操作失败
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"502":
|
||
description: 邮件发送失败
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"503":
|
||
description: 认证配置或邮件服务不可用
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
/api/auth/v1/admin/email/login:
|
||
post:
|
||
summary: 使用邮箱验证码登录管理后台
|
||
description: 需要开启 email_code_enabled,使用 login
|
||
用途验证码。仅允许启用状态的管理员,成功建立浏览器会话;验证码最多允许 5 次错误尝试。
|
||
此入口不自动创建账号,email_code_auto_registration_enabled 开启也不例外。
|
||
security: []
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required:
|
||
- email
|
||
- code
|
||
properties:
|
||
email: *a1
|
||
code: *a2
|
||
responses:
|
||
"200":
|
||
description: 操作成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthUser"
|
||
headers:
|
||
Set-Cookie:
|
||
schema:
|
||
type: string
|
||
description: monkeyai_session 会话 Cookie,默认有效期 7 天。
|
||
"400":
|
||
description: 请求无效,或验证码无效、过期、超过错误次数限制
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"401":
|
||
description: 邮箱密码不匹配或账号不符合登录入口角色
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"403":
|
||
description: 对应登录方式或注册开关关闭
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"409":
|
||
description: 邮箱已存在,注册冲突
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"429":
|
||
description: 验证码发送过于频繁
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
headers:
|
||
Retry-After:
|
||
schema:
|
||
type: integer
|
||
const: 60
|
||
"500":
|
||
description: 认证操作失败
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"502":
|
||
description: 邮件发送失败
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"503":
|
||
description: 认证配置或邮件服务不可用
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
/api/admin/v1/settings/proxies:
|
||
get:
|
||
summary: 读取系统代理资源
|
||
description: 管理员读取代理列表;密码不返回。未配置时返回 404。
|
||
responses:
|
||
"200":
|
||
description: 系统代理设置
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/ProxySetting"
|
||
put:
|
||
summary: 保存系统代理资源
|
||
description: 完整替换代理列表。代理 ID 省略时自动生成;编辑时密码省略或留空则保持旧密码;正在被模型或连接器引用的代理不可删除。
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [schema_version, value]
|
||
properties:
|
||
schema_version: {type: integer, minimum: 1}
|
||
value:
|
||
type: object
|
||
required: [proxies]
|
||
properties:
|
||
proxies:
|
||
type: array
|
||
items:
|
||
$ref: "#/components/schemas/SystemProxy"
|
||
responses:
|
||
"200":
|
||
description: 保存成功,密码已脱敏
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/ProxySetting"
|
||
/api/admin/v1/settings/email/test:
|
||
post:
|
||
summary: 使用已保存 SMTP 配置发送测试邮件
|
||
description: 仅管理员可调用。使用已保存的完整配置(包括未返回前端的密码);SMTP 确认 DATA 后返回成功,连接、TLS、认证或投递失败返回 502。
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required:
|
||
- recipient
|
||
properties:
|
||
recipient: *a1
|
||
responses:
|
||
"200":
|
||
description: 操作成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required:
|
||
- sent
|
||
properties:
|
||
sent:
|
||
type: boolean
|
||
const: true
|
||
"400":
|
||
description: 请求无效,或验证码无效、过期、超过错误次数限制
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"401":
|
||
description: 邮箱密码不匹配或账号不符合登录入口角色
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"403":
|
||
description: 对应登录方式或注册开关关闭
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"409":
|
||
description: 邮箱已存在,注册冲突
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"429":
|
||
description: 验证码发送过于频繁
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
headers:
|
||
Retry-After:
|
||
schema:
|
||
type: integer
|
||
const: 60
|
||
"500":
|
||
description: 认证操作失败
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"502":
|
||
description: 邮件发送失败
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
"503":
|
||
description: 认证配置或邮件服务不可用
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/EmailAuthError"
|
||
/api/admin/v1/audits:
|
||
get:
|
||
summary: 查询操作审计
|
||
description: 仅管理员可访问;按发生时间、ID 倒序稳定分页。支持历史记录与请求审计,时间范围左闭右开,文本筛选为不区分大小写的字面子串(IP 除外)。不提供修改或删除接口。
|
||
parameters:
|
||
- name: page
|
||
in: query
|
||
description: 页码,从 1 开始。
|
||
schema:
|
||
type: integer
|
||
minimum: 1
|
||
maximum: 1000000
|
||
default: 1
|
||
- name: page_size
|
||
in: query
|
||
description: 每页条数。
|
||
schema:
|
||
type: integer
|
||
minimum: 1
|
||
maximum: 500
|
||
default: 20
|
||
- name: actor
|
||
in: query
|
||
description: 操作者名称或邮箱的字面子串。
|
||
schema:
|
||
type: string
|
||
maxLength: 512
|
||
- name: ip
|
||
in: query
|
||
description: 实际连接来源 IP 的字面子串,不信任客户端转发头。
|
||
schema:
|
||
type: string
|
||
maxLength: 512
|
||
- name: params
|
||
in: query
|
||
description: 脱敏请求参数的字面子串。
|
||
schema:
|
||
type: string
|
||
maxLength: 512
|
||
- name: category
|
||
in: query
|
||
description: 操作分类。
|
||
schema:
|
||
type: string
|
||
enum: [model, identity, security, settings, resource, billing]
|
||
- name: result
|
||
in: query
|
||
description: 执行结果。
|
||
schema:
|
||
type: string
|
||
enum: [success, failed]
|
||
- name: since
|
||
in: query
|
||
description: 开始时间,包含该时刻。
|
||
schema:
|
||
type: string
|
||
format: date-time
|
||
- name: until
|
||
in: query
|
||
description: 结束时间,不包含该时刻,必须晚于开始时间。
|
||
schema:
|
||
type: string
|
||
format: date-time
|
||
responses:
|
||
"200":
|
||
description: 匹配的审计记录与总条数;空页的 items 为 [],total 仍为匹配总数。
|
||
headers:
|
||
Cache-Control:
|
||
schema:
|
||
type: string
|
||
const: private, no-store
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/AuditPage"
|
||
"400":
|
||
$ref: "#/components/responses/ResourceError400"
|
||
"401":
|
||
$ref: "#/components/responses/ResourceError401"
|
||
"403":
|
||
$ref: "#/components/responses/ResourceError403"
|
||
"500":
|
||
$ref: "#/components/responses/ResourceError500"
|
||
/api/admin/v1/statistics/models/overview:
|
||
get:
|
||
summary: 模型调用的固定窗口汇总与近 90 天每日趋势
|
||
description: 仅管理员可访问,不接收查询参数。调用及 Token 按完成时间统计,积分按账本发生时间统计;每日为北京时间(Asia/Shanghai)自然日,今天仅统计到 generated_at。Token 和 TPM 仅累计用量明确的调用:优先采用 billing_transactions.usage.known,缺失时以 model_calls.error_code 为空判断;输入包含缓存输入。调用次数、成功率和耗时仍统计全部已完成调用。首字耗时只使用新采集到首个实际输出片段的流式调用,历史与非流式调用无值。
|
||
responses:
|
||
"200":
|
||
description: 同一数据库快照下的模型总览。
|
||
headers:
|
||
Cache-Control:
|
||
schema:
|
||
type: string
|
||
const: private, no-store
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/StatisticsModelsOverview"
|
||
"400":
|
||
$ref: "#/components/responses/ResourceError400"
|
||
"401":
|
||
$ref: "#/components/responses/ResourceError401"
|
||
"403":
|
||
$ref: "#/components/responses/ResourceError403"
|
||
"500":
|
||
$ref: "#/components/responses/ResourceError500"
|
||
/api/admin/v1/statistics/tasks/overview:
|
||
get:
|
||
summary: 任务总量、近 24 小时新增和活跃任务及近 90 天每日趋势
|
||
description: 固定窗口,不接收查询参数。只统计上报启用、非占位、未删除或清理的根任务。新增按根任务 started_at 统计;活跃指存在 session_turns 记录的任务,子任务归属根任务并按根任务去重。每日按北京时间(Asia/Shanghai)自然日,包含当天部分数据。
|
||
responses:
|
||
"200":
|
||
description: 任务统计及完整的 90 天日序列。
|
||
headers:
|
||
Cache-Control:
|
||
schema:
|
||
type: string
|
||
const: private, no-store
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/StatisticsTasksOverview"
|
||
"400":
|
||
$ref: "#/components/responses/ResourceError400"
|
||
"401":
|
||
$ref: "#/components/responses/ResourceError401"
|
||
"403":
|
||
$ref: "#/components/responses/ResourceError403"
|
||
"500":
|
||
$ref: "#/components/responses/ResourceError500"
|
||
/api/admin/v1/statistics/realtime:
|
||
get:
|
||
summary: 实时运行统计
|
||
description: 仅管理员可访问。单次请求在同一 PostgreSQL 只读快照中聚合,不返回模拟数据。
|
||
parameters:
|
||
- name: range
|
||
in: query
|
||
required: false
|
||
description: 以服务端当前时间为终点的滚动窗口;5m、30m、60m 仅为旧版调用保留。
|
||
schema:
|
||
type: string
|
||
enum:
|
||
- 5m
|
||
- 15m
|
||
- 30m
|
||
- 60m
|
||
- 1h
|
||
- 4h
|
||
- 1d
|
||
- 7d
|
||
default: 1d
|
||
responses:
|
||
"200":
|
||
description: 统计结果。
|
||
headers:
|
||
Cache-Control:
|
||
schema:
|
||
type: string
|
||
const: private, no-store
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/StatisticsRealtime"
|
||
"400":
|
||
$ref: "#/components/responses/ResourceError400"
|
||
"401":
|
||
$ref: "#/components/responses/ResourceError401"
|
||
"403":
|
||
$ref: "#/components/responses/ResourceError403"
|
||
"500":
|
||
$ref: "#/components/responses/ResourceError500"
|
||
/api/admin/v1/statistics/users:
|
||
get:
|
||
summary: 用户总量、近 24 小时新增和活跃用户及近 90 天每日趋势
|
||
description: 固定窗口,不接收查询参数。活跃指时间范围内存在 session_turns 记录的去重任务所属用户;轮次完成后才可统计。总量和新增人数均包含软删除用户。每日按北京时间(Asia/Shanghai)自然日,包含当天部分数据。
|
||
responses:
|
||
"200":
|
||
description: 用户统计及完整的 90 天日序列。
|
||
headers:
|
||
Cache-Control:
|
||
schema:
|
||
type: string
|
||
const: private, no-store
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/StatisticsUsersOverview"
|
||
"400":
|
||
$ref: "#/components/responses/ResourceError400"
|
||
"401":
|
||
$ref: "#/components/responses/ResourceError401"
|
||
"403":
|
||
$ref: "#/components/responses/ResourceError403"
|
||
"500":
|
||
$ref: "#/components/responses/ResourceError500"
|
||
/api/admin/v1/statistics/conversations:
|
||
get:
|
||
summary: 分页查询对话轮次历史
|
||
description: 仅管理员可访问。查询已启用上报、非占位、未删除且未清理的根会话轮次,包含空正文;不包含子会话。日期筛选按轮次开始时间,而非任务开始时间,未传日期不限制历史范围。每页多查一条生成 has_next,不执行 COUNT,不返回总数。
|
||
parameters:
|
||
- name: task
|
||
in: query
|
||
description: 按当前任务标题包含匹配,忽略大小写;百分号和下划线作为普通字符。
|
||
schema: {type: string, maxLength: 200}
|
||
- name: task_id
|
||
in: query
|
||
description: 精确匹配根会话 UUID,用于从任务历史进入对话历史。
|
||
schema: {type: string, format: uuid}
|
||
- name: user
|
||
in: query
|
||
description: 按用户当前姓名或邮箱包含匹配,忽略大小写。
|
||
schema: {type: string, maxLength: 200}
|
||
- name: content
|
||
in: query
|
||
description: 按已上报的对话正文包含匹配,忽略大小写;百分号和下划线作为普通字符。
|
||
schema: {type: string, maxLength: 200}
|
||
- name: from
|
||
in: query
|
||
description: 轮次开始时间下界,包含;须携带时区。
|
||
schema: {type: string, format: date-time}
|
||
- name: until
|
||
in: query
|
||
description: 轮次开始时间上界,不包含;须携带时区且晚于 from。日期筛选应传结束日期次日的本地零点。
|
||
schema: {type: string, format: date-time}
|
||
- name: page
|
||
in: query
|
||
description: 页码;超过最后一页时回退到最后一页。
|
||
schema: {type: integer, minimum: 1, maximum: 1000000, default: 1}
|
||
- name: page_size
|
||
in: query
|
||
description: 每页条数。
|
||
schema: {type: integer, minimum: 1, maximum: 500, default: 20}
|
||
responses:
|
||
"200":
|
||
description: 按轮次开始时间、会话 ID、轮次编号降序排列的真实对话记录。
|
||
headers:
|
||
Cache-Control:
|
||
schema: {type: string, const: 'private, no-store'}
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/StatisticsConversations"
|
||
"400":
|
||
$ref: "#/components/responses/ResourceError400"
|
||
"401":
|
||
$ref: "#/components/responses/ResourceError401"
|
||
"403":
|
||
$ref: "#/components/responses/ResourceError403"
|
||
"500":
|
||
$ref: "#/components/responses/ResourceError500"
|
||
/api/admin/v1/statistics/history:
|
||
get:
|
||
summary: 分页查询任务历史
|
||
description: 仅管理员可访问。每页多查一条生成 has_next,不执行总数或逐任务轮次 COUNT。对话数读取 sessions 的已校准缓存,存量后台校准期间为 null。
|
||
parameters:
|
||
- name: task
|
||
in: query
|
||
required: false
|
||
description: 按会话标题或 UUID 包含匹配;百分号和下划线作为普通字符。
|
||
schema:
|
||
type: string
|
||
maxLength: 200
|
||
- name: user
|
||
in: query
|
||
required: false
|
||
description: 按用户名或邮箱包含匹配,忽略大小写。
|
||
schema:
|
||
type: string
|
||
maxLength: 200
|
||
- name: from
|
||
in: query
|
||
required: false
|
||
description: 会话开始时间下界,包含;必须携带时区。
|
||
schema:
|
||
type: string
|
||
format: date-time
|
||
- name: until
|
||
in: query
|
||
required: false
|
||
description: 会话开始时间上界,不包含;必须晚于 from。日期筛选应传次日零点。
|
||
schema:
|
||
type: string
|
||
format: date-time
|
||
- name: page
|
||
in: query
|
||
required: false
|
||
description: 页码。
|
||
schema:
|
||
type: integer
|
||
minimum: 1
|
||
maximum: 1000000
|
||
default: 1
|
||
- name: page_size
|
||
in: query
|
||
required: false
|
||
description: 每页条数。
|
||
schema:
|
||
type: integer
|
||
minimum: 1
|
||
maximum: 500
|
||
default: 20
|
||
responses:
|
||
"200":
|
||
description: 统计结果。
|
||
headers:
|
||
Cache-Control:
|
||
schema:
|
||
type: string
|
||
const: private, no-store
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/StatisticsHistory"
|
||
"400":
|
||
$ref: "#/components/responses/ResourceError400"
|
||
"401":
|
||
$ref: "#/components/responses/ResourceError401"
|
||
"403":
|
||
$ref: "#/components/responses/ResourceError403"
|
||
"500":
|
||
$ref: "#/components/responses/ResourceError500"
|
||
/api/admin/v1/billing/settings:
|
||
get:
|
||
summary: 读取计费策略与远程连接状态(不返回证书或私钥)
|
||
responses:
|
||
'200':
|
||
description: 请求成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
policy:
|
||
$ref: '#/components/schemas/BillingPolicy'
|
||
wallet:
|
||
$ref: '#/components/schemas/BillingWalletInfo'
|
||
timezone:
|
||
const: Asia/Shanghai
|
||
next_refresh_at:
|
||
type: string
|
||
format: date-time
|
||
'400':
|
||
description: 参数不合法
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ErrorResponse'
|
||
'401':
|
||
description: 未登录
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ErrorResponse'
|
||
'403':
|
||
description: 权限不足
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ErrorResponse'
|
||
'409':
|
||
description: 修订号、幂等键或交易状态冲突
|
||
/api/admin/v1/billing/settings/{section}:
|
||
parameters:
|
||
- in: path
|
||
name: section
|
||
schema:
|
||
enum:
|
||
- pricing
|
||
- cycle
|
||
- mode
|
||
- wallet
|
||
required: true
|
||
patch:
|
||
summary: 独立保存计价、周期、模式或百智云连接配置
|
||
description: wallet 配置保存后无需重启,各实例在下次使用时读取。证书和私钥省略或留空时保留原值。首次保存必须提供全部证书。客户端证书与私钥须匹配且处于有效期,私钥须为 PKCS#8 ECDSA 格式。CA 须为有效的 CA 证书。服务 URL 或应用 ID 变更不能影响未完成的远程交易。校验仅在本地执行,不代表远程网络或账户权限验证成功。
|
||
responses:
|
||
'200':
|
||
description: 请求成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
policy:
|
||
$ref: '#/components/schemas/BillingPolicy'
|
||
wallet:
|
||
$ref: '#/components/schemas/BillingWalletInfo'
|
||
timezone:
|
||
const: Asia/Shanghai
|
||
next_refresh_at:
|
||
type: string
|
||
format: date-time
|
||
'400':
|
||
description: 参数不合法
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ErrorResponse'
|
||
'401':
|
||
description: 未登录
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ErrorResponse'
|
||
'403':
|
||
description: 权限不足
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ErrorResponse'
|
||
'409':
|
||
description: 修订号冲突,或未完成远程交易阻止服务 URL 或应用 ID 变更
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ErrorResponse'
|
||
'422':
|
||
description: 启用远程模式前须先配置有效证书
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ErrorResponse'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
oneOf:
|
||
- type: object
|
||
properties:
|
||
revision:
|
||
type: integer
|
||
input_credits_per_million_tokens:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
cached_input_credits_per_million_tokens:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
output_credits_per_million_tokens:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
required:
|
||
- revision
|
||
- input_credits_per_million_tokens
|
||
- cached_input_credits_per_million_tokens
|
||
- output_credits_per_million_tokens
|
||
- type: object
|
||
properties:
|
||
revision:
|
||
type: integer
|
||
quota_refresh_cycle:
|
||
enum:
|
||
- daily
|
||
- weekly
|
||
- monthly
|
||
required:
|
||
- revision
|
||
- quota_refresh_cycle
|
||
- type: object
|
||
properties:
|
||
revision:
|
||
type: integer
|
||
charging_mode:
|
||
description: local 为本地扣费;remote 为百智云扣费,仅具有有效百智云登录身份的用户可访问系统资源,用户自建资源仍遵循原授权。
|
||
enum:
|
||
- local
|
||
- remote
|
||
enabled:
|
||
type: boolean
|
||
required:
|
||
- revision
|
||
- charging_mode
|
||
- enabled
|
||
- $ref: '#/components/schemas/BillingWalletInput'
|
||
/api/admin/v1/billing/quotas:
|
||
get:
|
||
summary: 读取分组、成员额度与继承来源
|
||
description: 成员直接所属分组与成员管理一致;周期额度取各所属分组沿父级解析出的有效额度最大值,直属虚拟根节点的成员继承团队额度。
|
||
responses:
|
||
'200':
|
||
description: 请求成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
groups:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
description: 分组 UUID;虚拟根节点为 00000000-0000-0000-0000-000000000000。
|
||
parent_id:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
description: 父分组 UUID;仅虚拟根节点为 null,其子分组的父级为全零 UUID。
|
||
name:
|
||
type: string
|
||
credits:
|
||
anyOf:
|
||
- $ref: '#/components/schemas/CreditAmount'
|
||
- type: 'null'
|
||
allow_inherit:
|
||
type: boolean
|
||
description: 是否允许额度留空以继承父级,根节点为 false。
|
||
users:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
email:
|
||
type: string
|
||
avatar_url:
|
||
type: [string, 'null']
|
||
description: 成员当前头像地址;为空时使用默认头像。
|
||
status:
|
||
type: string
|
||
group_ids:
|
||
type: array
|
||
description: 成员直接所属的有效分组 UUID;未加入其他分组时仅包含虚拟根节点的全零 UUID。
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
effective_credits:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
balance_credits:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
description: 当前周期账户的账面剩余;尚未开户时等于有效周期额度。
|
||
available_credits:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
description: 当前周期账户的可用积分(等于账面剩余);尚未开户时等于有效周期额度。
|
||
inherited_from:
|
||
type: string
|
||
description: 最高有效额度的来源分组 UUID(含虚拟根的全零 UUID)。额度相同时按直接所属分组的创建时间、ID 稳定选取。
|
||
external_user_id:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
revision:
|
||
type: integer
|
||
effective_at:
|
||
type: string
|
||
format: date-time
|
||
'400':
|
||
description: 参数不合法
|
||
'401':
|
||
description: 未登录
|
||
'403':
|
||
description: 权限不足
|
||
'409':
|
||
description: 修订号、幂等键或交易状态冲突
|
||
put:
|
||
summary: 批量更新分组周期额度,下周期生效
|
||
responses:
|
||
'200':
|
||
description: 请求成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
groups:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
description: 分组 UUID;虚拟根节点为 00000000-0000-0000-0000-000000000000。
|
||
parent_id:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
description: 父分组 UUID;仅虚拟根节点为 null,其子分组的父级为全零 UUID。
|
||
name:
|
||
type: string
|
||
credits:
|
||
anyOf:
|
||
- $ref: '#/components/schemas/CreditAmount'
|
||
- type: 'null'
|
||
allow_inherit:
|
||
type: boolean
|
||
description: 是否允许额度留空以继承父级,根节点为 false。
|
||
users:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
email:
|
||
type: string
|
||
avatar_url:
|
||
type: [string, 'null']
|
||
description: 成员当前头像地址;为空时使用默认头像。
|
||
status:
|
||
type: string
|
||
group_ids:
|
||
type: array
|
||
description: 成员直接所属的有效分组 UUID;未加入其他分组时仅包含虚拟根节点的全零 UUID。
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
effective_credits:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
balance_credits:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
description: 当前周期账户的账面剩余;尚未开户时等于有效周期额度。
|
||
available_credits:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
description: 当前周期账户的可用积分(等于账面剩余);尚未开户时等于有效周期额度。
|
||
inherited_from:
|
||
type: string
|
||
description: 最高有效额度的来源分组 UUID(含虚拟根的全零 UUID)。额度相同时按直接所属分组的创建时间、ID 稳定选取。
|
||
external_user_id:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
revision:
|
||
type: integer
|
||
effective_at:
|
||
type: string
|
||
format: date-time
|
||
'400':
|
||
description: 参数不合法
|
||
'401':
|
||
description: 未登录
|
||
'403':
|
||
description: 权限不足
|
||
'409':
|
||
description: 修订号、幂等键或交易状态冲突
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
revision:
|
||
type: integer
|
||
changes:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
subject_type:
|
||
enum:
|
||
- group
|
||
id:
|
||
type: string
|
||
description: 分组 UUID;团队默认额度使用虚拟根的全零 UUID。
|
||
credits:
|
||
description: 非负整数积分;null 表示继承上级额度。
|
||
anyOf:
|
||
- $ref: '#/components/schemas/CreditAmount'
|
||
- type: 'null'
|
||
required:
|
||
- subject_type
|
||
- id
|
||
- credits
|
||
required:
|
||
- revision
|
||
- changes
|
||
/api/admin/v1/billing/quotas/reset:
|
||
post:
|
||
summary: 立即重置所选分组和成员的当前周期额度
|
||
description: 分组包含所有后代分组的成员;成员自动去重。仅直接计费模式可用。重置当前余额和周期额度快照,并记录重置流水与审计。
|
||
responses:
|
||
'200':
|
||
description: 重置成功或幂等重放成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
reset_count:
|
||
type: integer
|
||
required:
|
||
- reset_count
|
||
'400':
|
||
description: 请求格式不合法
|
||
'401':
|
||
description: 未登录
|
||
'403':
|
||
description: 权限不足
|
||
'404':
|
||
description: 分组或成员不存在
|
||
'409':
|
||
description: 非直接计费模式或幂等键冲突
|
||
'422':
|
||
description: 选择为空、数量超限或没有可重置成员
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
group_ids:
|
||
type: array
|
||
maxItems: 1000
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
user_ids:
|
||
type: array
|
||
maxItems: 1000
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
idempotency_key:
|
||
type: string
|
||
format: uuid
|
||
required:
|
||
- group_ids
|
||
- user_ids
|
||
- idempotency_key
|
||
/api/admin/v1/billing/accounts/{userID}:
|
||
parameters:
|
||
- in: path
|
||
name: userID
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
required: true
|
||
get:
|
||
summary: 查询当期积分账户
|
||
responses:
|
||
'200':
|
||
description: 请求成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
account:
|
||
$ref: '#/components/schemas/CreditAccount'
|
||
user_name:
|
||
type: string
|
||
description: 积分账户所属用户的当前姓名。
|
||
user_email:
|
||
type: string
|
||
format: email
|
||
description: 积分账户所属用户的当前邮箱。
|
||
external_user_id:
|
||
type: string
|
||
wallet:
|
||
$ref: '#/components/schemas/BillingWalletInfo'
|
||
wallet_available:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
wallet_queried_at:
|
||
type: string
|
||
format: date-time
|
||
wallet_error:
|
||
type: string
|
||
'400':
|
||
description: 参数不合法
|
||
'401':
|
||
description: 未登录
|
||
'403':
|
||
description: 权限不足
|
||
'409':
|
||
description: 修订号、幂等键或交易状态冲突
|
||
/api/admin/v1/billing/accounts/{userID}/adjustments:
|
||
parameters:
|
||
- in: path
|
||
name: userID
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
required: true
|
||
post:
|
||
summary: 幂等调整当期积分
|
||
responses:
|
||
'200':
|
||
description: 请求成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
oneOf:
|
||
- type: object
|
||
properties:
|
||
account:
|
||
$ref: '#/components/schemas/CreditAccount'
|
||
external_user_id:
|
||
type: string
|
||
wallet:
|
||
$ref: '#/components/schemas/BillingWalletInfo'
|
||
wallet_available:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
wallet_queried_at:
|
||
type: string
|
||
format: date-time
|
||
wallet_error:
|
||
type: string
|
||
- $ref: '#/components/schemas/CreditAccount'
|
||
'400':
|
||
description: 参数不合法
|
||
'401':
|
||
description: 未登录
|
||
'403':
|
||
description: 权限不足
|
||
'409':
|
||
description: 该账户版本已提交过不同的调整
|
||
'412':
|
||
description: 账户版本已过期,请刷新后重试
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
delta:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
reason:
|
||
type: string
|
||
minLength: 1
|
||
maxLength: 500
|
||
version:
|
||
type: string
|
||
description: 读取当前账户时返回的版本。相同版本与内容重试不会重复调整;账户变化后须刷新版本。
|
||
maxLength: 128
|
||
required:
|
||
- delta
|
||
- reason
|
||
- version
|
||
/api/admin/v1/billing/accounts/{userID}/wallet:
|
||
parameters:
|
||
- in: path
|
||
name: userID
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
required: true
|
||
put:
|
||
summary: 核实并绑定百智云身份,有未完成远程交易时拒绝修改
|
||
description: external_user_id 必须匹配该用户有效百智云登录身份的 sub;普通 OAuth/OIDC 身份和历史手动绑定不能代替百智云身份。未指定绑定且只有一个百智云身份时自动使用其 sub。
|
||
responses:
|
||
'204':
|
||
description: 绑定成功
|
||
'400':
|
||
description: 参数不合法
|
||
'401':
|
||
description: 未登录
|
||
'403':
|
||
description: 权限不足
|
||
'409':
|
||
description: 修订号、幂等键或交易状态冲突
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
external_user_id:
|
||
type: string
|
||
required:
|
||
- external_user_id
|
||
/api/admin/v1/billing/users:
|
||
get:
|
||
summary: 按需搜索扣费筛选的用户候选
|
||
description: 搜索当前用户姓名、邮箱或 ID,包含停用和已删除用户,以便查询其历史流水。返回有界候选而非全量成员;选中后向 entries 或 summary 传 user_id。未选中时仍可通过 user 搜索历史姓名和邮箱。
|
||
parameters:
|
||
- in: query
|
||
name: q
|
||
description: 不区分大小写的字面子串,去除首尾空格后最多 200 个字符。
|
||
schema:
|
||
type: string
|
||
maxLength: 200
|
||
- in: query
|
||
name: id
|
||
description: 用于恢复 URL 中已选用户的显示信息;可与 q 同时提供,取交集。
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
- in: query
|
||
name: limit
|
||
schema:
|
||
type: integer
|
||
default: 20
|
||
minimum: 1
|
||
maximum: 50
|
||
responses:
|
||
'200':
|
||
description: 返回姓名、邮箱、头像和删除标记,不返回账户、角色或登录等信息。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [items, has_next]
|
||
properties:
|
||
has_next:
|
||
type: boolean
|
||
items:
|
||
type: array
|
||
items:
|
||
type: object
|
||
required: [id, name, email, avatar_url, deleted]
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
email:
|
||
type: string
|
||
avatar_url:
|
||
type: [string, 'null']
|
||
deleted:
|
||
type: boolean
|
||
'400':
|
||
description: 参数不合法
|
||
'401':
|
||
description: 未登录
|
||
'403':
|
||
description: 权限不足
|
||
/api/admin/v1/billing/entries:
|
||
get:
|
||
summary: 分页查询不可变积分流水
|
||
description: 读取不可变账本,不执行 COUNT 或返回精确总数。每页最多查询 page_size 加一条,以 has_next 判断后续页。时间范围为左闭右开;from 和 until 均未传入时,默认北京时间最近 28 个自然日(含今天)。range=all 显式取消默认范围;已提供的单侧或双侧时间条件保持原样。响应 from/until 返回实际生效的边界。
|
||
responses:
|
||
'200':
|
||
description: 请求成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/CreditEntry'
|
||
has_next:
|
||
type: boolean
|
||
from:
|
||
type: [string, 'null']
|
||
format: date-time
|
||
until:
|
||
type: [string, 'null']
|
||
format: date-time
|
||
page:
|
||
type: integer
|
||
page_size:
|
||
type: integer
|
||
'400':
|
||
description: 参数不合法
|
||
'401':
|
||
description: 未登录
|
||
'403':
|
||
description: 权限不足
|
||
'409':
|
||
description: 修订号、幂等键或交易状态冲突
|
||
parameters:
|
||
- in: query
|
||
name: user_id
|
||
description: 按用户 UUID 精确筛选,利用现有用户与时间索引;与其他筛选条件取交集。
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
- in: query
|
||
name: user
|
||
description: 对流水固化的历史姓名或邮箱做子串搜索;与 user_id 同时提供时取交集。
|
||
schema:
|
||
type: string
|
||
- in: query
|
||
name: content
|
||
schema:
|
||
type: string
|
||
- in: query
|
||
name: category
|
||
schema:
|
||
type: string
|
||
- in: query
|
||
name: mode
|
||
schema:
|
||
type: string
|
||
- in: query
|
||
name: entry_type
|
||
schema:
|
||
type: string
|
||
- in: query
|
||
name: group_id
|
||
schema:
|
||
type: string
|
||
- in: query
|
||
name: from
|
||
schema:
|
||
type: string
|
||
format: date-time
|
||
- in: query
|
||
name: until
|
||
schema:
|
||
type: string
|
||
format: date-time
|
||
- in: query
|
||
name: page
|
||
schema:
|
||
type: integer
|
||
minimum: 1
|
||
- in: query
|
||
name: page_size
|
||
schema:
|
||
type: integer
|
||
minimum: 1
|
||
maximum: 500
|
||
- in: query
|
||
name: range
|
||
description: 仅支持 all,表示显式取消缺省时间范围;仍保留已提供的 from/until。
|
||
schema:
|
||
type: string
|
||
enum: [all]
|
||
/api/admin/v1/billing/summary:
|
||
get:
|
||
summary: 按同一筛选口径汇总扣费和退款
|
||
responses:
|
||
'200':
|
||
description: 请求成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
charges:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
refunds:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
net_consumption:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
count:
|
||
type: integer
|
||
'400':
|
||
description: 参数不合法
|
||
'401':
|
||
description: 未登录
|
||
'403':
|
||
description: 权限不足
|
||
'409':
|
||
description: 修订号、幂等键或交易状态冲突
|
||
parameters:
|
||
- in: query
|
||
name: user_id
|
||
description: 按用户 UUID 精确筛选,利用现有用户与时间索引;与其他筛选条件取交集。
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
- in: query
|
||
name: user
|
||
description: 对流水固化的历史姓名或邮箱做子串搜索;与 user_id 同时提供时取交集。
|
||
schema:
|
||
type: string
|
||
- in: query
|
||
name: content
|
||
schema:
|
||
type: string
|
||
- in: query
|
||
name: category
|
||
schema:
|
||
type: string
|
||
- in: query
|
||
name: mode
|
||
schema:
|
||
type: string
|
||
- in: query
|
||
name: entry_type
|
||
schema:
|
||
type: string
|
||
- in: query
|
||
name: group_id
|
||
schema:
|
||
type: string
|
||
- in: query
|
||
name: from
|
||
schema:
|
||
type: string
|
||
format: date-time
|
||
- in: query
|
||
name: until
|
||
schema:
|
||
type: string
|
||
format: date-time
|
||
/api/admin/v1/billing/reconciliation:
|
||
get:
|
||
summary: 查询未完成交易、本地账目差异和旧配置迁移问题
|
||
responses:
|
||
'200':
|
||
description: 请求成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/BillingTransaction'
|
||
total:
|
||
type: integer
|
||
page:
|
||
type: integer
|
||
page_size:
|
||
type: integer
|
||
differences:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
account_id:
|
||
type: string
|
||
format: uuid
|
||
user_id:
|
||
type: string
|
||
format: uuid
|
||
balance:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
ledger_balance:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
frozen:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
description: 遗留冻结额,迁移后通常为零;非零时作为账目异常报告。
|
||
migration_issues:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: integer
|
||
subject:
|
||
type: string
|
||
value: {}
|
||
reason:
|
||
type: string
|
||
'400':
|
||
description: 参数不合法
|
||
'401':
|
||
description: 未登录
|
||
'403':
|
||
description: 权限不足
|
||
'409':
|
||
description: 修订号、幂等键或交易状态冲突
|
||
parameters:
|
||
- in: query
|
||
name: page
|
||
schema:
|
||
type: integer
|
||
minimum: 1
|
||
- in: query
|
||
name: page_size
|
||
schema:
|
||
type: integer
|
||
minimum: 1
|
||
maximum: 500
|
||
/api/admin/v1/billing/transactions/{id}:
|
||
parameters:
|
||
- in: path
|
||
name: id
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
required: true
|
||
get:
|
||
summary: 读取调用、用量、价格快照、流水及钱包记录
|
||
responses:
|
||
'200':
|
||
description: 请求成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/BillingTransaction'
|
||
'400':
|
||
description: 参数不合法
|
||
'401':
|
||
description: 未登录
|
||
'403':
|
||
description: 权限不足
|
||
'409':
|
||
description: 修订号、幂等键或交易状态冲突
|
||
/api/admin/v1/billing/transactions/{id}/retry:
|
||
parameters:
|
||
- in: path
|
||
name: id
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
required: true
|
||
post:
|
||
summary: 重试已确定用量的待结算交易
|
||
responses:
|
||
'200':
|
||
description: 请求成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/BillingTransaction'
|
||
'400':
|
||
description: 参数不合法
|
||
'401':
|
||
description: 未登录
|
||
'403':
|
||
description: 权限不足
|
||
'409':
|
||
description: 修订号、幂等键或交易状态冲突
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties: {}
|
||
/api/admin/v1/billing/transactions/{id}/resolve:
|
||
parameters:
|
||
- in: path
|
||
name: id
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
required: true
|
||
post:
|
||
summary: 按核实证据处理结果未知的交易
|
||
responses:
|
||
'200':
|
||
description: 请求成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/BillingTransaction'
|
||
'400':
|
||
description: 参数不合法
|
||
'401':
|
||
description: 未登录
|
||
'403':
|
||
description: 权限不足
|
||
'409':
|
||
description: 修订号、幂等键或交易状态冲突
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
usage:
|
||
$ref: '#/components/schemas/BillingUsage'
|
||
reason:
|
||
type: string
|
||
required:
|
||
- usage
|
||
- reason
|
||
/api/admin/v1/billing/transactions/{id}/refund:
|
||
parameters:
|
||
- in: path
|
||
name: id
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
required: true
|
||
post:
|
||
summary: 全额冲正本地已结算扣款,同一交易只退款一次
|
||
responses:
|
||
'200':
|
||
description: 请求成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/BillingTransaction'
|
||
'400':
|
||
description: 参数不合法
|
||
'401':
|
||
description: 未登录
|
||
'403':
|
||
description: 权限不足
|
||
'409':
|
||
description: 修订号、幂等键或交易状态冲突
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
reason:
|
||
type: string
|
||
required:
|
||
- reason
|
||
/api/admin/v1/users:
|
||
post:
|
||
summary: 创建用户并加入分组
|
||
description: 创建用户与写入全部直接分组关系在同一事务内完成,任一失败全部回滚。group_ids 未传、为 null 或为空数组时不建立分组关系,用户自动显示在虚拟根分组下。重复分组 ID 自动去重,不可选择根分组、不存在或已删除的分组。只加入指定分组,不自动加入其父分组或子分组。批量添加可逐个调用此接口,每个用户独立提交。
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/CreateAdminUserInput'
|
||
responses:
|
||
'201':
|
||
description: 用户及全部分组关系已创建。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/EmailAuthUser'
|
||
'400':
|
||
description: invalid_request,请求字段或所选分组无效,未创建用户。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ErrorResponse'
|
||
'401':
|
||
$ref: '#/components/responses/Unauthorized'
|
||
'403':
|
||
$ref: '#/components/responses/Forbidden'
|
||
'409':
|
||
description: user_exists,该邮箱已被未删除用户占用。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ErrorResponse'
|
||
'500':
|
||
description: server_error,创建失败,用户与分组关系全部回滚。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ErrorResponse'
|
||
/api/admin/v1/users/{userID}:
|
||
parameters:
|
||
- in: path
|
||
name: userID
|
||
required: true
|
||
description: 成员 UUID。
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
get:
|
||
summary: 根据 ID 查询成员资料
|
||
description: 返回当前成员的姓名、邮箱、角色、状态、加入时间和最近登录时间。已删除或不存在的成员返回 404。
|
||
responses:
|
||
'200':
|
||
description: 成员资料。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/EmailAuthUser'
|
||
'401':
|
||
$ref: '#/components/responses/Unauthorized'
|
||
'403':
|
||
$ref: '#/components/responses/Forbidden'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
/api/admin/v1/users/{userID}/reset-password:
|
||
parameters:
|
||
- in: path
|
||
name: userID
|
||
required: true
|
||
description: 成员 UUID。
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
post:
|
||
summary: 管理员重置成员密码
|
||
description: 生成包含数字及大小写字母的 16 位随机密码,替换指定成员的密码并撤销旧会话、OAuth token、授权码与未使用的登录和重置验证码。被停用的成员仍保持停用。密码明文只在本次响应返回,客户端不得缓存或记录。
|
||
responses:
|
||
"200":
|
||
description: 密码已重置,仅本次响应包含新密码。
|
||
headers:
|
||
Cache-Control:
|
||
schema:
|
||
type: string
|
||
const: no-store
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [password]
|
||
properties:
|
||
password:
|
||
type: string
|
||
minLength: 16
|
||
maxLength: 16
|
||
pattern: "^[A-Za-z0-9]{16}$"
|
||
description: 仅本次返回的随机密码。
|
||
"401":
|
||
$ref: "#/components/responses/Unauthorized"
|
||
"403":
|
||
$ref: "#/components/responses/Forbidden"
|
||
"404":
|
||
$ref: "#/components/responses/ResourceError404"
|
||
"500":
|
||
$ref: "#/components/responses/ResourceError500"
|
||
/api/admin/v1/groups:
|
||
get:
|
||
summary: 查询成员分组
|
||
description: 返回全零 UUID 的虚拟根分组和全部未删除子分组。根节点不入库,名称来自 branding.workspace_name,直属成员为未直接加入其他有效分组的用户;真实顶层分组的 parent_id 在响应中为根分组 UUID,数据库中仍为 null。actions 和 allow_add_members 由后端决定。
|
||
responses:
|
||
"200":
|
||
description: 分组列表
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/MemberGroupsResponse"
|
||
"401":
|
||
$ref: "#/components/responses/Unauthorized"
|
||
"403":
|
||
$ref: "#/components/responses/Forbidden"
|
||
"500":
|
||
$ref: "#/components/responses/ResourceError500"
|
||
post:
|
||
summary: 创建子分组
|
||
description: 名称去除首尾空白后须为 1—100 个字符,同级名称不区分大小写且不能重复。parent_id 为全零 UUID、null 或省略时,创建根节点的直属子分组。
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/CreateMemberGroupInput"
|
||
responses:
|
||
"201":
|
||
description: 已创建分组
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/MemberGroup"
|
||
"400":
|
||
$ref: "#/components/responses/ResourceError400"
|
||
"401":
|
||
$ref: "#/components/responses/Unauthorized"
|
||
"403":
|
||
$ref: "#/components/responses/Forbidden"
|
||
"404":
|
||
$ref: "#/components/responses/ResourceError404"
|
||
"409":
|
||
$ref: "#/components/responses/ResourceError409"
|
||
"500":
|
||
$ref: "#/components/responses/ResourceError500"
|
||
/api/admin/v1/groups/move:
|
||
post:
|
||
summary: 批量移动分组或成员
|
||
description: 管理员确认拖放预览后一次提交,全部变更在同一事务中完成。不能混合移动分组与成员;移动父分组会保留子树,不能同时选择其子分组、移动到自身/后代或在目标下造成同名冲突。树中成员仅移除指定来源分组,保留其他分组关系;未指定来源的列表成员只加入目标分组。全零 UUID 为虚拟根目标,不能直接增加成员关系。
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/MemberGroupMoveInput"
|
||
responses:
|
||
"204":
|
||
description: 批量移动成功,无响应体。
|
||
"400":
|
||
$ref: "#/components/responses/ResourceError400"
|
||
"401":
|
||
$ref: "#/components/responses/Unauthorized"
|
||
"403":
|
||
$ref: "#/components/responses/Forbidden"
|
||
"404":
|
||
$ref: "#/components/responses/ResourceError404"
|
||
"409":
|
||
$ref: "#/components/responses/ResourceError409"
|
||
"500":
|
||
$ref: "#/components/responses/ResourceError500"
|
||
/api/admin/v1/groups/{groupID}:
|
||
parameters:
|
||
- in: path
|
||
name: groupID
|
||
required: true
|
||
description: 分组 UUID。
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
patch:
|
||
summary: 修改分组名称或上级分组
|
||
description: 至少指定 name 或 parent_id。parent_id 为全零 UUID 或 null 表示移动到根节点下,省略则保留原上级。不能移动到自身或后代中;更换上级会改变成员继承的资源授权。
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/MemberGroupInput"
|
||
responses:
|
||
"200":
|
||
description: 已更新分组
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/MemberGroup"
|
||
"400":
|
||
$ref: "#/components/responses/ResourceError400"
|
||
"401":
|
||
$ref: "#/components/responses/Unauthorized"
|
||
"403":
|
||
$ref: "#/components/responses/Forbidden"
|
||
"404":
|
||
$ref: "#/components/responses/ResourceError404"
|
||
"409":
|
||
$ref: "#/components/responses/ResourceError409"
|
||
"500":
|
||
$ref: "#/components/responses/ResourceError500"
|
||
delete:
|
||
summary: 删除分组
|
||
description: 有子分组时返回 409。软删除分组、移除直接成员关系并清除本组资源授权,保留成员账号;额度自动按其余所属分组重新计算,不改变当期账户。
|
||
responses:
|
||
"204":
|
||
description: 已删除,无响应体。
|
||
"400":
|
||
$ref: "#/components/responses/ResourceError400"
|
||
"401":
|
||
$ref: "#/components/responses/Unauthorized"
|
||
"403":
|
||
$ref: "#/components/responses/Forbidden"
|
||
"404":
|
||
$ref: "#/components/responses/ResourceError404"
|
||
"409":
|
||
$ref: "#/components/responses/ResourceError409"
|
||
"500":
|
||
$ref: "#/components/responses/ResourceError500"
|
||
/api/admin/v1/groups/{groupID}/members:
|
||
parameters:
|
||
- in: path
|
||
name: groupID
|
||
required: true
|
||
description: 分组 UUID。
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
put:
|
||
summary: 替换分组直接成员
|
||
description: 调整直接成员关系,不改变用户角色或子分组成员。空数组清空直接成员,重复 ID 自动去重。成员额度随分组关系继承,多个分组取最高有效额度;变更不重发当期额度。
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/MemberGroupMembersInput"
|
||
responses:
|
||
"200":
|
||
description: 已更新成员关系
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/MemberGroup"
|
||
"400":
|
||
$ref: "#/components/responses/ResourceError400"
|
||
"401":
|
||
$ref: "#/components/responses/Unauthorized"
|
||
"403":
|
||
$ref: "#/components/responses/Forbidden"
|
||
"404":
|
||
$ref: "#/components/responses/ResourceError404"
|
||
"409":
|
||
$ref: "#/components/responses/ResourceError409"
|
||
"500":
|
||
$ref: "#/components/responses/ResourceError500"
|
||
/api/admin/v1/models:
|
||
get:
|
||
summary: 查询模型
|
||
description: |
|
||
按 ownership_type 分别查询系统或用户模型。q 按名称、模型 ID 或上游地址进行不区分大小写的字面子串搜索。
|
||
提供 limit、cursor 或 q 时启用按 ID 稳定排序的游标分页;筛选在分页前执行,切换类型或关键词时应清空 cursor。
|
||
未提供上述三个参数时保留完整列表及创建时间倒序;next_cursor 为空表示无后续页。
|
||
parameters:
|
||
- in: query
|
||
name: q
|
||
description: 按名称、模型 ID 或上游地址搜索;空值不筛选。
|
||
schema: {type: string}
|
||
- in: query
|
||
name: cursor
|
||
description: 上一页返回的 next_cursor。
|
||
schema: {type: string}
|
||
- in: query
|
||
name: limit
|
||
description: 单页数量;提供分页参数时默认 200。
|
||
schema: {type: integer, minimum: 1, maximum: 500, default: 200}
|
||
- in: query
|
||
name: ownership_type
|
||
description: 按模型所有权类型筛选;不传时不过滤所有权类型。
|
||
schema:
|
||
type: string
|
||
enum: [system, user]
|
||
responses:
|
||
"200":
|
||
description: 模型列表
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/ModelsResponse"
|
||
"400":
|
||
$ref: "#/components/responses/BadRequest"
|
||
"401":
|
||
$ref: "#/components/responses/Unauthorized"
|
||
"403":
|
||
$ref: "#/components/responses/Forbidden"
|
||
post:
|
||
summary: 创建系统模型
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/CreateModelInput"
|
||
responses:
|
||
"201":
|
||
description: 创建成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/Model"
|
||
"400":
|
||
$ref: "#/components/responses/BadRequest"
|
||
"401":
|
||
$ref: "#/components/responses/Unauthorized"
|
||
"403":
|
||
$ref: "#/components/responses/Forbidden"
|
||
/api/admin/v1/models/discover:
|
||
post:
|
||
summary: 使用上游连接配置查询可用的大语言模型
|
||
description: 服务端 GET Base URL 下的 models 接口,使用对应协议鉴权;不跟随重定向、不返回密钥。支持已保存密钥和网络代理,超时 15 秒,响应不缓存。
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [base_url, protocol]
|
||
anyOf:
|
||
- required: [api_key]
|
||
properties:
|
||
api_key: {minLength: 1}
|
||
- required: [model_resource_id]
|
||
properties:
|
||
base_url: {type: string, format: uri}
|
||
protocol: {type: string, enum: [openai_chat_completions, openai_responses, anthropic]}
|
||
api_key: {type: string, writeOnly: true, maxLength: 16384, description: 编辑已有系统文本模型时可留空,以使用其已保存密钥。}
|
||
model_resource_id: {type: string, format: uuid}
|
||
proxy_id: {type: string, description: 网络代理 ID;空字符串表示不使用代理。}
|
||
responses:
|
||
'200':
|
||
description: 按 ID 排序并去重的模型列表;上游分页会被合并,最多 2000 个。
|
||
headers:
|
||
Cache-Control: {schema: {type: string, enum: [no-store]}}
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [models]
|
||
properties:
|
||
models:
|
||
type: array
|
||
maxItems: 2000
|
||
items:
|
||
type: object
|
||
required: [id]
|
||
properties:
|
||
id: {type: string}
|
||
'400': {$ref: '#/components/responses/BadRequest'}
|
||
'401': {$ref: '#/components/responses/Unauthorized'}
|
||
'403': {$ref: '#/components/responses/Forbidden'}
|
||
'502':
|
||
description: 上游请求失败或模型列表响应无效。
|
||
content:
|
||
application/json:
|
||
schema: {$ref: '#/components/schemas/ErrorResponse'}
|
||
'504':
|
||
description: 上游请求超时。
|
||
content:
|
||
application/json:
|
||
schema: {$ref: '#/components/schemas/ErrorResponse'}
|
||
/api/admin/v1/models/image-capabilities:
|
||
get:
|
||
summary: 查询生图模型支持的画质、比例和操作
|
||
parameters:
|
||
- {name: provider, in: query, required: true, schema: {$ref: '#/components/schemas/ModelProvider'}}
|
||
responses:
|
||
'200':
|
||
description: 供应商代码声明的原始能力,供管理员选择开放画质与比例。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [operations, qualities, aspect_ratios, max_images, max_reference_images, supports_reference_image, supports_mask]
|
||
properties:
|
||
operations: {type: array, items: {type: string, enum: [generate, edit]}}
|
||
qualities: {type: array, items: {$ref: '#/components/schemas/ImageQuality'}}
|
||
aspect_ratios: {type: array, items: {type: string}}
|
||
allowed_aspect_ratios: {type: object}
|
||
max_images: {type: integer, minimum: 1}
|
||
max_reference_images: {type: integer, minimum: 0}
|
||
supports_reference_image: {type: boolean}
|
||
supports_mask: {type: boolean}
|
||
'400': {$ref: '#/components/responses/ResourceError400'}
|
||
'401': {$ref: '#/components/responses/Unauthorized'}
|
||
'403': {$ref: '#/components/responses/Forbidden'}
|
||
/api/admin/v1/models/authorization-subjects:
|
||
get:
|
||
summary: 查询可授权的用户和分组
|
||
responses:
|
||
"200":
|
||
description: 授权对象
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/AuthorizationSubjects"
|
||
"401":
|
||
$ref: "#/components/responses/Unauthorized"
|
||
"403":
|
||
$ref: "#/components/responses/Forbidden"
|
||
"500":
|
||
$ref: "#/components/responses/InternalError"
|
||
/api/admin/v1/models/{modelID}:
|
||
parameters:
|
||
- $ref: "#/components/parameters/ModelID"
|
||
put:
|
||
summary: 更新系统模型
|
||
description: api_key 为空时保留原有上游密钥。
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/ModelInput"
|
||
responses:
|
||
"200":
|
||
description: 更新成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/Model"
|
||
"400":
|
||
$ref: "#/components/responses/BadRequest"
|
||
"401":
|
||
$ref: "#/components/responses/Unauthorized"
|
||
"403":
|
||
$ref: "#/components/responses/Forbidden"
|
||
"404":
|
||
$ref: "#/components/responses/NotFound"
|
||
delete:
|
||
summary: 删除系统模型
|
||
responses:
|
||
"204":
|
||
description: 删除成功,无响应体。
|
||
"401":
|
||
$ref: "#/components/responses/Unauthorized"
|
||
"403":
|
||
$ref: "#/components/responses/Forbidden"
|
||
"404":
|
||
$ref: "#/components/responses/NotFound"
|
||
"500":
|
||
$ref: "#/components/responses/InternalError"
|
||
/api/admin/v1/models/{modelID}/enabled:
|
||
parameters:
|
||
- $ref: "#/components/parameters/ModelID"
|
||
patch:
|
||
summary: 启用或停用系统模型
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/SetModelEnabledInput"
|
||
responses:
|
||
"200":
|
||
description: 更新成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/Model"
|
||
"400":
|
||
$ref: "#/components/responses/BadRequest"
|
||
"401":
|
||
$ref: "#/components/responses/Unauthorized"
|
||
"403":
|
||
$ref: "#/components/responses/Forbidden"
|
||
"404":
|
||
$ref: "#/components/responses/NotFound"
|
||
"500":
|
||
$ref: "#/components/responses/InternalError"
|
||
/api/admin/v1/api-keys:
|
||
get:
|
||
summary: 查询调用密钥
|
||
parameters:
|
||
- in: query
|
||
name: user_id
|
||
description: 按密钥所属用户筛选;不传时返回全部调用密钥。
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
responses:
|
||
'200':
|
||
description: 调用密钥元数据列表,不包含密钥原文。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/APIKeysResponse'
|
||
'401':
|
||
$ref: '#/components/responses/Unauthorized'
|
||
'403':
|
||
$ref: '#/components/responses/Forbidden'
|
||
'500':
|
||
$ref: '#/components/responses/InternalError'
|
||
/api/admin/v1/api-keys/{keyID}:
|
||
parameters:
|
||
- $ref: '#/components/parameters/KeyID'
|
||
delete:
|
||
summary: 管理员撤销调用密钥
|
||
responses:
|
||
'204':
|
||
description: 撤销成功,无响应体。
|
||
'401':
|
||
$ref: '#/components/responses/Unauthorized'
|
||
'403':
|
||
$ref: '#/components/responses/Forbidden'
|
||
'404':
|
||
$ref: '#/components/responses/NotFound'
|
||
'500':
|
||
$ref: '#/components/responses/InternalError'
|
||
/api/admin/v1/feedback:
|
||
get:
|
||
summary: 分页查询用户反馈
|
||
parameters:
|
||
- name: page
|
||
in: query
|
||
schema: {type: integer, minimum: 1, maximum: 1000000, default: 1}
|
||
- name: page_size
|
||
in: query
|
||
schema: {type: integer, minimum: 1, maximum: 500, default: 20}
|
||
- name: category
|
||
in: query
|
||
schema: {type: string, enum: [bug, feature, experience, other]}
|
||
- name: state
|
||
in: query
|
||
schema: {type: string, enum: [uploading, new, resolved, ignored, failed]}
|
||
responses:
|
||
'200':
|
||
description: 反馈分页
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/FeedbackPage'
|
||
'400': {$ref: '#/components/responses/ResourceError400'}
|
||
'401': {$ref: '#/components/responses/ResourceError401'}
|
||
'403': {$ref: '#/components/responses/ResourceError403'}
|
||
'500': {$ref: '#/components/responses/ResourceError500'}
|
||
/api/admin/v1/feedback/{id}:
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema: {type: string, format: uuid}
|
||
get:
|
||
summary: 读取用户反馈详情
|
||
responses:
|
||
'200':
|
||
description: 反馈详情
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/Feedback'
|
||
'401': {$ref: '#/components/responses/ResourceError401'}
|
||
'403': {$ref: '#/components/responses/ResourceError403'}
|
||
'404': {$ref: '#/components/responses/ResourceError404'}
|
||
'500': {$ref: '#/components/responses/ResourceError500'}
|
||
patch:
|
||
summary: 更新用户反馈状态
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
additionalProperties: false
|
||
required: [state]
|
||
properties:
|
||
state:
|
||
type: string
|
||
enum: [uploading, new, resolved, ignored, failed]
|
||
responses:
|
||
'200':
|
||
description: 更新后的反馈
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/Feedback'
|
||
'400': {$ref: '#/components/responses/ResourceError400'}
|
||
'401': {$ref: '#/components/responses/ResourceError401'}
|
||
'403': {$ref: '#/components/responses/ResourceError403'}
|
||
'404': {$ref: '#/components/responses/ResourceError404'}
|
||
'500': {$ref: '#/components/responses/ResourceError500'}
|
||
/api/admin/v1/feedback/{id}/attachments/{attachmentID}:
|
||
get:
|
||
summary: 下载用户反馈图片
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema: {type: string, format: uuid}
|
||
- name: attachmentID
|
||
in: path
|
||
required: true
|
||
schema: {type: string, format: uuid}
|
||
responses:
|
||
'200':
|
||
description: 反馈图片
|
||
content:
|
||
image/png: {schema: {type: string, format: binary}}
|
||
image/jpeg: {schema: {type: string, format: binary}}
|
||
image/webp: {schema: {type: string, format: binary}}
|
||
'401': {$ref: '#/components/responses/ResourceError401'}
|
||
'403': {$ref: '#/components/responses/ResourceError403'}
|
||
'404': {$ref: '#/components/responses/ResourceError404'}
|
||
'500': {$ref: '#/components/responses/ResourceError500'}
|
||
/api/admin/v1/rules:
|
||
get:
|
||
summary: 查询Rule
|
||
description: |
|
||
按 ownership_type 筛选系统或用户规则;省略时返回两类规则。
|
||
q 对名称和完整规则内容进行不区分大小写的字面子串搜索;空值不筛选。
|
||
筛选在游标分页前执行;切换类型或搜索关键词时应清空 cursor。
|
||
limit 控制单页数量,后续页使用 next_cursor 请求,不返回已删除的规则。
|
||
responses:
|
||
'200':
|
||
description: 查询Rule
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/RuleResource'
|
||
next_cursor:
|
||
type: string
|
||
required:
|
||
- items
|
||
- next_cursor
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: ownership_type
|
||
in: query
|
||
schema:
|
||
type: string
|
||
enum:
|
||
- system
|
||
- user
|
||
- name: q
|
||
in: query
|
||
schema:
|
||
type: string
|
||
- name: cursor
|
||
in: query
|
||
schema:
|
||
type: string
|
||
- name: limit
|
||
in: query
|
||
schema:
|
||
type: integer
|
||
minimum: 1
|
||
maximum: 500
|
||
default: 200
|
||
post:
|
||
summary: 创建Rule
|
||
responses:
|
||
'200':
|
||
description: 创建Rule
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/RuleResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/RuleInput'
|
||
/api/admin/v1/rules/{id}:
|
||
get:
|
||
summary: 读取Rule
|
||
responses:
|
||
'200':
|
||
description: 读取Rule
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/RuleResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
put:
|
||
summary: 更新Rule
|
||
responses:
|
||
'200':
|
||
description: 更新Rule
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/RuleResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/RuleInput'
|
||
parameters:
|
||
- name: If-Match
|
||
in: header
|
||
required: true
|
||
description: 上次读取返回的 ETag,例如 "1"。
|
||
schema:
|
||
type: string
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
delete:
|
||
summary: 删除Rule
|
||
responses:
|
||
'204':
|
||
description: 删除Rule
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: If-Match
|
||
in: header
|
||
required: true
|
||
description: 上次读取返回的 ETag,例如 "1"。
|
||
schema:
|
||
type: string
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
/api/admin/v1/skills:
|
||
get:
|
||
summary: 查询Skill
|
||
description: |
|
||
按 ownership_type 筛选系统或用户技能;q 对名称和描述进行不区分大小写的字面子串搜索。
|
||
筛选在游标分页前执行;切换类型或关键词时应清空 cursor。limit 控制单页数量,next_cursor 为空表示无后续页。
|
||
responses:
|
||
'200':
|
||
description: 查询Skill
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/SkillResource'
|
||
next_cursor:
|
||
type: string
|
||
required:
|
||
- items
|
||
- next_cursor
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: ownership_type
|
||
in: query
|
||
schema:
|
||
type: string
|
||
enum:
|
||
- system
|
||
- user
|
||
- name: q
|
||
in: query
|
||
schema:
|
||
type: string
|
||
- name: cursor
|
||
in: query
|
||
schema:
|
||
type: string
|
||
- name: limit
|
||
in: query
|
||
schema:
|
||
type: integer
|
||
minimum: 1
|
||
maximum: 500
|
||
default: 200
|
||
post:
|
||
summary: 创建Skill
|
||
responses:
|
||
'200':
|
||
description: 创建Skill
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/SkillResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
multipart/form-data:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
package:
|
||
type: string
|
||
format: binary
|
||
description: 最多 500 MiB ZIP,解包最多 1 GiB。
|
||
metadata:
|
||
type: string
|
||
description: JSON 字符串,包含 tag_ids 和 grants。
|
||
required:
|
||
- package
|
||
/api/admin/v1/skills/{id}:
|
||
get:
|
||
summary: 读取Skill
|
||
responses:
|
||
'200':
|
||
description: 读取Skill
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/SkillResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
put:
|
||
summary: 更新Skill
|
||
responses:
|
||
'200':
|
||
description: 更新Skill
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/SkillResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/SkillInput'
|
||
parameters:
|
||
- name: If-Match
|
||
in: header
|
||
required: true
|
||
description: 上次读取返回的 ETag,例如 "1"。
|
||
schema:
|
||
type: string
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
delete:
|
||
summary: 删除Skill
|
||
responses:
|
||
'204':
|
||
description: 删除Skill
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: If-Match
|
||
in: header
|
||
required: true
|
||
description: 上次读取返回的 ETag,例如 "1"。
|
||
schema:
|
||
type: string
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
/api/admin/v1/skills/{id}/enabled:
|
||
patch:
|
||
summary: 启停Skill
|
||
responses:
|
||
'200':
|
||
description: 启停Skill
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/SkillResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
enabled:
|
||
type: boolean
|
||
required:
|
||
- enabled
|
||
parameters:
|
||
- name: If-Match
|
||
in: header
|
||
required: true
|
||
description: 上次读取返回的 ETag,例如 "1"。
|
||
schema:
|
||
type: string
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
/api/admin/v1/experts:
|
||
get:
|
||
summary: 查询Expert
|
||
description: |
|
||
按 ownership_type 筛选系统或用户专家;q 对名称、描述和提示词进行不区分大小写的字面子串搜索。
|
||
筛选在游标分页前执行;切换类型或关键词时应清空 cursor。limit 控制单页数量,next_cursor 为空表示无后续页。
|
||
responses:
|
||
'200':
|
||
description: 查询Expert
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ExpertResource'
|
||
next_cursor:
|
||
type: string
|
||
required:
|
||
- items
|
||
- next_cursor
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: ownership_type
|
||
in: query
|
||
schema:
|
||
type: string
|
||
enum:
|
||
- system
|
||
- user
|
||
- name: q
|
||
in: query
|
||
schema:
|
||
type: string
|
||
- name: cursor
|
||
in: query
|
||
schema:
|
||
type: string
|
||
- name: limit
|
||
in: query
|
||
schema:
|
||
type: integer
|
||
minimum: 1
|
||
maximum: 500
|
||
default: 200
|
||
post:
|
||
summary: 创建Expert
|
||
responses:
|
||
'200':
|
||
description: 创建Expert
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ExpertResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ExpertInput'
|
||
/api/admin/v1/experts/{id}:
|
||
get:
|
||
summary: 读取Expert
|
||
responses:
|
||
'200':
|
||
description: 读取Expert
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ExpertResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
put:
|
||
summary: 更新Expert
|
||
responses:
|
||
'200':
|
||
description: 更新Expert
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ExpertResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ExpertInput'
|
||
parameters:
|
||
- name: If-Match
|
||
in: header
|
||
required: true
|
||
description: 上次读取返回的 ETag,例如 "1"。
|
||
schema:
|
||
type: string
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
delete:
|
||
summary: 删除Expert
|
||
responses:
|
||
'204':
|
||
description: 删除Expert
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: If-Match
|
||
in: header
|
||
required: true
|
||
description: 上次读取返回的 ETag,例如 "1"。
|
||
schema:
|
||
type: string
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
/api/admin/v1/experts/{id}/enabled:
|
||
patch:
|
||
summary: 启停Expert
|
||
responses:
|
||
'200':
|
||
description: 启停Expert
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ExpertResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
enabled:
|
||
type: boolean
|
||
required:
|
||
- enabled
|
||
parameters:
|
||
- name: If-Match
|
||
in: header
|
||
required: true
|
||
description: 上次读取返回的 ETag,例如 "1"。
|
||
schema:
|
||
type: string
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
/api/admin/v1/connectors:
|
||
get:
|
||
summary: 查询Connector
|
||
description: |
|
||
按 ownership_type 筛选系统或用户连接器;q 对名称和描述进行不区分大小写的字面子串搜索。
|
||
筛选在游标分页前执行;切换类型或关键词时应清空 cursor。limit 控制单页数量,next_cursor 为空表示无后续页。
|
||
responses:
|
||
'200':
|
||
description: 查询Connector
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ConnectorResource'
|
||
next_cursor:
|
||
type: string
|
||
required:
|
||
- items
|
||
- next_cursor
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: ownership_type
|
||
in: query
|
||
schema:
|
||
type: string
|
||
enum:
|
||
- system
|
||
- user
|
||
- name: q
|
||
in: query
|
||
schema:
|
||
type: string
|
||
- name: cursor
|
||
in: query
|
||
schema:
|
||
type: string
|
||
- name: limit
|
||
in: query
|
||
schema:
|
||
type: integer
|
||
minimum: 1
|
||
maximum: 500
|
||
default: 200
|
||
post:
|
||
summary: 创建Connector
|
||
responses:
|
||
'200':
|
||
description: 创建Connector
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ConnectorResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
allOf:
|
||
- $ref: '#/components/schemas/ConnectorInput'
|
||
required:
|
||
- name
|
||
- url
|
||
- authorization_mode
|
||
description: 直接配置 Connector 地址、认证方式和 OAuth 应用,不使用 Provider。个人连接仅支持 none / independent,凭证通过独立接口管理。
|
||
/api/admin/v1/connectors/{id}:
|
||
get:
|
||
summary: 读取Connector
|
||
responses:
|
||
'200':
|
||
description: 读取Connector
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ConnectorResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
put:
|
||
summary: 更新Connector
|
||
responses:
|
||
'200':
|
||
description: 更新Connector
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ConnectorResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ConnectorInput'
|
||
parameters:
|
||
- name: If-Match
|
||
in: header
|
||
required: true
|
||
description: 上次读取返回的 ETag,例如 "1"。
|
||
schema:
|
||
type: string
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
description: 直接编辑连接,携带连接 If-Match。关键配置变更递增 config_revision 并使旧凭证、目录和授权事务失效;Client Secret 轮换不使既有 Token 失效。
|
||
delete:
|
||
summary: 删除Connector
|
||
responses:
|
||
'204':
|
||
description: 删除Connector
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: If-Match
|
||
in: header
|
||
required: true
|
||
description: 上次读取返回的 ETag,例如 "1"。
|
||
schema:
|
||
type: string
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
/api/admin/v1/connectors/{id}/enabled:
|
||
patch:
|
||
summary: 启停Connector
|
||
responses:
|
||
'200':
|
||
description: 启停Connector
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ConnectorResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
enabled:
|
||
type: boolean
|
||
required:
|
||
- enabled
|
||
parameters:
|
||
- name: If-Match
|
||
in: header
|
||
required: true
|
||
description: 上次读取返回的 ETag,例如 "1"。
|
||
schema:
|
||
type: string
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
/api/admin/v1/skills/{id}/package:
|
||
put:
|
||
summary: 替换技能包
|
||
responses:
|
||
'200':
|
||
description: 替换技能包
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/SkillResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: If-Match
|
||
in: header
|
||
required: true
|
||
description: 上次读取返回的 ETag,例如 "1"。
|
||
schema:
|
||
type: string
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
multipart/form-data:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
package:
|
||
type: string
|
||
format: binary
|
||
description: 最多 500 MiB ZIP,解包最多 1 GiB。
|
||
metadata:
|
||
type: string
|
||
description: JSON 字符串,包含 tag_ids 和 grants。
|
||
required:
|
||
- package
|
||
get:
|
||
summary: 按当前权限下载技能包
|
||
responses:
|
||
'200':
|
||
description: 按当前权限下载技能包
|
||
content:
|
||
application/zip:
|
||
schema:
|
||
type: string
|
||
format: binary
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
- name: sha256
|
||
in: query
|
||
schema:
|
||
type: string
|
||
description: 客户端清单记录的包摘要;与当前包不同返回 412。
|
||
/api/admin/v1/skills/{id}/manifest:
|
||
get:
|
||
summary: 读取技能正文
|
||
responses:
|
||
'200':
|
||
description: 读取技能正文
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
name:
|
||
type: string
|
||
description:
|
||
type: string
|
||
content:
|
||
type: string
|
||
revision:
|
||
type: integer
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
/api/admin/v1/resources/authorization-subjects:
|
||
get:
|
||
summary: 查询实际授权对象
|
||
responses:
|
||
'200':
|
||
description: 查询实际授权对象
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
groups:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
parent_id:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
name:
|
||
type: string
|
||
users:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
email:
|
||
type: string
|
||
group_id:
|
||
type: string
|
||
format: uuid
|
||
description: 授权选择器展示的所属分组;未加入其他分组时为根 UUID。
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
/api/admin/v1/resources/{type}/{id}/grants:
|
||
get:
|
||
summary: 读取或更新授权
|
||
responses:
|
||
'200':
|
||
description: 读取或更新授权
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
grants:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ResourceGrant'
|
||
revision:
|
||
type: integer
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: type
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
put:
|
||
summary: 读取或更新授权
|
||
responses:
|
||
'200':
|
||
description: 读取或更新授权
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
grants:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ResourceGrant'
|
||
revision:
|
||
type: integer
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
grants:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ResourceGrant'
|
||
required:
|
||
- grants
|
||
parameters:
|
||
- name: If-Match
|
||
in: header
|
||
required: true
|
||
description: 上次读取返回的 ETag,例如 "1"。
|
||
schema:
|
||
type: string
|
||
- name: type
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
/api/admin/v1/tags:
|
||
get:
|
||
summary: 查询标签
|
||
responses:
|
||
'200':
|
||
description: 查询标签
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ResourceTag'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
post:
|
||
summary: 创建标签
|
||
responses:
|
||
'200':
|
||
description: 创建标签
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ResourceTag'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
name:
|
||
type: string
|
||
required:
|
||
- name
|
||
/api/admin/v1/tags/{id}:
|
||
put:
|
||
summary: 重命名标签
|
||
responses:
|
||
'200':
|
||
description: 重命名标签
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ResourceTag'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
name:
|
||
type: string
|
||
required:
|
||
- name
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
delete:
|
||
summary: 删除标签
|
||
responses:
|
||
'204':
|
||
description: 删除标签
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
/api/admin/v1/experts/{id}/copy:
|
||
post:
|
||
summary: 复制为未授权且禁用的专家
|
||
responses:
|
||
'200':
|
||
description: 复制为未授权且禁用的专家
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ExpertResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
name:
|
||
type: string
|
||
required:
|
||
- name
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
/api/admin/v1/experts/{id}/preview:
|
||
post:
|
||
summary: 以指定用户预览最终资源清单
|
||
responses:
|
||
'200':
|
||
description: 以指定用户预览最终资源清单
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ExpertManifest'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
user_id:
|
||
type: string
|
||
format: uuid
|
||
expert_id:
|
||
type: string
|
||
format: uuid
|
||
rule_ids:
|
||
type: array
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
skill_ids:
|
||
type: array
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
connector_bindings:
|
||
type: object
|
||
additionalProperties:
|
||
type: string
|
||
format: uuid
|
||
required:
|
||
- user_id
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
/api/admin/v1/connectors/{id}/tools/{toolID}:
|
||
patch:
|
||
summary: 配置工具启停和积分
|
||
responses:
|
||
'200':
|
||
description: 配置工具启停和积分
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/MCPTool'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
enabled:
|
||
type: boolean
|
||
credits_per_call:
|
||
type: number
|
||
minimum: 0
|
||
required:
|
||
- enabled
|
||
- credits_per_call
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
- name: toolID
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
/api/admin/v1/connectors/{id}/test:
|
||
post:
|
||
summary: 执行真实 MCP 握手与全量工具发现
|
||
responses:
|
||
'200':
|
||
description: 执行真实 MCP 握手与全量工具发现
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
connection_status:
|
||
type: string
|
||
tool_count:
|
||
type: integer
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
description: 独立认证必须使用包含 credential_id 的接口,否则返回 400 credential_selection_required。连接级工具适用于 none / centralized;集中测试仅限管理员。
|
||
/api/admin/v1/connectors/{id}/tools:
|
||
get:
|
||
summary: 读取认证上下文的工具目录
|
||
responses:
|
||
'200':
|
||
description: 读取认证上下文的工具目录
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/MCPTool'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
description: 独立认证必须使用包含 credential_id 的接口,否则返回 400 credential_selection_required。连接级工具适用于 none / centralized;集中测试仅限管理员。
|
||
/api/admin/v1/connectors/{id}/oauth/authorizations:
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
post:
|
||
summary: 添加命名 OAuth 凭证,每次成功新建
|
||
responses:
|
||
'200':
|
||
description: 成功;不返回凭证秘密。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/OAuthAuthorization'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/AuthorizationName'
|
||
/api/admin/v1/connector-authorizations/{id}:
|
||
get:
|
||
summary: 查询本人发起的授权事务状态
|
||
description: 保存凭证后自动测试连接并发现工具,测试尝试完成后返回 succeeded 和 credential_id;测试失败不影响授权成功,结果记录在凭证测试状态中。
|
||
responses:
|
||
'200':
|
||
description: 查询本人发起的授权事务状态
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/AuthorizationStatus'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
/api/admin/v1/connectors/{id}/credentials:
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
get:
|
||
summary: 列出集中凭证元数据
|
||
responses:
|
||
'200':
|
||
description: 成功;不返回凭证秘密。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ConnectorCredential'
|
||
required:
|
||
- items
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
post:
|
||
summary: 新增 HTTP Header 凭证并自动测试连接
|
||
description: 保存后由服务端自动发现工具并返回最新测试状态;测试失败仍保留凭证,可通过测试接口重试。
|
||
responses:
|
||
'201':
|
||
description: 成功;不返回凭证秘密。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ConnectorCredential'
|
||
headers:
|
||
ETag:
|
||
description: 凭证编辑版本。
|
||
schema:
|
||
type: string
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/CredentialInput'
|
||
/api/admin/v1/connectors/{id}/credentials/{credential_id}:
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
- name: credential_id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
get:
|
||
summary: 读取指定凭证元数据及 ETag
|
||
responses:
|
||
'200':
|
||
description: 成功;不返回凭证秘密。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ConnectorCredential'
|
||
headers:
|
||
ETag:
|
||
description: 凭证编辑版本。
|
||
schema:
|
||
type: string
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
patch:
|
||
summary: 改名或整组替换 Header
|
||
description: 替换 Header 后自动测试连接并更新工具目录;仅改名不触发测试。
|
||
responses:
|
||
'200':
|
||
description: 成功;不返回凭证秘密。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ConnectorCredential'
|
||
headers:
|
||
ETag:
|
||
description: 凭证编辑版本。
|
||
schema:
|
||
type: string
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/CredentialPatch'
|
||
parameters:
|
||
- name: If-Match
|
||
in: header
|
||
required: true
|
||
schema:
|
||
type: string
|
||
description: 当前凭证 revision 的带双引号 ETag;冲突返回 412 revision_conflict。
|
||
delete:
|
||
summary: 本地撤销指定凭证并失效其工具目录
|
||
responses:
|
||
'204':
|
||
description: 操作成功。
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: If-Match
|
||
in: header
|
||
required: true
|
||
schema:
|
||
type: string
|
||
description: 当前凭证 revision 的带双引号 ETag;冲突返回 412 revision_conflict。
|
||
/api/admin/v1/connectors/{id}/credentials/{credential_id}/oauth/authorizations:
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
- name: credential_id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
post:
|
||
summary: 重新授权指定凭证,成功后保持 ID 并失效原目录
|
||
responses:
|
||
'200':
|
||
description: 成功;不返回凭证秘密。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/OAuthAuthorization'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: If-Match
|
||
in: header
|
||
required: true
|
||
schema:
|
||
type: string
|
||
description: 当前凭证 revision 的带双引号 ETag;冲突返回 412 revision_conflict。
|
||
/api/admin/v1/connectors/{id}/credentials/{credential_id}/test:
|
||
post:
|
||
summary: 执行真实 MCP 握手与全量工具发现
|
||
responses:
|
||
'200':
|
||
description: 执行真实 MCP 握手与全量工具发现
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
connection_status:
|
||
type: string
|
||
tool_count:
|
||
type: integer
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters: []
|
||
description: 操作明确指定的凭证上下文;校验连接、凭证、当前用户和配置版本。管理端工具只读上下文允许查看系统连接用户工具,不能代用户测试。
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
- name: credential_id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
/api/admin/v1/connectors/{id}/credentials/{credential_id}/tools:
|
||
get:
|
||
summary: 读取认证上下文的工具目录
|
||
responses:
|
||
'200':
|
||
description: 读取认证上下文的工具目录
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/MCPTool'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters: []
|
||
description: 操作明确指定的凭证上下文;校验连接、凭证、当前用户和配置版本。管理端工具只读上下文允许查看系统连接用户工具,不能代用户测试。
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
- name: credential_id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
/api/admin/v1/connectors/{id}/icon:
|
||
put:
|
||
summary: 上传连接图标
|
||
responses:
|
||
'200':
|
||
description: 更新连接图标
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ConnectorResource'
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: If-Match
|
||
in: header
|
||
required: true
|
||
description: 上次读取返回的 ETag,例如 "1"。
|
||
schema:
|
||
type: string
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
multipart/form-data:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
icon:
|
||
type: string
|
||
format: binary
|
||
description: PNG/JPEG,最多 1 MiB,最多 4096×4096。
|
||
required:
|
||
- icon
|
||
description: 系统连接由管理员维护,个人连接由所有者维护;携带连接 If-Match。
|
||
get:
|
||
summary: 读取连接图标
|
||
responses:
|
||
'200':
|
||
description: 读取私有模板图标
|
||
content:
|
||
image/png:
|
||
schema:
|
||
type: string
|
||
format: binary
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
/api/admin/v1/connectors/{id}/tool-contexts:
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
get:
|
||
summary: 列出系统连接的凭证工具上下文元数据
|
||
responses:
|
||
'200':
|
||
description: 成功;不返回凭证秘密。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ConnectorCredential'
|
||
required:
|
||
- items
|
||
'400':
|
||
$ref: '#/components/responses/ResourceError400'
|
||
'401':
|
||
$ref: '#/components/responses/ResourceError401'
|
||
'403':
|
||
$ref: '#/components/responses/ResourceError403'
|
||
'404':
|
||
$ref: '#/components/responses/ResourceError404'
|
||
'409':
|
||
$ref: '#/components/responses/ResourceError409'
|
||
'412':
|
||
$ref: '#/components/responses/ResourceError412'
|
||
'428':
|
||
$ref: '#/components/responses/ResourceError428'
|
||
'500':
|
||
$ref: '#/components/responses/ResourceError500'
|
||
'502':
|
||
$ref: '#/components/responses/ResourceError502'
|
||
/api/admin/v1/endpoints:
|
||
get:
|
||
summary: 查询所有用户的客户端设备登记记录
|
||
description: 一行对应 (user_id,machine_id) 的一条设备登记记录,字段为当前登记值。以 endpoints 为主表关联 users,不依赖会话或轮次上报。默认无时间限制,包含已撤销登记和已删除用户的记录;按最近活动降序(空值最后)、创建时间降序、ID 降序分页。最近活动为设备记录中 last_seen_at 与 last_reported_at 较新的时间,不能据此推断实时在线。每次读取 page_size+1 判断 has_next,不执行列表总数
|
||
COUNT。只返回展示字段,不返回执行公钥或授权信息。
|
||
parameters:
|
||
- in: query
|
||
name: query
|
||
description: 对使用者姓名、邮箱、设备名称、别名、客户端名称及设备 ID 做不区分大小写的字面子串搜索。
|
||
schema:
|
||
type: string
|
||
maxLength: 200
|
||
- in: query
|
||
name: user_id
|
||
description: 按所属用户精确筛选。
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
- in: query
|
||
name: platform
|
||
description: 操作系统类型,不区分大小写精确匹配。
|
||
schema:
|
||
type: string
|
||
maxLength: 64
|
||
- in: query
|
||
name: client_type
|
||
description: 客户端类型,不区分大小写精确匹配。
|
||
schema:
|
||
type: string
|
||
maxLength: 32
|
||
- in: query
|
||
name: client_version
|
||
description: 客户端版本,精确匹配。
|
||
schema:
|
||
type: string
|
||
maxLength: 64
|
||
- in: query
|
||
name: arch
|
||
description: CPU 架构,不区分大小写精确匹配。
|
||
schema:
|
||
type: string
|
||
maxLength: 32
|
||
- in: query
|
||
name: status
|
||
description: 登记状态,不代表实时在线。
|
||
schema:
|
||
type: string
|
||
enum:
|
||
- active
|
||
- revoked
|
||
- in: query
|
||
name: from
|
||
description: 最近活动时间下界,包含;不提供时不限制。
|
||
schema:
|
||
type: string
|
||
format: date-time
|
||
- in: query
|
||
name: until
|
||
description: 最近活动时间上界,不包含;不提供时不限制。
|
||
schema:
|
||
type: string
|
||
format: date-time
|
||
- in: query
|
||
name: page
|
||
schema:
|
||
type: integer
|
||
default: 1
|
||
minimum: 1
|
||
maximum: 1000000
|
||
- in: query
|
||
name: page_size
|
||
schema:
|
||
type: integer
|
||
default: 50
|
||
minimum: 1
|
||
maximum: 500
|
||
responses:
|
||
'200':
|
||
description: '登记记录页,Cache-Control: private, no-store'
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required:
|
||
- items
|
||
- page
|
||
- page_size
|
||
- has_next
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ClientDevice'
|
||
page:
|
||
type: integer
|
||
page_size:
|
||
type: integer
|
||
has_next:
|
||
type: boolean
|
||
'400':
|
||
description: 参数不合法
|
||
'401':
|
||
description: 未登录
|
||
'403':
|
||
description: 需要管理员权限
|
||
'503':
|
||
description: 设备清单暂不可用
|
||
/api/admin/v1/endpoints/overview:
|
||
get:
|
||
summary: 统计客户端设备登记记录及其分布
|
||
description: 筛选口径与设备列表一致,默认覆盖全部登记记录。total 按 (user_id,machine_id) 记录计数,users 按 user_id 去重;三个分布均按设备登记记录计数,不是会话数,也不是按物理设备去重的安装量。不接受分页参数。
|
||
parameters:
|
||
- in: query
|
||
name: query
|
||
description: 对使用者姓名、邮箱、设备名称、别名、客户端名称及设备 ID 做不区分大小写的字面子串搜索。
|
||
schema:
|
||
type: string
|
||
maxLength: 200
|
||
- in: query
|
||
name: user_id
|
||
description: 按所属用户精确筛选。
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
- in: query
|
||
name: platform
|
||
description: 操作系统类型,不区分大小写精确匹配。
|
||
schema:
|
||
type: string
|
||
maxLength: 64
|
||
- in: query
|
||
name: client_type
|
||
description: 客户端类型,不区分大小写精确匹配。
|
||
schema:
|
||
type: string
|
||
maxLength: 32
|
||
- in: query
|
||
name: client_version
|
||
description: 客户端版本,精确匹配。
|
||
schema:
|
||
type: string
|
||
maxLength: 64
|
||
- in: query
|
||
name: arch
|
||
description: CPU 架构,不区分大小写精确匹配。
|
||
schema:
|
||
type: string
|
||
maxLength: 32
|
||
- in: query
|
||
name: status
|
||
description: 登记状态,不代表实时在线。
|
||
schema:
|
||
type: string
|
||
enum:
|
||
- active
|
||
- revoked
|
||
- in: query
|
||
name: from
|
||
description: 最近活动时间下界,包含;不提供时不限制。
|
||
schema:
|
||
type: string
|
||
format: date-time
|
||
- in: query
|
||
name: until
|
||
description: 最近活动时间上界,不包含;不提供时不限制。
|
||
schema:
|
||
type: string
|
||
format: date-time
|
||
responses:
|
||
'200':
|
||
description: '登记统计,Cache-Control: private, no-store'
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ClientDeviceOverview'
|
||
'400':
|
||
description: 参数不合法
|
||
'401':
|
||
description: 未登录
|
||
'403':
|
||
description: 需要管理员权限
|
||
'503':
|
||
description: 设备清单暂不可用
|
||
components:
|
||
securitySchemes:
|
||
AdminSession:
|
||
type: apiKey
|
||
in: cookie
|
||
name: monkeyai_session
|
||
description: 管理后台登录后设置的 HttpOnly Session Cookie。
|
||
parameters:
|
||
ModelID:
|
||
in: path
|
||
name: modelID
|
||
required: true
|
||
description: 模型 UUID。
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
KeyID:
|
||
in: path
|
||
name: keyID
|
||
required: true
|
||
description: 调用密钥 UUID。
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
responses:
|
||
ResourceError400:
|
||
description: 字段或关联无效
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ResourceError'
|
||
ResourceError401:
|
||
description: 需要登录
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ResourceError'
|
||
ResourceError403:
|
||
description: 无权操作
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ResourceError'
|
||
ResourceError404:
|
||
description: 资源不存在或无权访问
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ResourceError'
|
||
ResourceError409:
|
||
description: 名称或引用冲突
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ResourceError'
|
||
ResourceError412:
|
||
description: 修订或技能包摘要已变化
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ResourceError'
|
||
ResourceError428:
|
||
description: 缺少 If-Match
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ResourceError'
|
||
ResourceError500:
|
||
description: 读取或保存失败
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ResourceError'
|
||
ResourceError502:
|
||
description: 上游连接失败
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/ResourceError'
|
||
BadRequest:
|
||
description: 请求参数或请求体无效。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/ErrorResponse"
|
||
Unauthorized:
|
||
description: 未登录或 Session 已失效。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/ErrorResponse"
|
||
Forbidden:
|
||
description: 当前用户没有管理员权限。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/ErrorResponse"
|
||
NotFound:
|
||
description: 指定资源不存在。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/ErrorResponse"
|
||
InternalError:
|
||
description: 服务内部错误。
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/ErrorResponse"
|
||
schemas:
|
||
ClientDevice:
|
||
type: object
|
||
required:
|
||
- id
|
||
- user_id
|
||
- machine_id
|
||
- user_name
|
||
- user_email
|
||
- user_avatar_url
|
||
- alias
|
||
- client_type
|
||
- client_name
|
||
- locale
|
||
- system_locale
|
||
- timezone
|
||
- runtime_version
|
||
- engine_version
|
||
- user_deleted
|
||
- device_name
|
||
- platform
|
||
- os_version
|
||
- arch
|
||
- client_version
|
||
- status
|
||
- created_at
|
||
- updated_at
|
||
- last_seen_at
|
||
- last_reported_at
|
||
- last_active_at
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
user_id:
|
||
type: string
|
||
format: uuid
|
||
machine_id:
|
||
type: string
|
||
format: uuid
|
||
user_name:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
user_email:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
user_avatar_url:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
alias:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
client_type:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
client_name:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
locale:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
system_locale:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
timezone:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
runtime_version:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
engine_version:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
user_deleted:
|
||
type: boolean
|
||
device_name:
|
||
type: string
|
||
platform:
|
||
type: string
|
||
os_version:
|
||
type: string
|
||
arch:
|
||
type: string
|
||
client_version:
|
||
type: string
|
||
status:
|
||
type: string
|
||
enum:
|
||
- active
|
||
- revoked
|
||
description: active 表示登记有效,不表示在线。
|
||
created_at:
|
||
type: string
|
||
format: date-time
|
||
description: 首次创建登记记录时间,不等同于首次连接或首次对话。
|
||
updated_at:
|
||
type: string
|
||
format: date-time
|
||
last_seen_at:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
format: date-time
|
||
last_reported_at:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
format: date-time
|
||
last_active_at:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
format: date-time
|
||
description: GREATEST(last_seen_at,last_reported_at),两者均为空时为 null。
|
||
ClientDeviceOverview:
|
||
type: object
|
||
required:
|
||
- metric
|
||
- total
|
||
- users
|
||
- distributions
|
||
properties:
|
||
metric:
|
||
type: string
|
||
enum:
|
||
- devices
|
||
total:
|
||
type: integer
|
||
users:
|
||
type: integer
|
||
distributions:
|
||
type: object
|
||
required:
|
||
- client_type
|
||
- platform
|
||
- client_version
|
||
properties:
|
||
client_type:
|
||
type: array
|
||
items:
|
||
type: object
|
||
required:
|
||
- value
|
||
- count
|
||
properties:
|
||
value:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
count:
|
||
type: integer
|
||
platform:
|
||
type: array
|
||
items:
|
||
type: object
|
||
required:
|
||
- value
|
||
- count
|
||
properties:
|
||
value:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
count:
|
||
type: integer
|
||
client_version:
|
||
type: array
|
||
items:
|
||
type: object
|
||
required:
|
||
- value
|
||
- count
|
||
properties:
|
||
value:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
count:
|
||
type: integer
|
||
ResourceImportUploadFile:
|
||
type: object
|
||
required: [name, size]
|
||
properties:
|
||
name: {type: string, description: ZIP 文件名或从 001 连续递增的分卷文件名}
|
||
size: {type: integer, format: int64, minimum: 1, maximum: 2147483648}
|
||
ResourceImportUpload:
|
||
type: object
|
||
required: [id, files, total_size, status, package_sha256, chunk_size, chunks, created_at, expires_at]
|
||
properties:
|
||
id: {type: string, format: uuid}
|
||
files:
|
||
type: array
|
||
items: {$ref: '#/components/schemas/ResourceImportUploadFile'}
|
||
total_size: {type: integer, format: int64}
|
||
status: {type: string, enum: [uploading, ready, imported]}
|
||
package_sha256: {type: string, description: 封存后由服务端计算的完整 ZIP 摘要,上传期间为空}
|
||
chunk_size: {type: integer, const: 67108864}
|
||
chunks:
|
||
type: array
|
||
items:
|
||
type: object
|
||
required: [index, size, sha256]
|
||
properties:
|
||
index: {type: integer, minimum: 0, maximum: 31}
|
||
size: {type: integer, format: int64}
|
||
sha256: {type: string}
|
||
created_at: {type: string, format: date-time}
|
||
expires_at: {type: string, format: date-time}
|
||
ResourceSectionResult:
|
||
type: object
|
||
required: [status, replayed]
|
||
properties:
|
||
status: {type: string, enum: [succeeded, failed]}
|
||
replayed: {type: boolean}
|
||
http_status: {type: integer}
|
||
error:
|
||
type: object
|
||
properties:
|
||
code: {type: string}
|
||
message: {type: string}
|
||
result: {type: object, description: Agent Preview或设计Plan,包含源release_id及资源计数}
|
||
ResourceImportInput:
|
||
type: object
|
||
required: [upload_id]
|
||
properties:
|
||
upload_id: {type: string, format: uuid}
|
||
package_sha256: {type: string}
|
||
plan_digest: {type: string}
|
||
discover_only: {type: boolean, description: 只发现分区,不生成计划,不能用于Apply}
|
||
sections:
|
||
type: array
|
||
minItems: 1
|
||
uniqueItems: true
|
||
items: {type: string, enum: [agent, design]}
|
||
section_plan_digests:
|
||
type: object
|
||
additionalProperties: {type: string}
|
||
options:
|
||
type: object
|
||
properties:
|
||
confirm_final: {type: boolean, description: 确认导入时必须为 true}
|
||
accept_normalization: {type: boolean}
|
||
authorization_modes:
|
||
type: object
|
||
additionalProperties: {type: string, enum: [independent, centralized]}
|
||
FeedbackPage:
|
||
type: object
|
||
additionalProperties: false
|
||
required: [items, total, page, page_size]
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/Feedback'
|
||
total: {type: integer, format: int64, minimum: 0}
|
||
page: {type: integer, minimum: 1}
|
||
page_size: {type: integer, minimum: 1}
|
||
Feedback:
|
||
type: object
|
||
additionalProperties: false
|
||
required: [id, user_id, category, content, platform, client_version, state, created_at, updated_at, attachments]
|
||
properties:
|
||
id: {type: string, format: uuid}
|
||
user_id: {type: string, format: uuid}
|
||
user_name: {type: string, description: 提交反馈的用户名,仅管理员列表返回。}
|
||
user_email: {type: string, format: email, description: 提交反馈的邮箱,仅管理员列表返回。}
|
||
user_avatar_url: {type: [string, 'null'], description: 提交反馈用户的当前头像,仅管理员列表返回;为空或省略时使用默认头像。}
|
||
category: {type: string, enum: [bug, feature, experience, other]}
|
||
content: {type: string, maxLength: 5000}
|
||
rating: {type: [integer, 'null'], minimum: 1, maximum: 5}
|
||
platform: {type: string, enum: [desktop, mobile, web, other]}
|
||
client_version: {type: string, maxLength: 64}
|
||
state: {type: string, enum: [uploading, new, resolved, ignored, failed]}
|
||
request_id: {type: string}
|
||
created_at: {type: string, format: date-time}
|
||
updated_at: {type: string, format: date-time}
|
||
attachments:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/FeedbackAttachment'
|
||
FeedbackAttachment:
|
||
type: object
|
||
additionalProperties: false
|
||
required: [id, feedback_id, mime_type, byte_size, width, height, sha256, state, downloadable, created_at]
|
||
properties:
|
||
id: {type: string, format: uuid}
|
||
feedback_id: {type: string, format: uuid}
|
||
mime_type: {type: string, enum: [image/png, image/jpeg, image/webp]}
|
||
byte_size: {type: integer, format: int64, minimum: 1}
|
||
width: {type: integer, minimum: 1}
|
||
height: {type: integer, minimum: 1}
|
||
sha256: {type: string, pattern: '^[0-9a-f]{64}$'}
|
||
state: {type: string, enum: [pending, ready, failed]}
|
||
downloadable: {type: boolean}
|
||
created_at: {type: string, format: date-time}
|
||
EmailAuthError:
|
||
type: object
|
||
required:
|
||
- error
|
||
properties:
|
||
error:
|
||
type: object
|
||
required:
|
||
- code
|
||
- message
|
||
properties:
|
||
code:
|
||
type: string
|
||
message:
|
||
type: string
|
||
EmailLoginMethods:
|
||
type: object
|
||
required:
|
||
- password_enabled
|
||
- email_code_enabled
|
||
- email_code_auto_registration_enabled
|
||
properties:
|
||
password_enabled:
|
||
type: boolean
|
||
description: 密码登录开关,未配置时默认 true,同时约束管理员和普通用户。
|
||
email_code_enabled:
|
||
type: boolean
|
||
description: 验证码登录开关,默认 false。
|
||
email_code_auto_registration_enabled:
|
||
type: boolean
|
||
description: 邮箱验证码自动注册开关,默认 false;客户端使用新邮箱通过验证码登录时自动创建普通账号,管理后台入口不会自动注册。
|
||
CreateAdminUserInput:
|
||
type: object
|
||
required: [name, email, role]
|
||
properties:
|
||
name:
|
||
type: string
|
||
minLength: 1
|
||
description: 姓名会去除首尾空白,不能为空。
|
||
email:
|
||
type: string
|
||
format: email
|
||
maxLength: 254
|
||
description: 邮箱会去除首尾空白并转为小写。
|
||
role:
|
||
type: string
|
||
enum: [admin, user]
|
||
password:
|
||
type: string
|
||
writeOnly: true
|
||
description: 管理员必填,至少 12 个字符;普通用户忽略此字段。
|
||
group_ids:
|
||
type: [array, 'null']
|
||
maxItems: 1000
|
||
description: 直接加入的分组 UUID,重复值自动去重;未传、null 或空数组表示不加入真实分组。禁止根分组 UUID。
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
allOf:
|
||
- if:
|
||
properties:
|
||
role:
|
||
const: admin
|
||
then:
|
||
required: [password]
|
||
properties:
|
||
password:
|
||
minLength: 12
|
||
EmailAuthUser:
|
||
type: object
|
||
required:
|
||
- id
|
||
- name
|
||
- email
|
||
- role
|
||
- status
|
||
- joined_at
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
email:
|
||
type: string
|
||
format: email
|
||
maxLength: 254
|
||
description: 邮箱会去除首尾空白并转为小写。
|
||
role:
|
||
type: string
|
||
enum:
|
||
- admin
|
||
- user
|
||
status:
|
||
type: string
|
||
enum:
|
||
- active
|
||
- disabled
|
||
joined_at:
|
||
type: string
|
||
format: date-time
|
||
avatar_url:
|
||
type: string
|
||
last_login_at:
|
||
type: string
|
||
format: date-time
|
||
AuditPage:
|
||
type: object
|
||
required: [items, total, page, page_size]
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
$ref: "#/components/schemas/AuditRecord"
|
||
total:
|
||
type: integer
|
||
minimum: 0
|
||
description: 所有匹配记录的数量。
|
||
page:
|
||
type: integer
|
||
minimum: 1
|
||
description: 请求页码。
|
||
page_size:
|
||
type: integer
|
||
minimum: 1
|
||
maximum: 500
|
||
description: 每页条数。
|
||
AuditRecord:
|
||
type: object
|
||
required: [id, actor_type, actor_user_id, actor_name, actor_email, actor_avatar_url, action, category, target_type, target_id, request_params, source_ip, user_agent, result, error_message, occurred_at, request_id]
|
||
properties:
|
||
id:
|
||
type: string
|
||
description: "审计 ID。"
|
||
format: uuid
|
||
actor_type:
|
||
type: string
|
||
description: "操作者类型;登录失败是尚未认证的 user。"
|
||
enum: [user, system]
|
||
actor_user_id:
|
||
type: [string, "null"]
|
||
description: "操作者 ID;未认证用户及已删除用户为空。"
|
||
format: uuid
|
||
actor_name:
|
||
type: string
|
||
description: "操作者名称快照,未认证登录尝试固定为未认证用户。"
|
||
actor_email:
|
||
type: [string, "null"]
|
||
description: "操作者邮箱快照。"
|
||
actor_avatar_url:
|
||
type: [string, "null"]
|
||
description: "操作者当前的头像地址;无关联用户或头像为空时为 null,客户端使用默认头像。"
|
||
action:
|
||
type: string
|
||
description: "操作标识;客户端应为未知标识保留原文回退。"
|
||
category:
|
||
type: string
|
||
description: "操作分类,兼容既有记录。"
|
||
target_type:
|
||
type: [string, "null"]
|
||
description: "目标资源类型。"
|
||
target_id:
|
||
type: [string, "null"]
|
||
description: "目标 UUID;无具体对象时为空。"
|
||
format: uuid
|
||
request_params:
|
||
type: object
|
||
description: "白名单参数快照,未知字段与凭证替换为 [REDACTED];不保存上传文件、正文及原始响应。"
|
||
additionalProperties: true
|
||
source_ip:
|
||
type: [string, "null"]
|
||
description: "HTTP 对端 IPv4 或 IPv6 地址,历史记录可为空。"
|
||
user_agent:
|
||
type: [string, "null"]
|
||
description: "最多 512 个字符的客户端标识。"
|
||
result:
|
||
type: string
|
||
description: "执行结果。"
|
||
enum: [success, failed]
|
||
error_message:
|
||
type: [string, "null"]
|
||
description: "仅保存标准 HTTP 状态说明,不保存上游或数据库错误原文。"
|
||
occurred_at:
|
||
type: string
|
||
description: "操作发生时间。"
|
||
format: date-time
|
||
request_id:
|
||
type: [string, "null"]
|
||
description: "服务端生成的请求关联标识,同一批量操作可关联多个目标;历史或独立业务事件为空。"
|
||
StatisticsCredits: &statisticsCredits
|
||
type: string
|
||
pattern: ^-?[0-9]+(\.[0-9]{1,6})?$
|
||
description: 扣费减退款后的积分净消费,十进制字符串;纯退款周期可为负值。
|
||
StatisticsFrom: &statisticsFrom
|
||
type: string
|
||
format: date-time
|
||
description: 查询窗口起点,包含。
|
||
StatisticsUntil: &statisticsUntil
|
||
type: string
|
||
format: date-time
|
||
description: 查询窗口终点,不包含;由服务端统一确定。
|
||
StatisticsModelsOverview:
|
||
type: object
|
||
description: 模型调用与积分通过事务内维护的小时汇总统计;完整小时读取汇总,滚动窗口边界和最近 30 分钟耗时读取明细。北京时间日界、用量明确判定与截尾平均规则保持一致。
|
||
required: [timezone, generated_at, last_24h, previous_24h, last_30m, days]
|
||
properties:
|
||
timezone: {type: string, const: Asia/Shanghai}
|
||
generated_at: {type: string, format: date-time}
|
||
last_24h:
|
||
type: object
|
||
description: 按完成时间统计 [generated_at - 24 小时, generated_at) 内的非运行中调用。
|
||
required: [model_calls, input_tokens, output_tokens]
|
||
properties:
|
||
model_calls: {type: integer, minimum: 0}
|
||
input_tokens: {type: integer, minimum: 0}
|
||
output_tokens: {type: integer, minimum: 0}
|
||
previous_24h:
|
||
type: object
|
||
description: 按完成时间统计 [generated_at - 48 小时, generated_at - 24 小时) 内的非运行中调用,用于与 last_24h 比较。
|
||
required: [model_calls, input_tokens, output_tokens]
|
||
properties:
|
||
model_calls: {type: integer, minimum: 0}
|
||
input_tokens: {type: integer, minimum: 0}
|
||
output_tokens: {type: integer, minimum: 0}
|
||
last_30m:
|
||
type: object
|
||
required: [tpm, rpm, cache_hit_rate, model_success_rate, avg_response_time, avg_first_token_time]
|
||
properties:
|
||
tpm: {type: number, minimum: 0, description: 近 30 分钟完成且用量明确的调用的输入和输出 Token 总量除以 30。}
|
||
rpm: {type: number, minimum: 0, description: 近 30 分钟完成调用数除以 30。}
|
||
cache_hit_rate: {type: [number, 'null'], minimum: 0, maximum: 100, description: 无完成调用时为 null。}
|
||
model_success_rate: {type: [number, 'null'], minimum: 0, maximum: 100, description: 无完成调用时为 null。}
|
||
avg_response_time: {type: [number, 'null'], minimum: 0, description: 最近 30 分钟完成的成功调用响应耗时,独立剔除最慢 5% 样本后的算术平均值,单位毫秒。剔除条数向下取整,不足 20 条时保留全部样本;相同耗时按条数截尾。优先使用记录的响应耗时,否则使用完成时间减开始时间;无样本时为 null。}
|
||
avg_first_token_time: {type: [number, 'null'], minimum: 0, description: 最近 30 分钟完成的成功流式调用中,已采集首字耗时的样本独立剔除最慢 5% 后的算术平均值,单位毫秒。剔除条数向下取整,不足 20 条时保留全部样本;相同耗时按条数截尾。历史和非流式调用不计入;无样本时为 null。}
|
||
days:
|
||
type: array
|
||
minItems: 90
|
||
maxItems: 90
|
||
description: 从 89 天前到今天的北京时间自然日,按日期升序;空白日期补零。Token 仅累计用量明确的调用,输入包含缓存输入。
|
||
items:
|
||
type: object
|
||
required: [date, model_calls, input_tokens, output_tokens, credits]
|
||
properties:
|
||
date: {type: string, format: date}
|
||
model_calls: {type: integer, minimum: 0}
|
||
input_tokens: {type: integer, minimum: 0}
|
||
output_tokens: {type: integer, minimum: 0}
|
||
credits: {type: string, description: 模型扣费与退款的净积分,可能为负值,按十进制字符串返回。}
|
||
StatisticsTasksOverview:
|
||
type: object
|
||
required: [total_tasks, new_tasks_24h, active_tasks_24h, timezone, generated_at, days]
|
||
properties:
|
||
total_tasks: {type: integer, minimum: 0, description: 当前上报启用且未删除的根任务总量。}
|
||
new_tasks_24h: {type: integer, minimum: 0, description: 滚动 24 小时内开始的根任务数。}
|
||
active_tasks_24h: {type: integer, minimum: 0, description: 滚动 24 小时内有上报轮次的去重根任务数。}
|
||
timezone: {type: string, const: Asia/Shanghai}
|
||
generated_at: {type: string, format: date-time}
|
||
days:
|
||
type: array
|
||
minItems: 90
|
||
maxItems: 90
|
||
description: 从 89 天前到今天的北京时间自然日,包含无记录的零值日期;今天仅统计至 generated_at。
|
||
items:
|
||
type: object
|
||
required: [date, new_tasks, active_tasks]
|
||
properties:
|
||
date: {type: string, format: date}
|
||
new_tasks: {type: integer, minimum: 0}
|
||
active_tasks: {type: integer, minimum: 0, description: 当日有上报轮次的去重根任务数。}
|
||
StatisticsUsersOverview:
|
||
type: object
|
||
required: [total_users, new_users_24h, active_users_24h, timezone, generated_at, days]
|
||
properties:
|
||
total_users: {type: integer, minimum: 0, description: users 表的全部用户行数,包含软删除和停用用户。}
|
||
new_users_24h: {type: integer, minimum: 0, description: 滚动 24 小时内创建的用户数,包含此后软删除的用户。}
|
||
active_users_24h: {type: integer, minimum: 0, description: 滚动 24 小时内存在 session_turns 记录的去重任务所属用户数。}
|
||
timezone: {type: string, const: Asia/Shanghai}
|
||
generated_at: {type: string, format: date-time}
|
||
days:
|
||
type: array
|
||
minItems: 90
|
||
maxItems: 90
|
||
description: 从 89 天前到今天的北京时间自然日,包含无记录的零值日期;今天仅统计至 generated_at。
|
||
items:
|
||
type: object
|
||
required: [date, new_users, active_users]
|
||
properties:
|
||
date: {type: string, format: date}
|
||
new_users: {type: integer, minimum: 0}
|
||
active_users: {type: integer, minimum: 0, description: 当日存在 session_turns 记录的去重任务所属用户数。}
|
||
StatisticsRealtime:
|
||
type: object
|
||
required:
|
||
- from
|
||
- until
|
||
- model_consumption
|
||
- p95_response_time
|
||
- model_success_rate
|
||
- model_calls
|
||
- tpm
|
||
- rpm
|
||
- input_tokens
|
||
- output_tokens
|
||
- total_users
|
||
- active_users
|
||
- active_tasks
|
||
- new_tasks
|
||
properties:
|
||
from: *statisticsFrom
|
||
until: *statisticsUntil
|
||
model_consumption: *statisticsCredits
|
||
p95_response_time:
|
||
type:
|
||
- number
|
||
- "null"
|
||
description: 窗口内完成的模型调用响应耗时 P95,单位毫秒;优先使用记录的耗时,否则使用完成时间减开始时间。无样本为 null。
|
||
model_success_rate:
|
||
type:
|
||
- number
|
||
- "null"
|
||
description: 窗口内成功调用 / 已结束调用 × 100;取消计入分母,无样本为 null。
|
||
model_calls:
|
||
type: integer
|
||
minimum: 0
|
||
description: 窗口内完成的模型调用总数。
|
||
tpm:
|
||
type: number
|
||
description: 窗口内完成且用量明确的调用的输入加输出 Token 总量 / 窗口分钟数。
|
||
rpm:
|
||
type: number
|
||
description: 窗口内完成调用总数 / 窗口分钟数。
|
||
input_tokens:
|
||
type: integer
|
||
minimum: 0
|
||
description: 窗口内完成且用量明确的调用的输入 Token,包含缓存输入。
|
||
output_tokens:
|
||
type: integer
|
||
minimum: 0
|
||
description: 窗口内完成且用量明确的调用的输出 Token。
|
||
total_users:
|
||
type: integer
|
||
minimum: 0
|
||
description: 当前系统未删除的用户总数,包含已停用用户及管理员,不受时间范围影响。
|
||
active_users:
|
||
type: integer
|
||
minimum: 0
|
||
description: 窗口内完成模型或 MCP 调用、有会话活动或发起仍在执行的计费调用的去重用户数;并非登录 DAU。
|
||
active_tasks:
|
||
type: integer
|
||
minimum: 0
|
||
description: 窗口内有网关活动的未删除、非占位顶层任务去重数;可能已结束,并非正在运行的任务数。
|
||
new_tasks:
|
||
type: integer
|
||
minimum: 0
|
||
description: 窗口内开始的未删除、非占位、已上报顶层任务数。
|
||
StatisticsResourceUsage:
|
||
type: object
|
||
required: [items, next_cursor, pagination, from, until, generated_at, data_freshness_seconds]
|
||
properties:
|
||
items:
|
||
type: array
|
||
items: {$ref: '#/components/schemas/StatisticsResourceUsageRow'}
|
||
next_cursor: {type: string, nullable: true}
|
||
pagination: {type: string, enum: [cursor]}
|
||
from: {type: string, format: date-time}
|
||
until: {type: string, format: date-time}
|
||
generated_at: {type: string, format: date-time}
|
||
data_freshness_seconds: {type: number, minimum: 0, nullable: true}
|
||
StatisticsResourceUsageRow:
|
||
type: object
|
||
required: [user_id, user_name, user_email, user_avatar_url, kind, resource_id, resource_name, version, enabled_sessions, available_sessions, used_sessions, calls, failed, failure_rate, sort_key]
|
||
properties:
|
||
user_id: {type: string, format: uuid, description: 会话所属用户 ID。}
|
||
user_name: {type: string, description: 用户当前名称。}
|
||
user_email: {type: string, description: 用户当前邮箱。}
|
||
user_avatar_url: {type: [string, 'null'], description: 用户当前头像地址;为空时使用默认头像。}
|
||
kind: {type: string}
|
||
resource_id: {type: string}
|
||
resource_name: {type: string, description: 后台配置名称、最新非空上报名称或原始 ID;内置工具保留原始 ID。}
|
||
version: {type: string, nullable: true}
|
||
enabled_sessions: {type: integer, minimum: 0}
|
||
available_sessions: {type: integer, minimum: 0}
|
||
used_sessions: {type: integer, minimum: 0}
|
||
calls: {type: integer, minimum: 0}
|
||
failed: {type: integer, minimum: 0}
|
||
failure_rate: {type: number, minimum: 0, maximum: 100, nullable: true}
|
||
sort_key: {type: string, description: 资源类别、ID、版本及用户 ID 组成的稳定分页键。}
|
||
StatisticsClientDistribution:
|
||
type: object
|
||
required: [value, count]
|
||
properties:
|
||
value:
|
||
type: string
|
||
nullable: true
|
||
description: 原始分类值,客户端版本不附加前缀;null 表示未知。
|
||
count:
|
||
type: integer
|
||
format: int64
|
||
minimum: 1
|
||
description: 归入此分类的去重会话数。
|
||
StatisticsClientOverview:
|
||
type: object
|
||
required: [metric, total, distributions, from, until, generated_at, data_freshness_seconds]
|
||
properties:
|
||
metric: {type: string, enum: [sessions], description: 计数口径固定为筛选后的去重会话数。}
|
||
total: {type: integer, format: int64, minimum: 0, description: 匹配的会话总数,包含未知分类。}
|
||
distributions:
|
||
type: object
|
||
required: [client_type, platform, client_version]
|
||
properties:
|
||
client_type:
|
||
type: array
|
||
description: 按会话数降序排列的全部客户端类型。
|
||
items: {$ref: '#/components/schemas/StatisticsClientDistribution'}
|
||
platform:
|
||
type: array
|
||
description: 按会话数降序排列的全部平台,包含未知平台。
|
||
items: {$ref: '#/components/schemas/StatisticsClientDistribution'}
|
||
client_version:
|
||
type: array
|
||
description: 按会话数降序排列的全部客户端版本,每个会话采用匹配的最后一轮版本。
|
||
items: {$ref: '#/components/schemas/StatisticsClientDistribution'}
|
||
from: {type: string, format: date-time, description: 实际统计窗口起点,包含。}
|
||
until: {type: string, format: date-time, description: 实际统计窗口终点,不包含。}
|
||
generated_at: {type: string, format: date-time, description: 响应生成时间。}
|
||
data_freshness_seconds: {type: number, minimum: 0, nullable: true, description: 距最新匹配轮次接收时间的秒数;没有匹配数据时为 null。}
|
||
StatisticsConversations:
|
||
type: object
|
||
required: [items, has_next, page, page_size]
|
||
properties:
|
||
items:
|
||
type: array
|
||
description: 当前页的对话轮次;没有数据时返回空数组。
|
||
items:
|
||
$ref: "#/components/schemas/StatisticsConversation"
|
||
has_next: {type: boolean, description: 每页多查一条判断是否还有下一页,不执行总数查询。}
|
||
page: {type: integer, minimum: 1, description: 请求页码;越界时 items 为空数组。}
|
||
page_size: {type: integer, minimum: 1, maximum: 500, description: 每页条数。}
|
||
StatisticsConversation:
|
||
type: object
|
||
required: [session_id, turn_index, task_title, user_id, user_name, user_email, user_avatar_url, started_at, ended_at, duration_seconds, input_text, input_text_truncated, input_kind, input_tokens, output_tokens, outcome, error_code, is_completed]
|
||
properties:
|
||
session_id: {type: string, format: uuid, description: 所属根会话 ID,即任务历史的任务 ID;与 turn_index 联合标识一个轮次。}
|
||
turn_index: {type: integer, minimum: 1, description: 客户端上报的轮次编号。}
|
||
task_title: {type: string, description: 所属任务当前标题,与任务历史一致。}
|
||
user_id: {type: string, format: uuid, description: 所属用户 ID。}
|
||
user_name: {type: string, description: 所属用户当前姓名。}
|
||
user_email: {type: string, description: 所属用户当前邮箱。}
|
||
user_avatar_url: {type: [string, 'null'], description: 所属用户当前头像地址;为空时使用默认头像。}
|
||
started_at: {type: string, format: date-time, description: 轮次开始时间,筛选和排序使用此时间。}
|
||
ended_at: {type: string, format: date-time, description: 轮次结束时间;此接口仅展示已结束且完成上报的轮次。}
|
||
duration_seconds: {type: number, minimum: 0, description: ended_at 减 started_at 的秒数,保留原始精度,前端按整秒显示。}
|
||
input_text: {type: [string, 'null'], description: 已上报的用户正文;未采集或无文本输入时为 null,不生成示例正文。}
|
||
input_text_truncated: {type: boolean, description: 正文是否已经被客户端截断。}
|
||
input_kind: {type: string, description: 客户端上报的输入类型。}
|
||
input_tokens: {type: [integer, 'null'], minimum: 0, description: 本轮客户端上报的输入 Token 数;未采集时为 null,不合并模型网关或子代理用量。}
|
||
output_tokens: {type: [integer, 'null'], minimum: 0, description: 本轮客户端上报的输出 Token 数;未采集时为 null,K/M/B 由前端格式化。}
|
||
outcome:
|
||
type: string
|
||
enum: [complete, interrupted, error, max_turns, output_limit, unknown]
|
||
description: 本轮原始结束原因;不表示整个任务是否结束。
|
||
error_code: {type: [string, 'null'], description: 已上报的错误码,无错误码时为 null。}
|
||
is_completed: {type: [boolean, 'null'], description: complete 为 true;unknown 为 null;其他结束原因为 false。只表示本轮是否正常完成。}
|
||
StatisticsHistory:
|
||
type: object
|
||
required:
|
||
- items
|
||
- has_next
|
||
- page
|
||
- page_size
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
type: object
|
||
required:
|
||
- id
|
||
- title
|
||
- user_id
|
||
- user_name
|
||
- user_email
|
||
- user_avatar_url
|
||
- started_at
|
||
- last_active_at
|
||
- turn_count
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
title:
|
||
type: string
|
||
description: 会话标题。
|
||
user_id:
|
||
type: string
|
||
format: uuid
|
||
description: 所属用户 ID。
|
||
user_name:
|
||
type: string
|
||
description: 所属用户当前姓名。
|
||
user_email:
|
||
type: string
|
||
description: 所属用户当前邮箱。
|
||
user_avatar_url:
|
||
type: [string, 'null']
|
||
description: 所属用户当前头像地址;为空时使用默认头像。
|
||
started_at:
|
||
type: string
|
||
format: date-time
|
||
description: 会话开始时间。
|
||
last_active_at:
|
||
type: string
|
||
format: date-time
|
||
description: 最近活动时间。
|
||
turn_count:
|
||
type: [integer, 'null']
|
||
minimum: 0
|
||
description: 已维护的累计轮次数;存量后台校准期间为 null,不在列表请求中执行计数查询。
|
||
has_next:
|
||
type: boolean
|
||
description: 每页多查一条判断是否还有下一页,不执行总数查询。
|
||
page:
|
||
type: integer
|
||
minimum: 1
|
||
description: 请求页码;越界时 items 为空数组。
|
||
page_size:
|
||
type: integer
|
||
minimum: 1
|
||
maximum: 500
|
||
CreateMemberGroupInput:
|
||
allOf:
|
||
- $ref: "#/components/schemas/MemberGroupInput"
|
||
- type: object
|
||
required: [name]
|
||
MemberGroupMembersInput:
|
||
type: object
|
||
required: [member_ids]
|
||
properties:
|
||
member_ids:
|
||
type: array
|
||
maxItems: 10000
|
||
description: 完整的直接成员 ID 列表,空数组表示清空,重复 ID 自动去重;用户须存在且未删除。
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
MemberGroupMoveInput:
|
||
type: object
|
||
required: [target_id]
|
||
description: group_ids 与 members 必须且只能有一个非空数组,分别最多 100 个分组和 1000 条成员来源关系。
|
||
properties:
|
||
target_id:
|
||
type: string
|
||
format: uuid
|
||
description: 目标分组 UUID;全零 UUID 表示虚拟根。
|
||
group_ids:
|
||
type: array
|
||
maxItems: 100
|
||
uniqueItems: true
|
||
description: 需移动的分组 ID;不能包含虚拟根或同时包含父子分组。
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
members:
|
||
type: array
|
||
maxItems: 1000
|
||
description: 需移动的成员及其来源分组;同一成员允许从不同来源分组移走。
|
||
items:
|
||
type: object
|
||
required: [id]
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
source_group_id:
|
||
type: string
|
||
format: uuid
|
||
description: 树中拖动时指定来源分组;省略表示从成员列表拖动,仅追加目标分组关系。
|
||
MemberGroupInput:
|
||
type: object
|
||
minProperties: 1
|
||
anyOf:
|
||
- required: [name]
|
||
- required: [parent_id]
|
||
properties:
|
||
name:
|
||
type: string
|
||
minLength: 1
|
||
maxLength: 100
|
||
description: 去除首尾空白后不能为空;同级名称不区分大小写且不能重复。
|
||
parent_id:
|
||
type: [string, "null"]
|
||
format: uuid
|
||
description: 新上级分组 ID,必须是有效分组;全零 UUID 或 null 表示虚拟根节点,更新时省略则保留原值。
|
||
MemberGroupsResponse:
|
||
type: object
|
||
required: [groups]
|
||
properties:
|
||
groups:
|
||
type: array
|
||
description: 首项为全零 UUID 的虚拟根节点,其余未删除分组按创建时间和 ID 排序。
|
||
items:
|
||
$ref: "#/components/schemas/MemberGroup"
|
||
MemberGroup:
|
||
type: object
|
||
required: [id, parent_id, name, member_ids, actions, allow_add_members]
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
description: 分组唯一标识;虚拟根节点固定为 00000000-0000-0000-0000-000000000000。
|
||
parent_id:
|
||
type: [string, "null"]
|
||
format: uuid
|
||
description: 上级分组 ID;仅虚拟根节点为 null,其他顶层分组指向根节点的全零 UUID。
|
||
name:
|
||
type: string
|
||
description: 分组显示名称。
|
||
member_ids:
|
||
type: array
|
||
description: 未删除用户的直接分组关系,不含子分组成员;虚拟根节点列出未直接加入其他有效分组的用户,新用户自动归属该节点。
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
actions:
|
||
type: array
|
||
description: 后端允许在该分组上执行的管理动作;根节点仅允许新增子组。
|
||
items:
|
||
type: string
|
||
enum: [add-subgroup, rename, adjust-members, move, delete]
|
||
allow_add_members:
|
||
type: boolean
|
||
description: 是否允许从成员列表向本分组拖动并追加成员关系;虚拟根节点为 false。
|
||
CreditAmount:
|
||
type: string
|
||
pattern: ^-?\d+(\.\d{1,6})?$
|
||
description: 十进制定点积分,最多六位小数。
|
||
BillingPrice:
|
||
type: object
|
||
properties:
|
||
input:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
cached:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
output:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
multiplier:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
tool:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
BillingPolicy:
|
||
type: object
|
||
properties:
|
||
root_credits:
|
||
$ref: "#/components/schemas/CreditAmount"
|
||
revision:
|
||
type: integer
|
||
enabled:
|
||
type: boolean
|
||
charging_mode:
|
||
description: local 为本地扣费;remote 为百智云扣费,仅具有有效百智云登录身份的用户可访问系统资源,用户自建资源仍遵循原授权。
|
||
enum:
|
||
- local
|
||
- remote
|
||
quota_refresh_cycle:
|
||
enum:
|
||
- daily
|
||
- weekly
|
||
- monthly
|
||
pending_cycle:
|
||
enum:
|
||
- daily
|
||
- weekly
|
||
- monthly
|
||
cycle_effective_at:
|
||
type: string
|
||
format: date-time
|
||
description: 新刷新规则的下一自然边界;保存时不重置当期余额,切换时才发放新周期额度。
|
||
cycle_anchor:
|
||
type: string
|
||
format: date-time
|
||
cycle_transition_start:
|
||
type: string
|
||
format: date-time
|
||
description: 待切换期间保留的当前账户起点,直到 cycle_effective_at 均沿用此账户。
|
||
input_credits_per_million_tokens:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
cached_input_credits_per_million_tokens:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
output_credits_per_million_tokens:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
required:
|
||
- revision
|
||
- enabled
|
||
- charging_mode
|
||
- quota_refresh_cycle
|
||
BillingWalletInput:
|
||
type: object
|
||
additionalProperties: false
|
||
required:
|
||
- revision
|
||
- base_url
|
||
- app_id
|
||
properties:
|
||
revision:
|
||
type: integer
|
||
description: 当前计费策略修订号;保存连接配置会递增该修订号。
|
||
base_url:
|
||
type: string
|
||
format: uri
|
||
description: 百智云 HTTPS 服务根地址,可包含端口,不含路径、查询参数、片段或用户信息。公有云填写 https://baizhi.cloud 或 https://baizhiyun.vip,私有化填写同时提供用户和钱包接口的统一网关地址。
|
||
example: https://baizhi.cloud
|
||
app_id:
|
||
type: integer
|
||
minimum: 1
|
||
maximum: 999
|
||
description: 所填服务对应的百智云应用 ID。
|
||
certificate:
|
||
type: string
|
||
maxLength: 65536
|
||
writeOnly: true
|
||
description: 客户端证书 PEM 内容,首次配置必填,省略或空字符串保留已保存值。
|
||
private_key:
|
||
type: string
|
||
maxLength: 65536
|
||
writeOnly: true
|
||
description: PKCS#8 ECDSA 私钥 PEM 内容,首次配置必填,省略或空字符串保留已保存值;不回显、不写入审计明文。
|
||
ca_certificate:
|
||
type: string
|
||
maxLength: 65536
|
||
writeOnly: true
|
||
description: 服务端根 CA 证书 PEM 内容,首次配置必填,省略或空字符串保留已保存值。
|
||
BillingWalletInfo:
|
||
type: object
|
||
description: 仅返回连接元信息;configured 表示本地证书校验通过,不代表远程网络连通或账户授权成功。
|
||
properties:
|
||
configured:
|
||
type: boolean
|
||
credentials_configured:
|
||
type: boolean
|
||
description: 是否已有完整证书和私钥;为 true 时更新配置可以省略对应文件。
|
||
base_url:
|
||
type: string
|
||
format: uri
|
||
app_id:
|
||
type: integer
|
||
minimum: 1
|
||
maximum: 999
|
||
certificate_expires_at:
|
||
type: string
|
||
format: date-time
|
||
source:
|
||
type: string
|
||
enum: [admin, environment]
|
||
description: 当前使用后台保存的配置或部署环境配置;后台配置优先。
|
||
error:
|
||
type: string
|
||
description: 配置无效或证书过期时的提示,不包含凭证原文。
|
||
required:
|
||
- configured
|
||
- credentials_configured
|
||
CreditAccount:
|
||
type: object
|
||
properties:
|
||
version:
|
||
type: string
|
||
description: 当前账户的版本,随账本变更更新;用于管理员调整时检查并发及重复提交,历史账户条目可省略。
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
user_id:
|
||
type: string
|
||
format: uuid
|
||
group_id:
|
||
type: string
|
||
description: 计费分组 UUID;未指定归属时为空字符串。
|
||
period_start_at:
|
||
type: string
|
||
format: date-time
|
||
period_end_at:
|
||
type: string
|
||
format: date-time
|
||
balance:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
frozen:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
description: 兼容字段,迁移后为零。
|
||
available:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
quota:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
required:
|
||
- id
|
||
- user_id
|
||
- balance
|
||
- frozen
|
||
- available
|
||
- quota
|
||
- period_start_at
|
||
- period_end_at
|
||
CreditEntry:
|
||
type: object
|
||
properties:
|
||
user_avatar_url:
|
||
type: [string, 'null']
|
||
description: 管理员流水列表返回用户当前头像;为空时使用默认头像。
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
account_id:
|
||
type: string
|
||
format: uuid
|
||
transaction_id:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
format: uuid
|
||
user_id:
|
||
type: string
|
||
format: uuid
|
||
user_name:
|
||
type: string
|
||
user_email:
|
||
type: string
|
||
item_name:
|
||
type: string
|
||
category:
|
||
enum:
|
||
- model
|
||
- tool
|
||
- other
|
||
entry_type:
|
||
enum:
|
||
- grant
|
||
- charge
|
||
- refund
|
||
- adjustment
|
||
- reset
|
||
credit_delta:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
balance_after:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
mode:
|
||
enum:
|
||
- local
|
||
- remote
|
||
sequence:
|
||
type: string
|
||
occurred_at:
|
||
type: string
|
||
format: date-time
|
||
metadata:
|
||
type: object
|
||
BillingUsage:
|
||
type: object
|
||
properties:
|
||
known:
|
||
type: boolean
|
||
stream:
|
||
type: boolean
|
||
description: 是否为流式调用;历史记录可能缺失。
|
||
result:
|
||
enum:
|
||
- succeeded
|
||
- failed
|
||
- cancelled
|
||
request_id:
|
||
type: string
|
||
error_code:
|
||
type: string
|
||
terminal_event:
|
||
type: string
|
||
description: 代理观察到的流终止事件或非流式响应状态。
|
||
initial_error_code:
|
||
type: string
|
||
description: 自动对账前的原始异常原因。
|
||
reconciled:
|
||
type: boolean
|
||
description: 是否已通过上游查询自动补全用量。
|
||
input_tokens:
|
||
type: integer
|
||
minimum: 0
|
||
cached_input_tokens:
|
||
type: integer
|
||
minimum: 0
|
||
output_tokens:
|
||
type: integer
|
||
minimum: 0
|
||
required:
|
||
- result
|
||
BillingTransaction:
|
||
type: object
|
||
properties:
|
||
user_avatar_url:
|
||
type: [string, 'null']
|
||
description: 管理员待处理列表返回用户当前头像;为空时使用默认头像。
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
user_id:
|
||
type: string
|
||
format: uuid
|
||
user_name:
|
||
type: string
|
||
user_email:
|
||
type: string
|
||
item_name:
|
||
type: string
|
||
account_id:
|
||
type: string
|
||
format: uuid
|
||
session_id:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
format: uuid
|
||
category:
|
||
enum:
|
||
- model
|
||
- tool
|
||
mode:
|
||
enum:
|
||
- local
|
||
- remote
|
||
status:
|
||
enum:
|
||
- created
|
||
- reserved
|
||
- running
|
||
- settling
|
||
- settled
|
||
- released
|
||
- rejected
|
||
- unknown
|
||
reserve:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
amount:
|
||
anyOf:
|
||
- $ref: '#/components/schemas/CreditAmount'
|
||
- type: 'null'
|
||
raw_amount:
|
||
anyOf:
|
||
- $ref: '#/components/schemas/CreditAmount'
|
||
- type: 'null'
|
||
pricing:
|
||
$ref: '#/components/schemas/BillingPrice'
|
||
usage:
|
||
$ref: '#/components/schemas/BillingUsage'
|
||
error_code:
|
||
type: string
|
||
attempts:
|
||
type: integer
|
||
started_at:
|
||
type: string
|
||
format: date-time
|
||
completed_at:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
format: date-time
|
||
entries:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/CreditEntry'
|
||
wallet_records:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
biz_id:
|
||
type: string
|
||
status:
|
||
type: string
|
||
external_user_id:
|
||
type: string
|
||
base_url:
|
||
type: string
|
||
format: uri
|
||
app_id:
|
||
type: integer
|
||
frozen_amount_quota:
|
||
type: string
|
||
actual_amount_quota:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
trace_id:
|
||
type: string
|
||
error_code:
|
||
type: string
|
||
ErrorResponse:
|
||
type: object
|
||
required: [error]
|
||
properties:
|
||
error:
|
||
$ref: "#/components/schemas/Error"
|
||
Error:
|
||
type: object
|
||
required: [code, message]
|
||
properties:
|
||
code:
|
||
type: string
|
||
description: 供调用方识别错误类别的稳定代码。
|
||
examples: [model_error]
|
||
message:
|
||
type: string
|
||
description: 面向用户或开发者的错误说明。
|
||
ModelsResponse:
|
||
type: object
|
||
required: [models]
|
||
properties:
|
||
next_cursor:
|
||
type: string
|
||
description: 后续页游标;无后续页或未启用分页时为空字符串。
|
||
models:
|
||
type: array
|
||
description: 分页时按 ID 升序;未启用分页时按创建时间倒序。
|
||
items:
|
||
$ref: "#/components/schemas/Model"
|
||
SystemProxy:
|
||
type: object
|
||
required: [name, url]
|
||
properties:
|
||
id: {type: string, format: uuid}
|
||
name: {type: string}
|
||
url: {type: string, pattern: "^(http|https|socks5)://"}
|
||
username: {type: string}
|
||
password: {type: string, writeOnly: true}
|
||
ProxySetting:
|
||
type: object
|
||
properties:
|
||
key: {type: string, const: proxies}
|
||
schema_version: {type: integer}
|
||
value:
|
||
type: object
|
||
properties:
|
||
proxies:
|
||
type: array
|
||
items:
|
||
$ref: "#/components/schemas/SystemProxy"
|
||
Model:
|
||
type: object
|
||
required:
|
||
- id
|
||
- ownership_type
|
||
- user
|
||
- model_id
|
||
- display_name
|
||
- protocol
|
||
- kind
|
||
- provider
|
||
- base_url
|
||
- api_key_configured
|
||
- authorization
|
||
- enabled
|
||
- created_at
|
||
- updated_at
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
description: MonkeyAI 内部模型 ID,也是 Agent 调用时使用的 model 值。
|
||
ownership_type:
|
||
type: string
|
||
enum: [system, user]
|
||
description: system 表示管理员配置的系统模型,user 表示用户自带模型。
|
||
user:
|
||
$ref: '#/components/schemas/UserSummary'
|
||
readOnly: true
|
||
description: 资源所有者的基本信息;系统资源返回创建者,分享不改变归属。
|
||
model_id:
|
||
type: string
|
||
description: 上游服务使用的模型标识。
|
||
display_name:
|
||
type: string
|
||
description: 管理后台和 Agent 展示的模型名称。
|
||
protocol:
|
||
$ref: "#/components/schemas/ModelProtocol"
|
||
kind:
|
||
$ref: "#/components/schemas/ModelKind"
|
||
provider:
|
||
$ref: "#/components/schemas/ModelProvider"
|
||
image_config:
|
||
$ref: "#/components/schemas/ImageConfig"
|
||
image_pricing:
|
||
$ref: "#/components/schemas/ImagePricing"
|
||
base_url:
|
||
type: string
|
||
format: uri
|
||
description: 上游模型服务的 HTTP(S) 基础地址。
|
||
proxy_id:
|
||
type: string
|
||
description: 系统代理资源 ID;空字符串表示直连。
|
||
api_key_configured:
|
||
type: boolean
|
||
description: 是否已配置上游 API Key;响应不会返回密钥原文。
|
||
advanced_config:
|
||
$ref: "#/components/schemas/AdvancedConfig"
|
||
credit_multiplier:
|
||
type: number
|
||
exclusiveMinimum: 0
|
||
description: 本模型消耗积分时使用的倍率。
|
||
tags:
|
||
type: array
|
||
items: {$ref: '#/components/schemas/ResourceTag'}
|
||
authorization:
|
||
$ref: "#/components/schemas/Authorization"
|
||
enabled:
|
||
type: boolean
|
||
description: 模型是否允许被调用。
|
||
created_at:
|
||
type: string
|
||
format: date-time
|
||
description: 模型创建时间。
|
||
updated_at:
|
||
type: string
|
||
format: date-time
|
||
description: 模型最后更新时间。
|
||
ModelProtocol:
|
||
type: string
|
||
enum: [openai_chat_completions, openai_responses, anthropic, image_generation, video_generation]
|
||
description: MonkeyAI 与上游服务通信时使用的协议。
|
||
ModelKind:
|
||
type: string
|
||
enum: [text, image, video]
|
||
description: 模型对外提供的能力;省略时兼容为 text。
|
||
ModelProvider:
|
||
type: string
|
||
enum: [passthrough, openai_images, openai_responses_image, volcengine, xai, agnes]
|
||
description: 上游调用路径;text 模型只允许 passthrough。
|
||
ImageQuality:
|
||
type: string
|
||
enum: [1K, 2K, 4K]
|
||
description: 平台统一的生图画质档位;具体像素由供应商适配器映射。
|
||
ImageConfig:
|
||
type: object
|
||
required: [qualities, aspect_ratios, default_quality, default_aspect_ratio]
|
||
properties:
|
||
qualities:
|
||
type: array
|
||
minItems: 1
|
||
uniqueItems: true
|
||
items: {$ref: '#/components/schemas/ImageQuality'}
|
||
aspect_ratios:
|
||
type: array
|
||
minItems: 1
|
||
uniqueItems: true
|
||
items: {type: string, pattern: '^[1-9][0-9]*:[1-9][0-9]*$'}
|
||
default_quality: {$ref: '#/components/schemas/ImageQuality'}
|
||
default_aspect_ratio: {type: string}
|
||
ImageMultiplier:
|
||
type: object
|
||
required: [name, multiplier]
|
||
properties:
|
||
name: {$ref: '#/components/schemas/ImageQuality'}
|
||
multiplier:
|
||
type: string
|
||
pattern: '^[0-9]+(\.[0-9]{1,6})?$'
|
||
description: 大于 0 的十进制倍率,最多 6 位小数。
|
||
ImageRate:
|
||
type: object
|
||
required: [quality, credits_per_image]
|
||
properties:
|
||
quality: {$ref: '#/components/schemas/ImageQuality'}
|
||
credits_per_image:
|
||
type: string
|
||
pattern: '^[0-9]+(\.[0-9]{1,6})?$'
|
||
description: 该画质每张图的最终积分价,允许 0,最多六位小数。
|
||
ImagePricing:
|
||
type: object
|
||
description: 返回按画质配置的单张积分价格。写入兼容旧版基础价和倍率,但不可与 rates 混用;旧配置按原定点计算规则换算后返回,不重写历史账单。
|
||
oneOf:
|
||
- required: [rates]
|
||
not:
|
||
anyOf:
|
||
- required: [base_credits_per_image]
|
||
- required: [quality_multipliers]
|
||
- required: [base_credits_per_image]
|
||
not: {required: [rates]}
|
||
properties:
|
||
rates:
|
||
type: array
|
||
minItems: 1
|
||
maxItems: 3
|
||
description: 每个已开放画质必须恰好配置一次。
|
||
items: {$ref: '#/components/schemas/ImageRate'}
|
||
base_credits_per_image: {type: string, deprecated: true, pattern: '^[0-9]+(\.[0-9]{1,6})?$'}
|
||
quality_multipliers:
|
||
type: array
|
||
deprecated: true
|
||
items: {$ref: '#/components/schemas/ImageMultiplier'}
|
||
AdvancedConfig:
|
||
type: object
|
||
required: [context_window_tokens, max_output_tokens, supports_vision]
|
||
properties:
|
||
context_window_tokens:
|
||
type: integer
|
||
format: int64
|
||
minimum: 0
|
||
description: 文本模型必须大于 0;生图模型返回 0。
|
||
max_output_tokens:
|
||
type: integer
|
||
format: int64
|
||
minimum: 0
|
||
description: 文本模型必须大于 0;生图模型返回 0。
|
||
supports_vision:
|
||
type: boolean
|
||
description: 模型是否支持图像输入。
|
||
supports_reasoning:
|
||
type: boolean
|
||
default: false
|
||
description: 模型是否支持推理能力;旧模型省略时视为 false。
|
||
Authorization:
|
||
type: object
|
||
description: 可使用该模型的用户和分组。全零 UUID 根分组表示全员授权(包括后续新增用户),服务端入库时转为 all_users,管理端回包统一以 group_ids 中的根 UUID 表示。兼容输入 all_users=true,此时忽略其他授权 ID。
|
||
required: [user_ids, group_ids]
|
||
properties:
|
||
all_users:
|
||
type: boolean
|
||
default: false
|
||
description: 兼容写入全员授权的旧字段;管理端回包固定为 false,统一通过 group_ids 中的根 UUID 表示。
|
||
user_ids:
|
||
type: array
|
||
description: 获得模型访问权的用户 UUID。
|
||
uniqueItems: true
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
group_ids:
|
||
type: array
|
||
description: 获得模型访问权的分组 UUID;全零 UUID 表示全员。
|
||
uniqueItems: true
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
ModelInput:
|
||
type: object
|
||
required:
|
||
- model_id
|
||
- display_name
|
||
- protocol
|
||
- base_url
|
||
- authorization
|
||
properties:
|
||
model_id:
|
||
type: string
|
||
minLength: 1
|
||
description: 上游服务使用的模型标识。
|
||
display_name:
|
||
type: string
|
||
minLength: 1
|
||
description: 模型展示名称。
|
||
protocol:
|
||
$ref: "#/components/schemas/ModelProtocol"
|
||
kind:
|
||
$ref: "#/components/schemas/ModelKind"
|
||
provider:
|
||
$ref: "#/components/schemas/ModelProvider"
|
||
provider_options:
|
||
type: object
|
||
description: 非敏感路由参数,不包含上游密钥或画质比例映射。
|
||
image_config:
|
||
$ref: "#/components/schemas/ImageConfig"
|
||
image_pricing:
|
||
$ref: "#/components/schemas/ImagePricing"
|
||
base_url:
|
||
type: string
|
||
format: uri
|
||
pattern: "^https?://"
|
||
description: 上游模型服务的 HTTP(S) 基础地址。
|
||
proxy_id:
|
||
type: string
|
||
description: 系统代理资源 ID;空字符串表示直连。
|
||
api_key:
|
||
type: string
|
||
description: 上游 API Key;更新时传空字符串可保留原密钥。
|
||
advanced_config:
|
||
$ref: "#/components/schemas/AdvancedConfig"
|
||
credit_multiplier:
|
||
type: number
|
||
exclusiveMinimum: 0
|
||
description: 积分消耗倍率。
|
||
tag_ids:
|
||
type: array
|
||
items: {type: string, format: uuid}
|
||
authorization:
|
||
$ref: "#/components/schemas/Authorization"
|
||
CreateModelInput:
|
||
allOf:
|
||
- $ref: "#/components/schemas/ModelInput"
|
||
- type: object
|
||
required: [api_key]
|
||
properties:
|
||
api_key:
|
||
type: string
|
||
minLength: 1
|
||
description: 上游 API Key,创建时不能为空。
|
||
SetModelEnabledInput:
|
||
type: object
|
||
required: [enabled]
|
||
properties:
|
||
enabled:
|
||
type: boolean
|
||
description: true 为启用模型,false 为停用模型。
|
||
AuthorizationSubjects:
|
||
type: object
|
||
required: [groups, users]
|
||
properties:
|
||
groups:
|
||
type: array
|
||
description: 包含全零 UUID 的虚拟根节点及全部可授权分组。
|
||
items:
|
||
$ref: "#/components/schemas/GroupSubject"
|
||
users:
|
||
type: array
|
||
description: 可授权的活跃用户。
|
||
items:
|
||
$ref: "#/components/schemas/UserSubject"
|
||
GroupSubject:
|
||
type: object
|
||
required: [id, name]
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
description: 分组 ID。
|
||
parent_id:
|
||
type: string
|
||
format: uuid
|
||
description: 父分组 ID;仅虚拟根分组不返回该字段,其他顶层分组指向根 UUID。
|
||
name:
|
||
type: string
|
||
description: 分组名称。
|
||
UserSubject:
|
||
type: object
|
||
required: [id, name, email, group_id]
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
description: 用户 ID。
|
||
name:
|
||
type: string
|
||
description: 用户显示名称。
|
||
email:
|
||
type: string
|
||
format: email
|
||
description: 用户邮箱。
|
||
avatar_url:
|
||
type: string
|
||
description: 当前用户头像地址;未配置时省略。
|
||
group_id:
|
||
type: string
|
||
format: uuid
|
||
description: 授权选择器展示的用户所属分组;未加入其他分组时为根 UUID,多组用户取创建时间最早的分组。
|
||
APIKeysResponse:
|
||
type: object
|
||
required: [api_keys]
|
||
properties:
|
||
api_keys:
|
||
type: array
|
||
description: 调用密钥元数据,不包含可用于鉴权的密钥原文。
|
||
items:
|
||
$ref: "#/components/schemas/APIKey"
|
||
APIKey:
|
||
type: object
|
||
required:
|
||
- id
|
||
- user_id
|
||
- name
|
||
- key_prefix
|
||
- scopes
|
||
- expires_at
|
||
- created_at
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
description: 调用密钥 ID。
|
||
user_id:
|
||
type: string
|
||
format: uuid
|
||
description: 密钥所属用户 ID。
|
||
user_name:
|
||
type: string
|
||
description: 密钥所属用户的显示名称。
|
||
name:
|
||
type: string
|
||
description: 用户设置的密钥名称。
|
||
key_prefix:
|
||
type: string
|
||
description: 用于识别密钥的安全前缀,不可用于鉴权。
|
||
examples:
|
||
- mk_abcd1234
|
||
scopes:
|
||
type: array
|
||
description: 密钥具备的调用权限。
|
||
minItems: 1
|
||
uniqueItems: true
|
||
items:
|
||
type: string
|
||
enum:
|
||
- model:invoke
|
||
- mcp:invoke
|
||
expires_at:
|
||
type: string
|
||
format: date-time
|
||
description: 密钥过期时间。
|
||
last_used_at:
|
||
type: string
|
||
format: date-time
|
||
description: 最近一次成功使用时间;从未使用时不返回。
|
||
created_at:
|
||
type: string
|
||
format: date-time
|
||
description: 密钥创建时间。
|
||
revoked_at:
|
||
type: string
|
||
format: date-time
|
||
description: 密钥撤销时间;尚未撤销时不返回。
|
||
UserSummary:
|
||
type: object
|
||
required: [id, name, email]
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
description: 用户名。
|
||
email:
|
||
type: string
|
||
format: email
|
||
ResourceGrant:
|
||
type: object
|
||
description: 每条授权只能选择用户或分组之一;全零 UUID 的虚拟根分组表示全员授权,服务端入库时转换为 all_users,管理端读取时转换回 group_id。兼容写入 all_users=true,但不能同时指定用户或分组。
|
||
properties:
|
||
all_users:
|
||
type: boolean
|
||
default: false
|
||
description: 兼容旧请求的全员授权字段;管理端回包固定为 false,改由根分组 UUID 表示。
|
||
user_id:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
format: uuid
|
||
user:
|
||
readOnly: true
|
||
description: 用户授权的展示信息;分组、全员授权或用户已删除时为 null。停用用户仍返回信息,便于撤销授权。
|
||
anyOf:
|
||
- $ref: '#/components/schemas/UserSummary'
|
||
- type: 'null'
|
||
group_id:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
format: uuid
|
||
usage_requirement:
|
||
type: string
|
||
enum:
|
||
- optional
|
||
- required
|
||
description: 仅系统规则可设置 required。
|
||
required:
|
||
- usage_requirement
|
||
ResourceError:
|
||
type: object
|
||
properties:
|
||
error:
|
||
type: object
|
||
properties:
|
||
code:
|
||
type: string
|
||
message:
|
||
type: string
|
||
references:
|
||
type:
|
||
- array
|
||
- 'null'
|
||
items:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
required:
|
||
- code
|
||
- message
|
||
required:
|
||
- error
|
||
ResourceTag:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
required:
|
||
- id
|
||
- name
|
||
OAuthConnectionConfig:
|
||
type: object
|
||
description: dynamic 模式只需 MCP URL,首次授权自动发现 OAuth 元数据并动态注册客户端;发现及注册结果由后端维护,同一 URL 的普通编辑保留结果,修改 URL 后重新发现。manual 或未指定模式时,授权与 Token URL 必填,Client ID 和 Registration URL 至少填写一个。后续授权与刷新复用客户端;不支持需要初始访问令牌的注册端点。
|
||
properties:
|
||
mode:
|
||
type: string
|
||
enum: ['', manual, dynamic]
|
||
description: 动态自动发现与传统手动配置分开;未指定时沿用已有手动端点配置。
|
||
resource:
|
||
type: string
|
||
readOnly: true
|
||
description: 自动发现的资源标识,授权及 Token 请求携带此 resource 参数。
|
||
authorization_url:
|
||
type: string
|
||
token_url:
|
||
type: string
|
||
client_id:
|
||
type: string
|
||
registration_url:
|
||
type: string
|
||
description: RFC 7591 动态客户端注册端点;已有 Client ID 时复用,动态注册密钥到期后在下次授权前重新注册,旧客户端对应的凭证需重新授权。
|
||
token_endpoint_auth_method:
|
||
type: string
|
||
enum: ['', none, client_secret_post, client_secret_basic]
|
||
description: 自动发现模式按服务端元数据选择认证方式,优先 none;手动端点配置留空时,动态注册请求 none,已有客户端沿用 client_secret_post;注册后保存服务端返回的方式。
|
||
client_secret_expires_at:
|
||
type: integer
|
||
format: int64
|
||
readOnly: true
|
||
description: 注册服务器返回的客户端密钥到期时间(Unix 秒);未返回或为 0 表示无已知期限,由后端维护,修改请求中的值被忽略。
|
||
scopes:
|
||
type: string
|
||
ResourceIssue:
|
||
type: object
|
||
properties:
|
||
code:
|
||
type: string
|
||
blocking:
|
||
type: boolean
|
||
connector_id:
|
||
type: string
|
||
format: uuid
|
||
required:
|
||
- code
|
||
- blocking
|
||
MCPTool:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
description:
|
||
type: string
|
||
input_schema:
|
||
type: object
|
||
enabled:
|
||
type: boolean
|
||
credits_per_call:
|
||
type: number
|
||
minimum: 0
|
||
required:
|
||
- id
|
||
- name
|
||
- description
|
||
- input_schema
|
||
- enabled
|
||
- credits_per_call
|
||
AgentRule:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
content:
|
||
type: string
|
||
sha256:
|
||
type: string
|
||
required:
|
||
type: boolean
|
||
required:
|
||
- id
|
||
- name
|
||
- content
|
||
- sha256
|
||
- required
|
||
AgentSkill:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
description:
|
||
type: string
|
||
package_sha256:
|
||
type: string
|
||
package_size_bytes:
|
||
type: integer
|
||
file_count:
|
||
type: integer
|
||
download_path:
|
||
type: string
|
||
tags:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ResourceTag'
|
||
required:
|
||
- id
|
||
- name
|
||
- description
|
||
- package_sha256
|
||
- download_path
|
||
AgentConnector:
|
||
type: object
|
||
properties:
|
||
tags:
|
||
type: array
|
||
items: {$ref: '#/components/schemas/ResourceTag'}
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
icon_path:
|
||
type: string
|
||
name:
|
||
type: string
|
||
description:
|
||
type: string
|
||
name_i18n:
|
||
type: object
|
||
additionalProperties: {type: string}
|
||
description_i18n:
|
||
type: object
|
||
additionalProperties: {type: string}
|
||
authorization_mode:
|
||
type: string
|
||
enum:
|
||
- none
|
||
- centralized
|
||
- independent
|
||
authorization_method:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
authorization_status:
|
||
type: string
|
||
enum:
|
||
- not_required
|
||
- authorized
|
||
- authorization_required
|
||
connection_status:
|
||
type: string
|
||
capabilities:
|
||
type: array
|
||
items:
|
||
type: string
|
||
enum:
|
||
- catalog
|
||
- invoke
|
||
tools:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/MCPTool'
|
||
tools_version:
|
||
type: string
|
||
credentials:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/AgentCredential'
|
||
mcp_gateway:
|
||
$ref: '#/components/schemas/MCPGateway'
|
||
credential_id:
|
||
type: string
|
||
format: uuid
|
||
description: 集中认证返回当前集中凭证 ID;独立认证在 resolve 选定后返回所选凭证 ID。
|
||
required:
|
||
type: boolean
|
||
required:
|
||
- id
|
||
- name
|
||
- authorization_mode
|
||
- capabilities
|
||
description: 独立认证在 credentials 内返回每份凭证的工具和专属代理地址;集中认证返回当前集中凭证的代理地址,免认证返回连接地址。resolve 返回所选凭证、工具和 mcp_gateway,API Key 全局创建。
|
||
AgentExpert:
|
||
type: object
|
||
properties:
|
||
tags:
|
||
type: array
|
||
items: {$ref: '#/components/schemas/ResourceTag'}
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
description:
|
||
type: string
|
||
version:
|
||
type: string
|
||
manifest_path:
|
||
type: string
|
||
available:
|
||
type: boolean
|
||
issues:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ResourceIssue'
|
||
required:
|
||
- id
|
||
- name
|
||
- version
|
||
- manifest_path
|
||
- available
|
||
- issues
|
||
ExpertManifest:
|
||
type: object
|
||
properties:
|
||
expert_id:
|
||
type: string
|
||
name:
|
||
type: string
|
||
prompt:
|
||
type: string
|
||
version:
|
||
type: string
|
||
available:
|
||
type: boolean
|
||
rules:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/AgentRule'
|
||
skills:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/AgentSkill'
|
||
connectors:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/AgentConnector'
|
||
issues:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ResourceIssue'
|
||
required:
|
||
- expert_id
|
||
- prompt
|
||
- version
|
||
- available
|
||
- rules
|
||
- skills
|
||
- connectors
|
||
- issues
|
||
ResolveResources:
|
||
type: object
|
||
properties:
|
||
expert_id:
|
||
type: string
|
||
format: uuid
|
||
rule_ids:
|
||
type: array
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
skill_ids:
|
||
type: array
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
connector_bindings:
|
||
type: object
|
||
additionalProperties:
|
||
type: string
|
||
format: uuid
|
||
description: 本次已选择的独立 Connector ID 到凭证 ID;不会隐式选择连接。无绑定时恰好一个有效凭证才自动选择,多份返回 credential_selection_required。
|
||
connector_ids:
|
||
type: array
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
OAuthAuthorization:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
authorization_url:
|
||
type: string
|
||
format: uri
|
||
expires_at:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
format: date-time
|
||
required:
|
||
- id
|
||
- authorization_url
|
||
- expires_at
|
||
AuthorizationStatus:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
status:
|
||
type: string
|
||
enum:
|
||
- pending
|
||
- processing
|
||
- succeeded
|
||
- failed
|
||
- expired
|
||
credential_id:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
format: uuid
|
||
expires_at:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
format: date-time
|
||
required:
|
||
- id
|
||
- status
|
||
CredentialInput:
|
||
type: object
|
||
properties:
|
||
name:
|
||
type: string
|
||
minLength: 1
|
||
maxLength: 128
|
||
http_headers:
|
||
type: object
|
||
minProperties: 1
|
||
maxProperties: 30
|
||
additionalProperties:
|
||
type: string
|
||
writeOnly: true
|
||
description: 完整 Header 键值;禁止大小写重复、CR/LF、Host、传输控制、Mcp-*、Content-Type 和 Accept。整组替换,响应不回填。
|
||
required:
|
||
- name
|
||
- http_headers
|
||
RuleResource:
|
||
type: object
|
||
properties:
|
||
shared_users:
|
||
type: array
|
||
readOnly: true
|
||
items:
|
||
$ref: '#/components/schemas/UserSummary'
|
||
description: 个人规则已共享的用户;未共享时为 [],系统规则不返回。
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
revision:
|
||
type: integer
|
||
minimum: 1
|
||
ownership_type:
|
||
type: string
|
||
enum:
|
||
- system
|
||
- user
|
||
user:
|
||
$ref: '#/components/schemas/UserSummary'
|
||
readOnly: true
|
||
description: 资源所有者的基本信息;系统资源返回创建者,分享不改变归属。
|
||
icon_path:
|
||
type: string
|
||
enabled:
|
||
type: boolean
|
||
grants:
|
||
description: 系统规则的授权范围及强制性:required 不可关闭,optional 默认开启但可由 Agent 关闭;个人规则可向指定用户共享只读使用权,不可强制应用。
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ResourceGrant'
|
||
created_at:
|
||
type: string
|
||
format: date-time
|
||
updated_at:
|
||
type: string
|
||
format: date-time
|
||
content:
|
||
type: string
|
||
required:
|
||
- id
|
||
- name
|
||
- revision
|
||
- grants
|
||
RuleInput:
|
||
type: object
|
||
properties:
|
||
content:
|
||
type: string
|
||
name:
|
||
type: string
|
||
minLength: 1
|
||
maxLength: 200
|
||
grants:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ResourceGrant'
|
||
required:
|
||
- name
|
||
- content
|
||
SkillResource:
|
||
type: object
|
||
properties:
|
||
shared_users:
|
||
type: array
|
||
readOnly: true
|
||
items:
|
||
$ref: '#/components/schemas/UserSummary'
|
||
description: 仅资源所有者和管理端读取个人资源时返回共享用户列表,未共享时为 [],排除已删除用户;接收方和系统资源不返回。目录中的用户信息变化会更新 ETag。
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
revision:
|
||
type: integer
|
||
minimum: 1
|
||
ownership_type:
|
||
type: string
|
||
enum:
|
||
- system
|
||
- user
|
||
user:
|
||
$ref: '#/components/schemas/UserSummary'
|
||
readOnly: true
|
||
description: 资源所有者的基本信息;系统资源返回创建者,分享不改变归属。
|
||
icon_path:
|
||
type: string
|
||
enabled:
|
||
type: boolean
|
||
grants:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ResourceGrant'
|
||
created_at:
|
||
type: string
|
||
format: date-time
|
||
updated_at:
|
||
type: string
|
||
format: date-time
|
||
description:
|
||
type: string
|
||
package_file_name:
|
||
type: string
|
||
package_sha256:
|
||
type: string
|
||
package_size_bytes:
|
||
type: integer
|
||
file_count:
|
||
type: integer
|
||
tags:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ResourceTag'
|
||
required:
|
||
- id
|
||
- name
|
||
- revision
|
||
- grants
|
||
SkillInput:
|
||
type: object
|
||
properties:
|
||
name:
|
||
type: string
|
||
description:
|
||
type: string
|
||
content:
|
||
type: string
|
||
tag_ids:
|
||
type: array
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
grants:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ResourceGrant'
|
||
required:
|
||
- name
|
||
ExpertResource:
|
||
type: object
|
||
properties:
|
||
tags:
|
||
type: array
|
||
items: {$ref: '#/components/schemas/ResourceTag'}
|
||
shared_users:
|
||
type: array
|
||
readOnly: true
|
||
items:
|
||
$ref: '#/components/schemas/UserSummary'
|
||
description: 仅资源所有者和管理端读取个人资源时返回共享用户列表,未共享时为 [],排除已删除用户;接收方和系统资源不返回。目录中的用户信息变化会更新 ETag。
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
revision:
|
||
type: integer
|
||
minimum: 1
|
||
ownership_type:
|
||
type: string
|
||
enum:
|
||
- system
|
||
- user
|
||
user:
|
||
$ref: '#/components/schemas/UserSummary'
|
||
readOnly: true
|
||
description: 资源所有者的基本信息;系统资源返回创建者,分享不改变归属。
|
||
icon_path:
|
||
type: string
|
||
enabled:
|
||
type: boolean
|
||
grants:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ResourceGrant'
|
||
created_at:
|
||
type: string
|
||
format: date-time
|
||
updated_at:
|
||
type: string
|
||
format: date-time
|
||
description:
|
||
type: string
|
||
prompt:
|
||
type: string
|
||
rule_ids:
|
||
type: array
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
skill_ids:
|
||
type: array
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
connectors:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ConnectorDependency'
|
||
required:
|
||
- id
|
||
- name
|
||
- revision
|
||
- grants
|
||
ExpertInput:
|
||
type: object
|
||
properties:
|
||
tag_ids:
|
||
type: array
|
||
items: {type: string, format: uuid}
|
||
description:
|
||
type: string
|
||
prompt:
|
||
type: string
|
||
rule_ids:
|
||
type: array
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
skill_ids:
|
||
type: array
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
minLength: 1
|
||
maxLength: 200
|
||
grants:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ResourceGrant'
|
||
connectors:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ConnectorDependency'
|
||
required:
|
||
- name
|
||
- prompt
|
||
ConnectorResource:
|
||
type: object
|
||
properties:
|
||
tags:
|
||
type: array
|
||
items: {$ref: '#/components/schemas/ResourceTag'}
|
||
shared_users:
|
||
type: array
|
||
readOnly: true
|
||
items:
|
||
$ref: '#/components/schemas/UserSummary'
|
||
description: 仅资源所有者和管理端读取个人资源时返回共享用户列表,未共享时为 [],排除已删除用户;接收方和系统资源不返回。目录中的用户信息变化会更新 ETag。
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
name_i18n:
|
||
type: object
|
||
additionalProperties: {type: string}
|
||
description_i18n:
|
||
type: object
|
||
additionalProperties: {type: string}
|
||
revision:
|
||
type: integer
|
||
minimum: 1
|
||
ownership_type:
|
||
type: string
|
||
enum:
|
||
- system
|
||
- user
|
||
user:
|
||
$ref: '#/components/schemas/UserSummary'
|
||
readOnly: true
|
||
description: 资源所有者的基本信息;系统资源返回创建者,分享不改变归属。
|
||
icon_path:
|
||
type: string
|
||
enabled:
|
||
type: boolean
|
||
grants:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ResourceGrant'
|
||
created_at:
|
||
type: string
|
||
format: date-time
|
||
updated_at:
|
||
type: string
|
||
format: date-time
|
||
description:
|
||
type: string
|
||
url:
|
||
type: string
|
||
format: uri
|
||
proxy_id:
|
||
type: string
|
||
description: 系统代理资源 ID;空字符串表示直连。
|
||
authorization_mode:
|
||
type: string
|
||
enum:
|
||
- none
|
||
- centralized
|
||
- independent
|
||
authorization_method:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
oauth_config:
|
||
$ref: '#/components/schemas/OAuthConnectionConfig'
|
||
callback_url:
|
||
type: string
|
||
readOnly: true
|
||
description: OAuth MCP 的专属完整回调地址,格式为 {MONKEYAI_PUBLIC_URL}/oauth/connectors/{id}/callback;非 OAuth 连接为空字符串。
|
||
config_revision:
|
||
type: integer
|
||
credential_configured:
|
||
type: boolean
|
||
connection_status:
|
||
type: string
|
||
tool_count:
|
||
type: integer
|
||
credentials:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ConnectorCredential'
|
||
required:
|
||
- id
|
||
- name
|
||
- revision
|
||
- grants
|
||
- callback_url
|
||
ConnectorInput:
|
||
type: object
|
||
properties:
|
||
tag_ids:
|
||
type: array
|
||
items: {type: string, format: uuid}
|
||
description:
|
||
type: string
|
||
url:
|
||
type: string
|
||
format: uri
|
||
name:
|
||
type: string
|
||
minLength: 1
|
||
maxLength: 200
|
||
grants:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/ResourceGrant'
|
||
authorization_mode:
|
||
type: string
|
||
enum:
|
||
- none
|
||
- centralized
|
||
- independent
|
||
authorization_method:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
enum:
|
||
- oauth
|
||
- http_header
|
||
- null
|
||
oauth_config:
|
||
$ref: '#/components/schemas/OAuthConnectionConfig'
|
||
oauth_client_secret:
|
||
type: string
|
||
writeOnly: true
|
||
description: 省略保留,空字符串清空;应用或端点变更时省略会清除旧 Secret。
|
||
required:
|
||
- name
|
||
AgentCredential:
|
||
allOf:
|
||
- $ref: '#/components/schemas/ConnectorCredential'
|
||
- type: object
|
||
properties:
|
||
tools:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/MCPTool'
|
||
tools_version:
|
||
type: string
|
||
mcp_gateway:
|
||
$ref: '#/components/schemas/MCPGateway'
|
||
AuthorizationName:
|
||
type: object
|
||
properties:
|
||
name:
|
||
type: string
|
||
minLength: 1
|
||
maxLength: 128
|
||
required:
|
||
- name
|
||
ConnectorCredential:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
connector_id:
|
||
type: string
|
||
format: uuid
|
||
user:
|
||
oneOf:
|
||
- $ref: '#/components/schemas/UserSummary'
|
||
- type: 'null'
|
||
readOnly: true
|
||
description: 凭证所属的平台用户基本信息;集中凭证为 null,不读取上游 OAuth 用户资料。
|
||
name:
|
||
type: string
|
||
revision:
|
||
type: integer
|
||
config_revision:
|
||
type: integer
|
||
authorization_status:
|
||
type: string
|
||
enum:
|
||
- authorized
|
||
- authorization_required
|
||
- revoked
|
||
connection_status:
|
||
type: string
|
||
enum:
|
||
- unknown
|
||
- connected
|
||
- error
|
||
header_names:
|
||
type: array
|
||
items:
|
||
type: string
|
||
last_checked_at:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
format: date-time
|
||
last_error:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
oauth_expires_at:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
format: date-time
|
||
created_at:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
format: date-time
|
||
updated_at:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
format: date-time
|
||
revoked_at:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
format: date-time
|
||
required:
|
||
- id
|
||
- connector_id
|
||
- user
|
||
- name
|
||
- revision
|
||
- authorization_status
|
||
- connection_status
|
||
ConnectorDependency:
|
||
type: object
|
||
properties:
|
||
required:
|
||
type: boolean
|
||
tool_allowlist:
|
||
type: array
|
||
items:
|
||
type: string
|
||
tool_denylist:
|
||
type: array
|
||
items:
|
||
type: string
|
||
connector_id:
|
||
type: string
|
||
format: uuid
|
||
required:
|
||
- connector_id
|
||
CredentialPatch:
|
||
type: object
|
||
properties:
|
||
name:
|
||
type: string
|
||
minLength: 1
|
||
maxLength: 128
|
||
http_headers:
|
||
type: object
|
||
minProperties: 1
|
||
maxProperties: 30
|
||
additionalProperties:
|
||
type: string
|
||
writeOnly: true
|
||
description: 完整 Header 键值;禁止大小写重复、CR/LF、Host、传输控制、Mcp-*、Content-Type 和 Accept。整组替换,响应不回填。
|
||
minProperties: 1
|
||
MCPGateway:
|
||
type: object
|
||
properties:
|
||
url:
|
||
type: string
|
||
format: uri
|
||
description: 以 /mcp 为前缀:免认证为 /mcp/connectors/{id},集中或独立认证为 /mcp/connectors/{id}/credentials/{credential_id}。全局 API Key
|
||
认证用户,服务端校验地址对应连接使用权、凭证归属和有效性。
|
||
transport:
|
||
const: streamable_http
|
||
authentication:
|
||
const: api_key
|
||
required_scope:
|
||
const: mcp:invoke
|
||
required:
|
||
- url
|
||
- transport
|
||
- authentication
|
||
- required_scope
|