mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-11-24 21:29:00 +08:00
6420 lines
192 KiB
YAML
6420 lines
192 KiB
YAML
openapi: 3.1.0
|
||
info:
|
||
title: MonkeyAI Admin API
|
||
version: 1.0.0
|
||
servers:
|
||
- url: /
|
||
security:
|
||
- AdminSession: []
|
||
paths:
|
||
/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/email/code:
|
||
post:
|
||
summary: 发送邮箱验证码
|
||
description: login 受 email_code_enabled 控制;register 需要开放注册并至少启用一种邮箱登录方式;reset 受
|
||
password_enabled 控制。每邮箱每分钟最多 1 次、每小时最多 10 次,每连接来源 IP 每小时最多 30
|
||
次;失败发送也计入限额。开启 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
|
||
- register
|
||
- 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 次错误尝试。
|
||
此入口不自动创建账号,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/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:
|
||
get:
|
||
summary: 模型统计与真实环比
|
||
description: 仅管理员可访问。单次请求在同一 PostgreSQL 只读快照中聚合,不返回模拟数据。
|
||
parameters:
|
||
- name: range
|
||
in: query
|
||
required: false
|
||
description: 以服务端当前时间为终点的滚动窗口。
|
||
schema:
|
||
type: string
|
||
enum:
|
||
- 24h
|
||
- 7d
|
||
- 30d
|
||
- 90d
|
||
default: 30d
|
||
- name: model_id
|
||
in: query
|
||
required: false
|
||
description: 模型 UUID,省略时汇总全部模型;支持已有历史事实的软删除模型。
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
responses:
|
||
"200":
|
||
description: 统计结果。
|
||
headers:
|
||
Cache-Control:
|
||
schema:
|
||
type: string
|
||
const: private, no-store
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/StatisticsModels"
|
||
"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:
|
||
get:
|
||
summary: 会话统计与真实环比
|
||
description: 仅管理员可访问。单次请求在同一 PostgreSQL 只读快照中聚合,不返回模拟数据。
|
||
parameters:
|
||
- name: range
|
||
in: query
|
||
required: false
|
||
description: 以服务端当前时间为终点的滚动窗口。
|
||
schema:
|
||
type: string
|
||
enum:
|
||
- 24h
|
||
- 7d
|
||
- 30d
|
||
- 90d
|
||
default: 30d
|
||
responses:
|
||
"200":
|
||
description: 统计结果。
|
||
headers:
|
||
Cache-Control:
|
||
schema:
|
||
type: string
|
||
const: private, no-store
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/StatisticsTasks"
|
||
"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: 以服务端当前时间为终点的滚动窗口。
|
||
schema:
|
||
type: string
|
||
enum:
|
||
- 5m
|
||
- 15m
|
||
- 30m
|
||
- 60m
|
||
default: 15m
|
||
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/history:
|
||
get:
|
||
summary: 分页查询会话历史
|
||
description: 仅管理员可访问。单次请求在同一 PostgreSQL 只读快照中聚合,不返回模拟数据。
|
||
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 或虚拟团队标识 team。
|
||
parent_id:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
description: 父分组 UUID、team 或 null(仅虚拟团队节点)。
|
||
name:
|
||
type: string
|
||
credits:
|
||
anyOf:
|
||
- $ref: '#/components/schemas/CreditAmount'
|
||
- type: 'null'
|
||
users:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
email:
|
||
type: string
|
||
status:
|
||
type: string
|
||
group_ids:
|
||
type: array
|
||
description: 成员直接所属的有效分组 UUID,与成员管理一致;无分组时为空数组。
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
credits:
|
||
anyOf:
|
||
- $ref: '#/components/schemas/CreditAmount'
|
||
- type: 'null'
|
||
effective_credits:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
inherited_from:
|
||
type: string
|
||
description: 自定义额度为用户 UUID,否则为最高额度来源分组 UUID 或 team。额度相同时按直接所属分组的创建时间、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 或虚拟团队标识 team。
|
||
parent_id:
|
||
type:
|
||
- string
|
||
- 'null'
|
||
description: 父分组 UUID、team 或 null(仅虚拟团队节点)。
|
||
name:
|
||
type: string
|
||
credits:
|
||
anyOf:
|
||
- $ref: '#/components/schemas/CreditAmount'
|
||
- type: 'null'
|
||
users:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
email:
|
||
type: string
|
||
status:
|
||
type: string
|
||
group_ids:
|
||
type: array
|
||
description: 成员直接所属的有效分组 UUID,与成员管理一致;无分组时为空数组。
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
credits:
|
||
anyOf:
|
||
- $ref: '#/components/schemas/CreditAmount'
|
||
- type: 'null'
|
||
effective_credits:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
inherited_from:
|
||
type: string
|
||
description: 自定义额度为用户 UUID,否则为最高额度来源分组 UUID 或 team。额度相同时按直接所属分组的创建时间、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:
|
||
- user
|
||
- group
|
||
id:
|
||
type: string
|
||
description: 用户或分组 UUID;团队默认额度使用 team。
|
||
credits:
|
||
anyOf:
|
||
- $ref: '#/components/schemas/CreditAmount'
|
||
- type: 'null'
|
||
required:
|
||
- subject_type
|
||
- id
|
||
- credits
|
||
required:
|
||
- revision
|
||
- changes
|
||
/api/admin/v1/billing/accounts/{userID}:
|
||
parameters:
|
||
- in: path
|
||
name: userID
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
required: true
|
||
get:
|
||
summary: 查询当期账户与最近 24 个周期
|
||
responses:
|
||
'200':
|
||
description: 请求成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
account:
|
||
$ref: '#/components/schemas/CreditAccount'
|
||
history:
|
||
type: array
|
||
items:
|
||
$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
|
||
'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'
|
||
history:
|
||
type: array
|
||
items:
|
||
$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/entries:
|
||
get:
|
||
summary: 分页查询不可变积分流水
|
||
responses:
|
||
'200':
|
||
description: 请求成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/CreditEntry'
|
||
total:
|
||
type: integer
|
||
page:
|
||
type: integer
|
||
page_size:
|
||
type: integer
|
||
'400':
|
||
description: 参数不合法
|
||
'401':
|
||
description: 未登录
|
||
'403':
|
||
description: 权限不足
|
||
'409':
|
||
description: 修订号、幂等键或交易状态冲突
|
||
parameters:
|
||
- in: query
|
||
name: user
|
||
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: 100
|
||
/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
|
||
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'
|
||
reserved:
|
||
$ref: '#/components/schemas/CreditAmount'
|
||
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: 100
|
||
/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/{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: 返回全部未删除分组及直接成员。团队根节点不入库,名称由 branding.workspace_name 设置提供;parent_id 为 null 的分组均为团队根节点的直属子分组,不预置任何分组。
|
||
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 为 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/{groupID}:
|
||
parameters:
|
||
- in: path
|
||
name: groupID
|
||
required: true
|
||
description: 分组 UUID。
|
||
schema:
|
||
type: string
|
||
format: uuid
|
||
patch:
|
||
summary: 修改分组名称或上级分组
|
||
description: 至少指定 name 或 parent_id。parent_id 为 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: 查询模型
|
||
parameters:
|
||
- 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/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/rules:
|
||
get:
|
||
summary: 查询Rule
|
||
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: 200
|
||
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
|
||
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: 200
|
||
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: 最多 20 MiB ZIP,解包最多 50 MiB、500 个文件。
|
||
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
|
||
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: 200
|
||
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
|
||
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: 200
|
||
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: 最多 20 MiB ZIP,解包最多 50 MiB、500 个文件。
|
||
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
|
||
'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'
|
||
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:
|
||
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
|
||
- registration_enabled
|
||
properties:
|
||
password_enabled:
|
||
type: boolean
|
||
description: 密码登录开关,未配置时默认 true,同时约束管理员和普通用户。
|
||
email_code_enabled:
|
||
type: boolean
|
||
description: 验证码登录开关,默认 false。
|
||
registration_enabled:
|
||
type: boolean
|
||
description: 新账号注册开关,默认 false;开启后允许邮箱验证码登录时自动创建普通账号,也允许邮箱注册和 OAuth / OIDC 自动注册。
|
||
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, 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: "操作者邮箱快照。"
|
||
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: "服务端生成的请求关联标识,同一批量操作可关联多个目标;历史或独立业务事件为空。"
|
||
StatisticsModelSummary:
|
||
type: object
|
||
required:
|
||
- calls
|
||
- input_tokens
|
||
- output_tokens
|
||
- cache_hit_rate
|
||
- success_rate
|
||
- credits
|
||
properties:
|
||
calls:
|
||
type: integer
|
||
minimum: 0
|
||
description: 按开始时间计数,包含成功、失败和取消调用。
|
||
input_tokens:
|
||
type: integer
|
||
minimum: 0
|
||
description: 输入 Token 总量,包含缓存输入。
|
||
output_tokens:
|
||
type: integer
|
||
minimum: 0
|
||
description: 输出 Token 总量。
|
||
cache_hit_rate:
|
||
type:
|
||
- number
|
||
- "null"
|
||
description: 命中缓存的调用次数 / 调用总数 × 100;没有调用时为 null。
|
||
success_rate:
|
||
type:
|
||
- number
|
||
- "null"
|
||
description: 成功调用 / 已结束调用 × 100;没有已结束调用时为 null。
|
||
credits: &statisticsCredits
|
||
type: string
|
||
pattern: ^-?[0-9]+(\.[0-9]{1,6})?$
|
||
description: 扣费减退款后的积分净消费,十进制字符串;纯退款周期可为负值。
|
||
StatisticsModels:
|
||
type: object
|
||
required:
|
||
- from
|
||
- until
|
||
- summary
|
||
- previous
|
||
- models
|
||
- trend
|
||
properties:
|
||
from: &statisticsFrom
|
||
type: string
|
||
format: date-time
|
||
description: 查询窗口起点,包含。
|
||
until: &statisticsUntil
|
||
type: string
|
||
format: date-time
|
||
description: 查询窗口终点,不包含;由服务端统一确定。
|
||
summary:
|
||
$ref: "#/components/schemas/StatisticsModelSummary"
|
||
previous:
|
||
$ref: "#/components/schemas/StatisticsModelSummary"
|
||
description: 紧邻当前窗口之前的等长周期。
|
||
models:
|
||
type: array
|
||
items:
|
||
type: object
|
||
required:
|
||
- id
|
||
- name
|
||
- deleted
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
name:
|
||
type: string
|
||
description: 模型显示名。
|
||
deleted:
|
||
type: boolean
|
||
description: 模型是否已软删除;历史调用和消费仍保留。
|
||
trend:
|
||
type: array
|
||
items:
|
||
type: object
|
||
required:
|
||
- at
|
||
- calls
|
||
- input_tokens
|
||
- output_tokens
|
||
- credits
|
||
properties:
|
||
at:
|
||
type: string
|
||
format: date-time
|
||
description: 分桶起点,从窗口起点每 1 小时(24h)或 24 小时递增,不按自然日对齐;空桶补零。
|
||
calls:
|
||
type: integer
|
||
minimum: 0
|
||
description: 本桶调用数。
|
||
input_tokens:
|
||
type: integer
|
||
minimum: 0
|
||
description: 本桶输入 Token。
|
||
output_tokens:
|
||
type: integer
|
||
minimum: 0
|
||
description: 本桶输出 Token。
|
||
credits: *statisticsCredits
|
||
StatisticsTaskSummary:
|
||
type: object
|
||
required:
|
||
- total
|
||
- completed
|
||
- failed
|
||
- running
|
||
- completion_rate
|
||
- average_duration_seconds
|
||
properties:
|
||
total:
|
||
type: integer
|
||
minimum: 0
|
||
description: 窗口内新建且未软删除的会话总数。
|
||
completed:
|
||
type: integer
|
||
minimum: 0
|
||
description: 已结束且失败代码、失败描述均为空的会话数。
|
||
failed:
|
||
type: integer
|
||
minimum: 0
|
||
description: 已结束且失败代码或失败描述非空的会话数,包含异常取消。
|
||
running:
|
||
type: integer
|
||
minimum: 0
|
||
description: 尚未结束的会话数,可能处于空闲状态。
|
||
completion_rate:
|
||
type:
|
||
- number
|
||
- "null"
|
||
description: 成功结束数 / 会话总数 × 100;无会话时为 null。
|
||
average_duration_seconds:
|
||
type:
|
||
- number
|
||
- "null"
|
||
description: 已结束会话的平均耗时,单位秒;没有已结束会话时为 null。
|
||
StatisticsTasks:
|
||
type: object
|
||
required:
|
||
- from
|
||
- until
|
||
- summary
|
||
- previous
|
||
- trend
|
||
- types
|
||
properties:
|
||
from: *statisticsFrom
|
||
until: *statisticsUntil
|
||
summary:
|
||
$ref: "#/components/schemas/StatisticsTaskSummary"
|
||
previous:
|
||
$ref: "#/components/schemas/StatisticsTaskSummary"
|
||
description: 紧邻当前窗口之前的等长周期,按会话当前结果汇总。
|
||
trend:
|
||
type: array
|
||
items:
|
||
type: object
|
||
required:
|
||
- at
|
||
- completed
|
||
- failed
|
||
- running
|
||
properties:
|
||
at:
|
||
type: string
|
||
format: date-time
|
||
description: 分桶起点,从窗口起点每 1 小时(24h)或 24 小时递增;按会话开始时间归桶,空桶补零。
|
||
completed:
|
||
type: integer
|
||
minimum: 0
|
||
description: 本桶成功结束数。
|
||
failed:
|
||
type: integer
|
||
minimum: 0
|
||
description: 本桶失败数。
|
||
running:
|
||
type: integer
|
||
minimum: 0
|
||
description: 本桶未结束数。
|
||
types:
|
||
type: array
|
||
items:
|
||
allOf:
|
||
- $ref: "#/components/schemas/StatisticsTaskSummary"
|
||
- type: object
|
||
required:
|
||
- key
|
||
properties:
|
||
key:
|
||
type: string
|
||
enum:
|
||
- conversation
|
||
- workflow
|
||
- tool
|
||
- scheduled
|
||
StatisticsRealtime:
|
||
type: object
|
||
required:
|
||
- from
|
||
- until
|
||
- model_consumption
|
||
- p95_response_time
|
||
- model_success_rate
|
||
- model_calls
|
||
- tpm
|
||
- rpm
|
||
- input_tokens
|
||
- output_tokens
|
||
- 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。
|
||
active_users:
|
||
type: integer
|
||
minimum: 0
|
||
description: 窗口内完成模型或 MCP 调用、有会话活动或发起仍在执行的计费调用的去重用户数;并非登录 DAU。
|
||
active_tasks:
|
||
type: integer
|
||
minimum: 0
|
||
description: 最近活动时间在窗口内且未结束、未删除的会话数。
|
||
new_tasks:
|
||
type: integer
|
||
minimum: 0
|
||
description: 窗口内创建且未删除的会话数。
|
||
StatisticsHistory:
|
||
type: object
|
||
required:
|
||
- items
|
||
- total
|
||
- page
|
||
- page_size
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
type: object
|
||
required:
|
||
- id
|
||
- title
|
||
- user_name
|
||
- user_email
|
||
- started_at
|
||
- last_active_at
|
||
- turn_count
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
title:
|
||
type: string
|
||
description: 会话标题。
|
||
user_name:
|
||
type: string
|
||
description: 所属用户当前姓名。
|
||
user_email:
|
||
type: string
|
||
description: 所属用户当前邮箱。
|
||
started_at:
|
||
type: string
|
||
format: date-time
|
||
description: 会话开始时间。
|
||
last_active_at:
|
||
type: string
|
||
format: date-time
|
||
description: 最近活动时间。
|
||
turn_count:
|
||
type: integer
|
||
minimum: 0
|
||
description: 会话累计对话轮数;不表示筛选窗口内新增轮数。
|
||
total:
|
||
type: integer
|
||
minimum: 0
|
||
description: 符合筛选条件的总记录数。
|
||
page:
|
||
type: integer
|
||
minimum: 1
|
||
description: 实际页码;超过最后一页时回退到最后一页。
|
||
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
|
||
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,必须是有效分组;null 表示团队根节点,更新时省略则保留原值。
|
||
MemberGroupsResponse:
|
||
type: object
|
||
required: [groups]
|
||
properties:
|
||
groups:
|
||
type: array
|
||
description: 未删除的分组列表,按创建时间和 ID 排序。
|
||
items:
|
||
$ref: "#/components/schemas/MemberGroup"
|
||
MemberGroup:
|
||
type: object
|
||
required: [id, parent_id, name, member_ids]
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
description: 分组唯一标识。
|
||
parent_id:
|
||
type: [string, "null"]
|
||
format: uuid
|
||
description: 上级分组 ID;null 表示该分组直属团队根节点。
|
||
name:
|
||
type: string
|
||
description: 分组显示名称。
|
||
member_ids:
|
||
type: array
|
||
description: 未删除用户的直接分组关系,不含子分组成员,也不按用户角色自动分配。
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
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'
|
||
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:
|
||
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:
|
||
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:
|
||
models:
|
||
type: array
|
||
description: 按创建时间倒序排列的模型。
|
||
items:
|
||
$ref: "#/components/schemas/Model"
|
||
Model:
|
||
type: object
|
||
required:
|
||
- id
|
||
- ownership_type
|
||
- user
|
||
- model_id
|
||
- display_name
|
||
- protocol
|
||
- base_url
|
||
- api_key_configured
|
||
- advanced_config
|
||
- credit_multiplier
|
||
- 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"
|
||
base_url:
|
||
type: string
|
||
format: uri
|
||
description: 上游模型服务的 HTTP(S) 基础地址。
|
||
api_key_configured:
|
||
type: boolean
|
||
description: 是否已配置上游 API Key;响应不会返回密钥原文。
|
||
advanced_config:
|
||
$ref: "#/components/schemas/AdvancedConfig"
|
||
credit_multiplier:
|
||
type: number
|
||
exclusiveMinimum: 0
|
||
description: 本模型消耗积分时使用的倍率。
|
||
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]
|
||
description: MonkeyAI 与上游服务通信时使用的协议。
|
||
AdvancedConfig:
|
||
type: object
|
||
required: [context_window_tokens, max_output_tokens, supports_vision]
|
||
properties:
|
||
context_window_tokens:
|
||
type: integer
|
||
format: int64
|
||
minimum: 1
|
||
description: 模型上下文窗口的最大 Token 数。
|
||
max_output_tokens:
|
||
type: integer
|
||
format: int64
|
||
minimum: 1
|
||
description: 单次请求允许生成的最大 Token 数。
|
||
supports_vision:
|
||
type: boolean
|
||
description: 模型是否支持图像输入。
|
||
Authorization:
|
||
type: object
|
||
description: 可使用该模型的用户和分组;须选择全员授权,或在两个数组中至少指定一项。全员授权包含后续新增用户,启用时忽略用户和分组数组。
|
||
required: [user_ids, group_ids]
|
||
properties:
|
||
all_users:
|
||
type: boolean
|
||
default: false
|
||
description: 是否授权给全体用户;界面通过选择虚拟根节点表达,不引用分组记录。
|
||
user_ids:
|
||
type: array
|
||
description: 获得模型访问权的用户 UUID。
|
||
uniqueItems: true
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
group_ids:
|
||
type: array
|
||
description: 获得模型访问权的分组 UUID。
|
||
uniqueItems: true
|
||
items:
|
||
type: string
|
||
format: uuid
|
||
ModelInput:
|
||
type: object
|
||
required:
|
||
- model_id
|
||
- display_name
|
||
- protocol
|
||
- base_url
|
||
- advanced_config
|
||
- credit_multiplier
|
||
- authorization
|
||
properties:
|
||
model_id:
|
||
type: string
|
||
minLength: 1
|
||
description: 上游服务使用的模型标识。
|
||
display_name:
|
||
type: string
|
||
minLength: 1
|
||
description: 模型展示名称。
|
||
protocol:
|
||
$ref: "#/components/schemas/ModelProtocol"
|
||
base_url:
|
||
type: string
|
||
format: uri
|
||
pattern: "^https?://"
|
||
description: 上游模型服务的 HTTP(S) 基础地址。
|
||
api_key:
|
||
type: string
|
||
description: 上游 API Key;更新时传空字符串可保留原密钥。
|
||
advanced_config:
|
||
$ref: "#/components/schemas/AdvancedConfig"
|
||
credit_multiplier:
|
||
type: number
|
||
exclusiveMinimum: 0
|
||
description: 积分消耗倍率。
|
||
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: 可授权的分组。
|
||
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;根分组不返回该字段。
|
||
name:
|
||
type: string
|
||
description: 分组名称。
|
||
UserSubject:
|
||
type: object
|
||
required: [id, name, email]
|
||
properties:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
description: 用户 ID。
|
||
name:
|
||
type: string
|
||
description: 用户显示名称。
|
||
email:
|
||
type: string
|
||
format: email
|
||
description: 用户邮箱。
|
||
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: 每条授权必须且只能选择用户、分组或全体用户之一。全员授权仅用于系统资源,包含后续新增用户,user_id 和 group_id 须为空或省略。
|
||
properties:
|
||
all_users:
|
||
type: boolean
|
||
default: false
|
||
description: 是否授权给全体用户;省略时按 false 处理。
|
||
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:
|
||
id:
|
||
type: string
|
||
format: uuid
|
||
icon_path:
|
||
type: string
|
||
name:
|
||
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:
|
||
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:
|
||
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: 系统规则的授权范围;个人规则固定为空数组,仅创建者可用。
|
||
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:
|
||
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:
|
||
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:
|
||
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
|
||
url:
|
||
type: string
|
||
format: uri
|
||
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:
|
||
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
|