2458 lines
81 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

openapi: 3.0.3
info:
title: Muse Account API
description: |
Muse 账户模块 API 契约,覆盖管理端账户管理、用户端个人中心和 New-API 网关集成。
来源:后端-05 统一 API 契约 Section 3.6(管理端账户管理)+ Section 4.1(当前用户入口)+ Section 4.10(个人中心)。
version: 1.0.0
tags:
- name: Account-Admin
description: 管理端账户管理(权益、配额调整、New-API 绑定、调用归属、用量和购买记录)
- name: Account-App
description: 用户端个人中心(权益、用量、New-API 绑定、额度请求、购买/授权/发布记录、安全事件、导出下载)
paths:
# ============================================================
# 管理端 — 账户管理(Section 3.6)
# ============================================================
/admin-api/muse/account/users:
get:
tags: [Account-Admin]
summary: 用户账户摘要
description: 管理员查询用户账户列表和治理摘要,含账号状态、权益来源、配额状态和风险标记。
operationId: adminListAccountUsers
parameters:
- $ref: '../openapi-base.yaml#/components/parameters/pageNo'
- $ref: '../openapi-base.yaml#/components/parameters/pageSize'
- name: keyword
in: query
description: 按昵称或账号 ID 模糊搜索
schema:
type: string
- name: status
in: query
description: 账号状态筛选
schema:
type: string
enum: [active, restricted, suspended]
- name: entitlementSource
in: query
description: 权益来源筛选
schema:
type: string
responses:
'200':
description: 用户账户摘要分页列表
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/PaginatedResult'
- type: object
properties:
list:
type: array
items:
$ref: '#/components/schemas/AdminAccountUserSummary'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'403':
$ref: '../openapi-base.yaml#/components/responses/Forbidden'
/admin-api/muse/account/users/{userId}/entitlements:
get:
tags: [Account-Admin]
summary: 查看用户权益和配额
description: 管理员查看指定用户的权益档位、配额额度、剩余、到期和限流状态。
operationId: adminGetUserEntitlements
parameters:
- $ref: '#/components/parameters/userIdPath'
responses:
'200':
description: 用户权益和配额详情
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/AdminUserEntitlementDetail'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'403':
$ref: '../openapi-base.yaml#/components/responses/Forbidden'
'404':
$ref: '../openapi-base.yaml#/components/responses/NotFound'
/admin-api/muse/account/users/{userId}/quota-adjustments:
post:
tags: [Account-Admin]
summary: 调整用户配额
description: |
管理员人工调整用户配额。每次调整必须记录 commandId、correlationId、调整原因、前后权益快照、操作者和幂等状态。
适用于人工调整、套餐变更、市场补偿、导出扣减回滚或 New-API 配置请求回填。
operationId: adminCreateQuotaAdjustment
parameters:
- $ref: '#/components/parameters/userIdPath'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/QuotaAdjustmentRequest'
responses:
'200':
description: 配额调整成功
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/QuotaAdjustmentResult'
'400':
$ref: '../openapi-base.yaml#/components/responses/BadRequest'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'403':
$ref: '../openapi-base.yaml#/components/responses/Forbidden'
'404':
$ref: '../openapi-base.yaml#/components/responses/NotFound'
'409':
$ref: '../openapi-base.yaml#/components/responses/Conflict'
get:
tags: [Account-Admin]
summary: 配额调整 ledger
description: 查询指定用户的配额调整记录,展示调整来源、幂等键、前后快照和审计状态。
operationId: adminListQuotaAdjustments
parameters:
- $ref: '#/components/parameters/userIdPath'
- $ref: '../openapi-base.yaml#/components/parameters/pageNo'
- $ref: '../openapi-base.yaml#/components/parameters/pageSize'
- name: sourceType
in: query
description: 调整来源类型筛选
schema:
type: string
enum: [manual, plan_change, market_compensation, export_rollback, newapi_callback]
responses:
'200':
description: 配额调整记录分页列表
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/PaginatedResult'
- type: object
properties:
list:
type: array
items:
$ref: '#/components/schemas/QuotaAdjustmentLedgerEntry'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'403':
$ref: '../openapi-base.yaml#/components/responses/Forbidden'
/admin-api/muse/account/new-api-bindings:
get:
tags: [Account-Admin]
summary: 网关用户绑定状态列表
description: 管理员查询所有用户的 New-API 网关用户绑定状态,含绑定时间、同步状态和异常标记。
operationId: adminListNewApiBindings
parameters:
- $ref: '../openapi-base.yaml#/components/parameters/pageNo'
- $ref: '../openapi-base.yaml#/components/parameters/pageSize'
- name: bindingStatus
in: query
description: 绑定状态筛选
schema:
type: string
enum: [bound, unbound, sync_failed, pending]
responses:
'200':
description: 网关用户绑定状态分页列表
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/PaginatedResult'
- type: object
properties:
list:
type: array
items:
$ref: '#/components/schemas/NewApiBindingSummary'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'403':
$ref: '../openapi-base.yaml#/components/responses/Forbidden'
/admin-api/muse/account/users/{userId}/new-api-binding:
post:
tags: [Account-Admin]
summary: 创建或刷新 New-API 网关用户绑定
description: |
管理员为指定用户创建或刷新 New-API 网关用户绑定。必须带 commandId 保证幂等。
绑定成功后用户的 AI 调用将通过该网关用户路由和计费。
operationId: adminCreateNewApiBinding
parameters:
- $ref: '#/components/parameters/userIdPath'
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [commandId]
properties:
commandId:
type: string
description: 幂等键
forceRefresh:
type: boolean
default: false
description: 是否强制刷新已有绑定(绑定异常时使用)
reason:
type: string
description: 创建或刷新原因(写入审计日志)
responses:
'200':
description: 绑定创建或刷新成功
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/NewApiBindingResult'
'400':
$ref: '../openapi-base.yaml#/components/responses/BadRequest'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'403':
$ref: '../openapi-base.yaml#/components/responses/Forbidden'
'409':
$ref: '../openapi-base.yaml#/components/responses/Conflict'
/admin-api/muse/account/users/{userId}/quota-requests:
post:
tags: [Account-Admin]
summary: 向 New-API 发起额度配置请求
description: |
管理员为指定用户向 New-API 发起额度配置请求。返回 requestId 和 correlationId。
后续可通过 correlationId 查询外部调用状态和归属。
operationId: adminCreateQuotaRequest
parameters:
- $ref: '#/components/parameters/userIdPath'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AdminQuotaRequestCreate'
responses:
'200':
description: 额度配置请求已创建
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/QuotaRequestResult'
'400':
$ref: '../openapi-base.yaml#/components/responses/BadRequest'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'403':
$ref: '../openapi-base.yaml#/components/responses/Forbidden'
'404':
$ref: '../openapi-base.yaml#/components/responses/NotFound'
/admin-api/muse/account/users/{userId}/balance-snapshots:
get:
tags: [Account-Admin]
summary: New-API 余额和权益快照摘要
description: 管理员查看指定用户的 New-API 余额和权益快照。不含底层供应商路由或成本策略。
operationId: adminGetBalanceSnapshots
parameters:
- $ref: '#/components/parameters/userIdPath'
- $ref: '../openapi-base.yaml#/components/parameters/pageNo'
- $ref: '../openapi-base.yaml#/components/parameters/pageSize'
responses:
'200':
description: 余额和权益快照摘要
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/PaginatedResult'
- type: object
properties:
list:
type: array
items:
$ref: '#/components/schemas/BalanceSnapshotEntry'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'403':
$ref: '../openapi-base.yaml#/components/responses/Forbidden'
/admin-api/muse/account/call-attribution-jobs:
post:
tags: [Account-Admin]
summary: 创建调用归属 job
description: |
管理员创建调用归属 job,绑定用户、任务、作品、智能体、知识来源或市场授权。
用于将待归属的 AI 调用记录归因到具体业务对象。必须带 commandId 保证幂等。
operationId: adminCreateCallAttributionJob
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CallAttributionJobCreate'
responses:
'200':
description: 调用归属 job 已创建
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/CallAttributionJobResult'
'400':
$ref: '../openapi-base.yaml#/components/responses/BadRequest'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'403':
$ref: '../openapi-base.yaml#/components/responses/Forbidden'
/admin-api/muse/account/call-attribution-jobs/{jobId}:
get:
tags: [Account-Admin]
summary: 查询调用归属状态
description: 查询调用归属 job 的执行状态、失败原因和补偿建议。
operationId: adminGetCallAttributionJob
parameters:
- name: jobId
in: path
required: true
description: 调用归属 job ID
schema:
type: string
responses:
'200':
description: 调用归属 job 详情
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/CallAttributionJobDetail'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'403':
$ref: '../openapi-base.yaml#/components/responses/Forbidden'
'404':
$ref: '../openapi-base.yaml#/components/responses/NotFound'
/admin-api/muse/account/integration-calls/by-correlation/{correlationId}:
get:
tags: [Account-Admin]
summary: 按 correlationId 查询外部调用
description: 管理员按 correlationId 查询外部调用去重、重试组和归属状态。
operationId: adminGetIntegrationCallByCorrelation
parameters:
- name: correlationId
in: path
required: true
description: 外部调用关联 ID
schema:
type: string
responses:
'200':
description: 外部调用详情
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/IntegrationCallDetail'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'403':
$ref: '../openapi-base.yaml#/components/responses/Forbidden'
'404':
$ref: '../openapi-base.yaml#/components/responses/NotFound'
/admin-api/muse/account/usage-records:
get:
tags: [Account-Admin]
summary: 用量摘要
description: 管理员查询全平台用量摘要,含 Token 消耗、归属分布、待归属和异常。
operationId: adminListUsageRecords
parameters:
- $ref: '../openapi-base.yaml#/components/parameters/pageNo'
- $ref: '../openapi-base.yaml#/components/parameters/pageSize'
- name: userId
in: query
description: 按用户筛选
schema:
type: string
- name: period
in: query
description: 时间范围
schema:
type: string
enum: [today, week, month, billing_cycle]
default: month
- name: attributionStatus
in: query
description: 归属状态筛选
schema:
type: string
enum: [attributed, pending, failed]
responses:
'200':
description: 用量摘要分页列表
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/PaginatedResult'
- type: object
properties:
list:
type: array
items:
$ref: '#/components/schemas/AdminUsageRecord'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'403':
$ref: '../openapi-base.yaml#/components/responses/Forbidden'
/admin-api/muse/account/purchase-records:
get:
tags: [Account-Admin]
summary: 购买记录摘要
description: 管理员查询全平台购买记录摘要,含购买、免费获取、管理员授权和外部订单。
operationId: adminListPurchaseRecords
parameters:
- $ref: '../openapi-base.yaml#/components/parameters/pageNo'
- $ref: '../openapi-base.yaml#/components/parameters/pageSize'
- name: userId
in: query
description: 按用户筛选
schema:
type: string
- name: status
in: query
description: 购买状态筛选
schema:
type: string
enum: [completed, processing, failed, refunded]
responses:
'200':
description: 购买记录分页列表
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/PaginatedResult'
- type: object
properties:
list:
type: array
items:
$ref: '#/components/schemas/AdminPurchaseRecord'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'403':
$ref: '../openapi-base.yaml#/components/responses/Forbidden'
# ============================================================
# 用户端 — 当前用户入口(Section 4.1)
# ============================================================
/app-api/muse/me:
get:
tags: [Account-App]
summary: 当前用户、权益摘要、默认入口、可见产品空间
description: |
获取当前登录用户的账户摘要,含资料、权益摘要、默认入口和可见产品空间。
不返回系统权限表、后台菜单、New-API token、Prompt secret 或私有审计字段。
operationId: getCurrentUser
responses:
'200':
description: 当前用户摘要
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/CurrentUserSummary'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
# ============================================================
# 用户端 — 个人中心(Section 4.10)
# ============================================================
/app-api/muse/profile:
get:
tags: [Account-App]
summary: 个人资料
description: 获取当前用户个人资料,含头像、昵称、联系方式脱敏值、验证状态和账号状态。
operationId: getProfile
responses:
'200':
description: 个人资料
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/AccountProfile'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
patch:
tags: [Account-App]
summary: 修改资料
description: |
修改当前用户个人资料。必须带 commandId 保证幂等,带 expectedVersion 做乐观锁。
联系方式变更需走单独验证流程,不在此接口直接修改。
operationId: updateProfile
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ProfileUpdateRequest'
responses:
'200':
description: 资料更新成功
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/AccountProfile'
'400':
$ref: '../openapi-base.yaml#/components/responses/BadRequest'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'409':
$ref: '../openapi-base.yaml#/components/responses/Conflict'
/app-api/muse/account/entitlements:
get:
tags: [Account-App]
summary: 权益和配额
description: |
获取当前用户权益和配额,含套餐、额度、剩余、到期和限流状态。
只展示当前账户可用权益,不暴露底层供应商路由或成本策略。
operationId: getAppEntitlements
responses:
'200':
description: 权益和配额
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/AppEntitlementDetail'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
/app-api/muse/account/usage:
get:
tags: [Account-App]
summary: 用量摘要
description: |
获取当前用户账户级用量摘要,含 Token 消耗、归属分布、待归属和异常。
不展示底层模型路由、供应商成本日志或管理员调账。
operationId: getAppUsage
parameters:
- name: period
in: query
description: 时间范围
schema:
type: string
enum: [today, week, month, billing_cycle]
default: month
- $ref: '../openapi-base.yaml#/components/parameters/pageNo'
- $ref: '../openapi-base.yaml#/components/parameters/pageSize'
responses:
'200':
description: 用量摘要
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/AppUsageSummary'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
/app-api/muse/account/new-api-binding:
get:
tags: [Account-App]
summary: 当前用户 New-API 网关用户绑定摘要
description: |
获取当前用户的 New-API 网关用户绑定状态。
不暴露 New-API token、provider authority 或供应商路由。
operationId: getAppNewApiBinding
responses:
'200':
description: 网关用户绑定摘要
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/AppNewApiBindingSummary'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
/app-api/muse/account/new-api-binding/recheck:
post:
tags: [Account-App]
summary: 发起网关用户绑定重验
description: |
用户发起 New-API 网关用户绑定重验。必须带 commandId 保证幂等。
重验是异步任务,返回 jobId 供后续轮询。
operationId: appRecheckNewApiBinding
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [commandId]
properties:
commandId:
type: string
description: 幂等键
responses:
'200':
description: 重验任务已创建
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
type: object
properties:
jobId:
type: string
description: 异步任务 ID,用于轮询状态
status:
type: string
enum: [queued, processing]
description: 任务初始状态
'400':
$ref: '../openapi-base.yaml#/components/responses/BadRequest'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'409':
$ref: '../openapi-base.yaml#/components/responses/Conflict'
/app-api/muse/account/balance-snapshots:
get:
tags: [Account-App]
summary: 余额和权益快照摘要
description: |
获取当前用户的 New-API 余额和权益快照。
不暴露底层供应商路由、成本策略或完整 Prompt/Response。
operationId: getAppBalanceSnapshots
parameters:
- $ref: '../openapi-base.yaml#/components/parameters/pageNo'
- $ref: '../openapi-base.yaml#/components/parameters/pageSize'
responses:
'200':
description: 余额和权益快照摘要
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/PaginatedResult'
- type: object
properties:
list:
type: array
items:
$ref: '#/components/schemas/BalanceSnapshotEntry'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
/app-api/muse/account/quota-requests:
post:
tags: [Account-App]
summary: 发起本人套餐或余额同步请求
description: |
用户发起本人套餐或余额同步请求。返回 requestId 和 correlationId。
后续可通过 requestId 查询额度请求状态,通过 correlationId 查询外部调用。
operationId: appCreateQuotaRequest
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [commandId]
properties:
commandId:
type: string
description: 幂等键
requestType:
type: string
enum: [plan_sync, balance_sync]
description: 请求类型:套餐同步或余额同步
responses:
'200':
description: 额度请求已创建
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/QuotaRequestResult'
'400':
$ref: '../openapi-base.yaml#/components/responses/BadRequest'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'409':
$ref: '../openapi-base.yaml#/components/responses/Conflict'
/app-api/muse/account/quota-requests/{requestId}:
get:
tags: [Account-App]
summary: 查询额度请求状态
description: 查询当前用户额度请求的状态、correlationId 和失败原因。
operationId: appGetQuotaRequest
parameters:
- name: requestId
in: path
required: true
description: 额度请求 ID
schema:
type: string
responses:
'200':
description: 额度请求详情
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/QuotaRequestStatus'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'404':
$ref: '../openapi-base.yaml#/components/responses/NotFound'
/app-api/muse/account/integration-calls/by-correlation/{correlationId}:
get:
tags: [Account-App]
summary: 查询本人外部调用
description: |
按 correlationId 查询当前用户的外部调用去重、重试和归属状态。
只能查本人可见调用,不暴露 New-API token 或私有审计字段。
operationId: appGetIntegrationCallByCorrelation
parameters:
- name: correlationId
in: path
required: true
description: 外部调用关联 ID
schema:
type: string
responses:
'200':
description: 外部调用详情
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/IntegrationCallDetail'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'403':
$ref: '../openapi-base.yaml#/components/responses/Forbidden'
'404':
$ref: '../openapi-base.yaml#/components/responses/NotFound'
/app-api/muse/account/purchases:
get:
tags: [Account-App]
summary: 购买记录
description: |
获取当前用户购买记录,含购买、免费获取、管理员授权和外部订单引用。
不做 checkout、退款、发票和收益结算。金额和外部引用按权限脱敏。
operationId: appListPurchases
parameters:
- $ref: '../openapi-base.yaml#/components/parameters/pageNo'
- $ref: '../openapi-base.yaml#/components/parameters/pageSize'
- name: status
in: query
description: 购买状态筛选
schema:
type: string
enum: [completed, processing, failed, external_pending, refunded]
responses:
'200':
description: 购买记录分页列表
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/PaginatedResult'
- type: object
properties:
list:
type: array
items:
$ref: '#/components/schemas/AppPurchaseRecord'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
/app-api/muse/account/licenses:
get:
tags: [Account-App]
summary: 授权记录
description: |
获取当前用户授权获取记录,含资产类型、来源、许可、版本、授权状态和安装/绑定摘要。
不做市场发现、购买、安装、绑定或许可变更。
operationId: appListLicenses
parameters:
- $ref: '../openapi-base.yaml#/components/parameters/pageNo'
- $ref: '../openapi-base.yaml#/components/parameters/pageSize'
- name: assetType
in: query
description: 资产类型筛选
schema:
type: string
enum: [work, agent, knowledge_base]
- name: licenseStatus
in: query
description: 授权状态筛选
schema:
type: string
enum: [active, uninstalled, installed, bound, expired, delisted, recalled, needs_recheck]
responses:
'200':
description: 授权记录分页列表
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/PaginatedResult'
- type: object
properties:
list:
type: array
items:
$ref: '#/components/schemas/AppLicenseRecord'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
/app-api/muse/account/publish-records:
get:
tags: [Account-App]
summary: 发布记录
description: |
获取当前用户发布记录总览,含资产类型、版本、审核状态、市场状态和阻断原因。
不审核、上架、下架、申诉或编辑资产正文。
operationId: appListPublishRecords
parameters:
- $ref: '../openapi-base.yaml#/components/parameters/pageNo'
- $ref: '../openapi-base.yaml#/components/parameters/pageSize'
- name: assetType
in: query
description: 资产类型筛选
schema:
type: string
enum: [work, agent, knowledge_base]
- name: reviewStatus
in: query
description: 审核状态筛选
schema:
type: string
enum: [draft, submitted, under_review, needs_supplement, approved, listed, delisted, appealed]
responses:
'200':
description: 发布记录分页列表
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/PaginatedResult'
- type: object
properties:
list:
type: array
items:
$ref: '#/components/schemas/AppPublishRecord'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
/app-api/muse/account/security-events:
get:
tags: [Account-App]
summary: 安全事件摘要
description: |
获取当前用户安全事件摘要列表,含事件类型、严重度和时间。
只返回当前账户可处理项,敏感值脱敏。
operationId: appListSecurityEvents
parameters:
- $ref: '../openapi-base.yaml#/components/parameters/pageNo'
- $ref: '../openapi-base.yaml#/components/parameters/pageSize'
- name: severity
in: query
description: 严重程度筛选
schema:
type: string
enum: [info, warning, critical]
responses:
'200':
description: 安全事件摘要分页列表
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/PaginatedResult'
- type: object
properties:
list:
type: array
items:
$ref: '#/components/schemas/SecurityEventSummary'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
/app-api/muse/account/security-events/{eventId}:
get:
tags: [Account-App]
summary: 安全事件详情
description: |
获取安全事件详情,含事件类型、发生时间、来源 IP、设备信息、影响范围和处理建议。
安全事件只能由事件所属用户查看。
operationId: appGetSecurityEvent
parameters:
- name: eventId
in: path
required: true
description: 安全事件 ID
schema:
type: string
responses:
'200':
description: 安全事件详情
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/SecurityEventDetail'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'403':
$ref: '../openapi-base.yaml#/components/responses/Forbidden'
'404':
$ref: '../openapi-base.yaml#/components/responses/NotFound'
/app-api/muse/account/security-events/{eventId}/acknowledge:
post:
tags: [Account-App]
summary: 确认安全事件
description: |
用户确认/处理安全事件,标记用户已知晓或已采取措施。
确认操作是 append-only,不删除安全事件记录。
action=session_revoked 时,后端应联动 session 管理服务使相关会话失效。
必须带 commandId 保证幂等,写审计。
operationId: appAcknowledgeSecurityEvent
parameters:
- name: eventId
in: path
required: true
description: 安全事件 ID
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SecurityEventAcknowledgeRequest'
responses:
'200':
description: 安全事件确认成功
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/SecurityEventAcknowledgeResult'
'400':
$ref: '../openapi-base.yaml#/components/responses/BadRequest'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'403':
$ref: '../openapi-base.yaml#/components/responses/Forbidden'
'404':
$ref: '../openapi-base.yaml#/components/responses/NotFound'
'409':
$ref: '../openapi-base.yaml#/components/responses/Conflict'
/app-api/muse/account/export-tasks:
post:
tags: [Account-App]
summary: 创建个人中心导出任务
description: |
创建个人资料、账户记录或安全事件导出任务。
必须带 commandId 保证幂等。大范围或高敏导出需要 step-up。
不改变任何业务事实,只生成导出包。
operationId: appCreateExportTask
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AccountExportTaskCreate'
responses:
'200':
description: 导出任务已创建
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/AccountExportTaskResult'
'400':
$ref: '../openapi-base.yaml#/components/responses/BadRequest'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'409':
$ref: '../openapi-base.yaml#/components/responses/Conflict'
/app-api/muse/account/export-tasks/{taskId}:
get:
tags: [Account-App]
summary: 查询个人中心导出任务
description: 查询个人中心导出任务的执行状态和下载凭证。
operationId: appGetExportTask
parameters:
- name: taskId
in: path
required: true
description: 导出任务 ID
schema:
type: string
responses:
'200':
description: 导出任务详情
content:
application/json:
schema:
allOf:
- $ref: '../openapi-base.yaml#/components/schemas/CommonResult'
- type: object
properties:
data:
$ref: '#/components/schemas/AccountExportTaskDetail'
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'404':
$ref: '../openapi-base.yaml#/components/responses/NotFound'
/app-api/muse/account/downloads/{credentialId}:
get:
tags: [Account-App]
summary: 下载个人中心导出包
description: |
使用下载凭证下载个人中心导出包。
来源 revoked/recalled/blocked/unauthorized 或授权过期时返回 SOURCE_BLOCKED。
operationId: appDownloadExport
parameters:
- name: credentialId
in: path
required: true
description: 下载凭证 ID
schema:
type: string
responses:
'200':
description: 导出包文件流
content:
application/octet-stream:
schema:
type: string
format: binary
'401':
$ref: '../openapi-base.yaml#/components/responses/Unauthorized'
'403':
$ref: '../openapi-base.yaml#/components/responses/Forbidden'
'404':
$ref: '../openapi-base.yaml#/components/responses/NotFound'
components:
parameters:
userIdPath:
name: userId
in: path
required: true
description: 用户 ID
schema:
type: string
schemas:
# ============================================================
# 管理端 — 账户管理相关 Schema
# ============================================================
AdminAccountUserSummary:
type: object
description: 管理端用户账户摘要
required: [userId, nickname, status, entitlementSource, quotaStatus]
properties:
userId:
type: string
description: 用户 ID
nickname:
type: string
description: 用户昵称
avatar:
type: string
format: uri
description: 头像 URL
status:
type: string
enum: [active, restricted, suspended]
description: 账号状态
entitlementSource:
type: string
description: 权益来源(套餐名或管理员授权)
quotaStatus:
type: string
enum: [normal, low, exhausted, expired]
description: 配额状态
newApiBindingStatus:
type: string
enum: [bound, unbound, sync_failed, pending]
description: New-API 网关绑定状态
riskFlags:
type: array
description: 风险标记列表
items:
type: string
createdAt:
type: string
format: date-time
description: 注册时间
lastActiveAt:
type: string
format: date-time
description: 最近活跃时间
AdminUserEntitlementDetail:
type: object
description: 管理端用户权益和配额详情
required: [userId, entitlements, quotas]
properties:
userId:
type: string
description: 用户 ID
entitlements:
type: array
description: 权益列表
items:
$ref: '#/components/schemas/Entitlement'
quotas:
type: array
description: 配额列表
items:
$ref: '#/components/schemas/Quota'
entitlementSource:
type: string
description: 权益来源说明
lastModifiedAt:
type: string
format: date-time
description: 最近权益变更时间
lastModifiedBy:
type: string
description: 最近变更操作者摘要(脱敏)
QuotaAdjustmentRequest:
type: object
description: 配额调整请求
required: [commandId, adjustments, reason]
properties:
commandId:
type: string
description: 幂等键
adjustments:
type: array
description: 调整项列表
items:
type: object
required: [resourceType, delta, beforeSnapshot]
properties:
resourceType:
type: string
description: 权益资源类型
delta:
type: integer
description: 调整增量(正数为增加,负数为减少)
beforeSnapshot:
type: object
description: 调整前权益快照
properties:
limit:
type: integer
used:
type: integer
remaining:
type: integer
expiresAt:
type: string
format: date-time
description: 新的到期时间(可选)
reason:
type: string
description: 调整原因(写入审计日志)
correlationId:
type: string
description: 关联的外部调用 ID(New-API 回填时使用)
approvalRef:
type: string
description: 审批引用(需要复核时使用)
QuotaAdjustmentResult:
type: object
description: 配额调整结果
required: [adjustmentId, commandId, status]
properties:
adjustmentId:
type: string
description: 调整记录 ID
commandId:
type: string
description: 请求幂等键
status:
type: string
enum: [applied, idempotent_hit, idempotency_conflict]
description: 调整状态
afterSnapshot:
type: object
description: 调整后权益快照
properties:
resourceType:
type: string
limit:
type: integer
used:
type: integer
remaining:
type: integer
QuotaAdjustmentLedgerEntry:
type: object
description: 配额调整 ledger 记录
required: [adjustmentId, commandId, sourceType, resourceType, delta, operatorSummary, createdAt]
properties:
adjustmentId:
type: string
description: 调整记录 ID
commandId:
type: string
description: 幂等键
sourceType:
type: string
enum: [manual, plan_change, market_compensation, export_rollback, newapi_callback]
description: 调整来源类型
resourceType:
type: string
description: 权益资源类型
delta:
type: integer
description: 调整增量
beforeSnapshot:
type: object
description: 调整前快照
properties:
limit:
type: integer
used:
type: integer
remaining:
type: integer
afterSnapshot:
type: object
description: 调整后快照
properties:
limit:
type: integer
used:
type: integer
remaining:
type: integer
correlationId:
type: string
description: 关联外部调用 ID
reason:
type: string
description: 调整原因
operatorSummary:
type: string
description: 操作者摘要(脱敏)
auditStatus:
type: string
enum: [audited, pending_audit]
description: 审计状态
createdAt:
type: string
format: date-time
description: 调整时间
NewApiBindingSummary:
type: object
description: New-API 网关用户绑定摘要
required: [userId, bindingStatus]
properties:
userId:
type: string
description: 用户 ID
nickname:
type: string
description: 用户昵称
bindingStatus:
type: string
enum: [bound, unbound, sync_failed, pending]
description: 绑定状态
boundAt:
type: string
format: date-time
description: 绑定时间
lastSyncAt:
type: string
format: date-time
description: 最近同步时间
syncErrorMessage:
type: string
description: 同步失败原因(仅失败时返回)
NewApiBindingResult:
type: object
description: New-API 网关绑定结果
required: [bindingId, status, commandId]
properties:
bindingId:
type: string
description: 绑定记录 ID
status:
type: string
enum: [created, refreshed, idempotent_hit, idempotency_conflict]
description: 绑定操作结果状态
commandId:
type: string
description: 请求幂等键
boundAt:
type: string
format: date-time
description: 绑定时间
AdminQuotaRequestCreate:
type: object
description: 管理端发起额度配置请求
required: [commandId, requestType]
properties:
commandId:
type: string
description: 幂等键
requestType:
type: string
enum: [plan_config, balance_config, subscription_sync]
description: 额度配置类型
reason:
type: string
description: 请求原因(写入审计日志)
targetQuota:
type: object
description: 目标额度配置
properties:
resourceType:
type: string
limit:
type: integer
QuotaRequestResult:
type: object
description: 额度请求创建结果
required: [requestId, correlationId, status]
properties:
requestId:
type: string
description: 额度请求 ID
correlationId:
type: string
description: 外部调用关联 ID,后续可用于查询调用状态
status:
type: string
enum: [queued, processing, idempotent_hit]
description: 请求初始状态
QuotaRequestStatus:
type: object
description: 额度请求状态
required: [requestId, correlationId, status]
properties:
requestId:
type: string
description: 额度请求 ID
correlationId:
type: string
description: 外部调用关联 ID
status:
type: string
enum: [queued, processing, completed, failed, idempotent_hit]
description: 请求状态
failedReason:
type: string
description: 失败原因(仅失败时返回)
completedAt:
type: string
format: date-time
description: 完成时间
createdAt:
type: string
format: date-time
description: 创建时间
BalanceSnapshotEntry:
type: object
description: 余额和权益快照条目
required: [snapshotId, resourceType, balance, capturedAt]
properties:
snapshotId:
type: string
description: 快照 ID
resourceType:
type: string
description: 权益资源类型
balance:
type: number
description: 余额(不暴露供应商路由或成本策略)
usedQuota:
type: integer
description: 已使用配额
totalQuota:
type: integer
description: 总配额
expiresAt:
type: string
format: date-time
description: 到期时间
capturedAt:
type: string
format: date-time
description: 快照捕获时间
source:
type: string
description: 快照来源(套餐/管理员/市场补偿等)
CallAttributionJobCreate:
type: object
description: 创建调用归属 job 请求
required: [commandId, userId]
properties:
commandId:
type: string
description: 幂等键
userId:
type: string
description: 待归属用户 ID
taskId:
type: string
description: 关联 AI 任务 ID(可选)
workId:
type: string
description: 关联作品 ID(可选)
agentId:
type: string
description: 关联智能体 ID(可选)
knowledgeSourceId:
type: string
description: 关联知识来源 ID(可选)
marketAuthorizationId:
type: string
description: 关联市场授权 ID(可选)
reason:
type: string
description: 归属原因
CallAttributionJobResult:
type: object
description: 调用归属 job 创建结果
required: [jobId, status]
properties:
jobId:
type: string
description: 调用归属 job ID
status:
type: string
enum: [queued, processing, idempotent_hit]
description: job 初始状态
CallAttributionJobDetail:
type: object
description: 调用归属 job 详情
required: [jobId, status, userId, createdAt]
properties:
jobId:
type: string
description: 调用归属 job ID
status:
type: string
enum: [queued, processing, completed, failed, partially_completed]
description: 执行状态
userId:
type: string
description: 归属用户 ID
attributedCallCount:
type: integer
description: 已归属调用数
pendingCallCount:
type: integer
description: 待归属调用数
failedCallCount:
type: integer
description: 归属失败调用数
failedReason:
type: string
description: 失败原因(仅失败时返回)
compensationSuggestion:
type: string
description: 补偿建议(失败时提供)
createdAt:
type: string
format: date-time
description: 创建时间
completedAt:
type: string
format: date-time
description: 完成时间
IntegrationCallDetail:
type: object
description: 外部调用详情
required: [correlationId, status, createdAt]
properties:
correlationId:
type: string
description: 外部调用关联 ID
status:
type: string
enum: [success, failed, retrying, deduplicated, attributed, pending_attribution]
description: 调用状态
requestType:
type: string
description: 请求类型(额度配置/余额查询等)
retryGroup:
type: array
description: 重试组内的调用 ID 列表
items:
type: string
attributionStatus:
type: string
enum: [attributed, pending, failed]
description: 归属状态
attributedUserId:
type: string
description: 归属用户 ID
createdAt:
type: string
format: date-time
description: 首次调用时间
lastRetryAt:
type: string
format: date-time
description: 最近重试时间
errorMessage:
type: string
description: 错误信息(仅失败时返回)
AdminUsageRecord:
type: object
description: 管理端用量记录
required: [recordId, userId, period, totalTokens, attributionStatus]
properties:
recordId:
type: string
description: 记录 ID
userId:
type: string
description: 用户 ID
nickname:
type: string
description: 用户昵称
period:
type: string
description: 统计周期
totalInputTokens:
type: integer
description: 总输入 Token 数
totalOutputTokens:
type: integer
description: 总输出 Token 数
totalTokens:
type: integer
description: 总 Token 数
pendingAttributionCount:
type: integer
description: 待归属记录数
failedAttributionCount:
type: integer
description: 归属失败记录数
attributionStatus:
type: string
enum: [attributed, pending, failed]
description: 归属状态
byWork:
type: array
description: 按作品归属摘要
items:
type: object
properties:
workId:
type: string
workTitle:
type: string
tokens:
type: integer
byAgent:
type: array
description: 按智能体归属摘要
items:
type: object
properties:
agentId:
type: string
agentName:
type: string
tokens:
type: integer
AdminPurchaseRecord:
type: object
description: 管理端购买记录
required: [recordId, userId, assetType, status, createdAt]
properties:
recordId:
type: string
description: 记录 ID
userId:
type: string
description: 用户 ID
nickname:
type: string
description: 用户昵称
assetType:
type: string
enum: [work, agent, knowledge_base]
description: 资产类型
assetName:
type: string
description: 资产名称
purchaseType:
type: string
enum: [paid, free, admin_grant, external]
description: 购买类型
amount:
type: number
description: 金额(免费为 0)
status:
type: string
enum: [completed, processing, failed, refunded]
description: 购买状态
externalOrderRef:
type: string
description: 外部订单引用(脱敏)
authorizationResult:
type: string
description: 授权结果摘要
createdAt:
type: string
format: date-time
description: 购买时间
# ============================================================
# 用户端 — 当前用户入口相关 Schema
# ============================================================
CurrentUserSummary:
type: object
description: 当前用户摘要
required: [userId, nickname, status, entitlementSummary, defaultEntry, visibleProductSpaces]
properties:
userId:
type: string
description: 用户 ID
nickname:
type: string
description: 用户昵称
avatar:
type: string
format: uri
description: 头像 URL
status:
type: string
enum: [active, restricted, suspended]
description: 账号状态
emailVerified:
type: boolean
description: 邮箱是否已验证
phoneVerified:
type: boolean
description: 手机号是否已验证
mfaEnabled:
type: boolean
description: 是否启用二次验证
entitlementSummary:
type: object
description: 权益摘要
properties:
planName:
type: string
description: 当前套餐名
remainingQuota:
type: integer
description: 剩余配额
quotaStatus:
type: string
enum: [normal, low, exhausted, expired]
description: 配额状态
expiresAt:
type: string
format: date-time
description: 权益到期时间
securityRiskCount:
type: integer
description: 待处理安全风险数
defaultEntry:
type: string
description: 默认入口路径
visibleProductSpaces:
type: array
description: 可见产品空间列表
items:
type: object
properties:
spaceKey:
type: string
description: 空间标识(work/agent/knowledge/market)
spaceName:
type: string
description: 空间显示名称
entryPath:
type: string
description: 空间入口路径
# ============================================================
# 用户端 — 个人中心相关 Schema
# ============================================================
AccountProfile:
type: object
description: 个人资料
required: [userId, nickname, status, emailVerified, phoneVerified]
properties:
userId:
type: string
description: 用户 ID
nickname:
type: string
description: 昵称
avatar:
type: string
format: uri
description: 头像 URL
publicPenName:
type: string
description: 公开署名
emailMasked:
type: string
description: 邮箱脱敏值
phoneMasked:
type: string
description: 手机号脱敏值
emailVerified:
type: boolean
description: 邮箱是否已验证
phoneVerified:
type: boolean
description: 手机号是否已验证
status:
type: string
enum: [active, restricted, suspended]
description: 账号状态
createdAt:
type: string
format: date-time
description: 注册时间
lastProfileUpdatedAt:
type: string
format: date-time
description: 最近资料更新时间
version:
type: integer
description: 资料版本号(乐观锁)
ProfileUpdateRequest:
type: object
description: 修改资料请求
required: [commandId, expectedVersion]
properties:
commandId:
type: string
description: 幂等键
expectedVersion:
type: integer
description: 期望资料版本号(乐观锁)
nickname:
type: string
description: 新昵称
avatar:
type: string
format: uri
description: 新头像 URL
publicPenName:
type: string
description: 新公开署名
AppEntitlementDetail:
type: object
description: 用户端权益和配额详情
required: [entitlements, quotas]
properties:
planName:
type: string
description: 当前套餐名
entitlementSource:
type: string
description: 权益来源说明
entitlements:
type: array
description: 权益列表
items:
$ref: '#/components/schemas/Entitlement'
quotas:
type: array
description: 配额列表
items:
$ref: '#/components/schemas/Quota'
rateLimits:
type: array
description: 限流信息
items:
type: object
properties:
resourceType:
type: string
limitPerMinute:
type: integer
currentUsage:
type: integer
publishCapability:
type: object
description: 发布能力
properties:
maxPublishableAssets:
type: integer
currentPublished:
type: integer
expiresAt:
type: string
format: date-time
description: 权益到期时间
AppUsageSummary:
type: object
description: 用户端用量摘要
properties:
period:
type: string
description: 统计周期
totalInputTokens:
type: integer
description: 总输入 Token 数
totalOutputTokens:
type: integer
description: 总输出 Token 数
pendingAttributionCount:
type: integer
description: 待归属记录数
anomalyCount:
type: integer
description: 计量异常记录数
byModel:
type: object
description: 按模型的用量分布
additionalProperties:
type: integer
byDate:
type: array
description: 按日期的用量分布
items:
type: object
properties:
date:
type: string
format: date
inputTokens:
type: integer
outputTokens:
type: integer
byAttribution:
type: array
description: 按归属对象类型的用量分布
items:
type: object
properties:
attributionType:
type: string
enum: [work, agent, knowledge, market]
tokens:
type: integer
label:
type: string
AppNewApiBindingSummary:
type: object
description: 用户端 New-API 网关用户绑定摘要
required: [bindingStatus]
properties:
bindingStatus:
type: string
enum: [bound, unbound, sync_failed, pending]
description: 绑定状态
boundAt:
type: string
format: date-time
description: 绑定时间
lastSyncAt:
type: string
format: date-time
description: 最近同步时间
canRecheck:
type: boolean
description: 是否可以发起重验
AppPurchaseRecord:
type: object
description: 用户端购买记录
required: [recordId, assetType, purchaseType, status, createdAt]
properties:
recordId:
type: string
description: 记录编号
assetType:
type: string
enum: [work, agent, knowledge_base]
description: 资产类型
assetName:
type: string
description: 资产名称
purchaseType:
type: string
enum: [paid, free, admin_grant, external]
description: 购买类型
amount:
type: number
description: 金额(免费为 0)
status:
type: string
enum: [completed, processing, failed, external_pending, refunded]
description: 购买状态
externalOrderRef:
type: string
description: 外部订单引用(脱敏)
authorizationResultSummary:
type: string
description: 授权结果摘要
createdAt:
type: string
format: date-time
description: 购买时间
AppLicenseRecord:
type: object
description: 用户端授权记录
required: [licenseId, assetType, assetName, licenseStatus]
properties:
licenseId:
type: string
description: 授权记录 ID
assetType:
type: string
enum: [work, agent, knowledge_base]
description: 资产类型
assetName:
type: string
description: 资产名称
publisherName:
type: string
description: 发布者
version:
type: string
description: 版本
licenseScope:
type: string
description: 许可范围摘要
licenseStatus:
type: string
enum: [active, uninstalled, installed, bound, expired, delisted, recalled, needs_recheck]
description: 授权状态
acquiredAt:
type: string
format: date-time
description: 获取时间
expiresAt:
type: string
format: date-time
description: 到期时间
installSummary:
type: string
description: 安装状态摘要
bindingSummary:
type: string
description: 绑定状态摘要
anomalyReason:
type: string
description: 异常原因(授权失效/下架/需重验时返回)
AppPublishRecord:
type: object
description: 用户端发布记录
required: [recordId, assetType, assetName, reviewStatus]
properties:
recordId:
type: string
description: 发布记录 ID
assetType:
type: string
enum: [work, agent, knowledge_base]
description: 资产类型
assetName:
type: string
description: 资产名称
version:
type: string
description: 版本
reviewStatus:
type: string
enum: [draft, submitted, under_review, needs_supplement, approved, listed, delisted, appealed]
description: 审核状态
marketStatus:
type: string
enum: [not_listed, listed, delisted, recalled]
description: 市场状态
blockingReason:
type: string
description: 阻断原因摘要
submittedAt:
type: string
format: date-time
description: 提交时间
lastUpdatedAt:
type: string
format: date-time
description: 最近更新时间
SecurityEventSummary:
type: object
description: 安全事件摘要
required: [eventId, eventType, severity, occurredAt]
properties:
eventId:
type: string
description: 安全事件 ID
eventType:
type: string
enum: [login_anomaly, credential_expired, sensitive_export, access_denied_burst, device_change, permission_escalation]
description: 事件类型
severity:
type: string
enum: [info, warning, critical]
description: 严重程度
occurredAt:
type: string
format: date-time
description: 事件发生时间
description:
type: string
description: 事件简短描述
acknowledged:
type: boolean
description: 是否已确认
SecurityEventDetail:
type: object
description: 安全事件详情
required: [eventId, eventType, severity, occurredAt, description, affectedScope, suggestedActions]
properties:
eventId:
type: string
description: 安全事件 ID
eventType:
type: string
enum: [login_anomaly, credential_expired, sensitive_export, access_denied_burst, device_change, permission_escalation]
description: 事件类型
severity:
type: string
enum: [info, warning, critical]
description: 严重程度
occurredAt:
type: string
format: date-time
description: 事件发生时间
sourceIp:
type: string
description: 来源 IP 地址(脱敏)
deviceInfo:
type: object
description: 设备信息摘要
properties:
userAgent:
type: string
description: User-Agent 摘要
platform:
type: string
description: 平台
location:
type: string
description: 地理位置摘要
affectedScope:
type: string
description: 影响范围描述
description:
type: string
description: 事件详细描述
suggestedActions:
type: array
description: 建议处理措施列表
items:
type: string
acknowledgedAt:
type: string
format: date-time
description: 用户确认时间(未确认为空)
acknowledgedAction:
type: string
description: 用户确认时选择的处理措施
SecurityEventAcknowledgeRequest:
type: object
description: 确认安全事件请求
required: [commandId, action]
properties:
commandId:
type: string
description: 幂等键
action:
type: string
enum: [acknowledged, password_changed, session_revoked, false_positive]
description: |
确认动作:
- acknowledged: 已知晓
- password_changed: 已修改密码
- session_revoked: 已撤销相关会话
- false_positive: 标记为误报
note:
type: string
description: 可选,用户备注
SecurityEventAcknowledgeResult:
type: object
description: 安全事件确认结果
required: [eventId, acknowledged, action]
properties:
eventId:
type: string
description: 安全事件 ID
acknowledged:
type: boolean
description: 是否确认成功
action:
type: string
description: 确认动作
acknowledgedAt:
type: string
format: date-time
description: 确认时间
riskSummary:
type: string
description: 处理后风险摘要
nextSteps:
type: array
description: 后续建议
items:
type: string
AccountExportTaskCreate:
type: object
description: 创建个人中心导出任务请求
required: [commandId, exportType]
properties:
commandId:
type: string
description: 幂等键
exportType:
type: string
enum: [profile, usage, security_events, purchases, licenses]
description: 导出类型
dateRange:
type: object
description: 时间范围(安全事件和用量导出必填)
properties:
startDate:
type: string
format: date
endDate:
type: string
format: date
desensitizationRule:
type: string
enum: [standard, strict]
default: standard
description: 脱敏规则
AccountExportTaskResult:
type: object
description: 导出任务创建结果
required: [taskId, status]
properties:
taskId:
type: string
description: 导出任务 ID
status:
type: string
enum: [queued, processing, idempotent_hit]
description: 任务初始状态
estimatedCompletionAt:
type: string
format: date-time
description: 预计完成时间
AccountExportTaskDetail:
type: object
description: 导出任务详情
required: [taskId, exportType, status, createdAt]
properties:
taskId:
type: string
description: 导出任务 ID
exportType:
type: string
enum: [profile, usage, security_events, purchases, licenses]
description: 导出类型
status:
type: string
enum: [queued, processing, completed, failed]
description: 任务状态
downloadCredentialId:
type: string
description: 下载凭证 ID(完成时返回)
downloadExpiresAt:
type: string
format: date-time
description: 下载凭证过期时间
failedReason:
type: string
description: 失败原因(仅失败时返回)
createdAt:
type: string
format: date-time
description: 创建时间
completedAt:
type: string
format: date-time
description: 完成时间
# ============================================================
# 通用 Schema(管理端和用户端共享)
# ============================================================
Entitlement:
type: object
description: 权益项
required: [id, resourceType, limit, used, expiresAt]
properties:
id:
type: string
description: 权益 ID
resourceType:
type: string
description: 权益资源类型(如 ai_tokens, storage, publish_slots 等)
limit:
type: integer
description: 额度上限(-1 表示无限制)
used:
type: integer
description: 已使用量
remaining:
type: integer
description: 剩余额度
source:
type: string
description: 权益来源(套餐/管理员/市场补偿等)
expiresAt:
type: string
format: date-time
description: 到期时间
Quota:
type: object
description: 配额项
required: [id, resourceType, total, remaining, resetAt]
properties:
id:
type: string
description: 配额 ID
resourceType:
type: string
description: 配额资源类型
total:
type: integer
description: 总配额
used:
type: integer
description: 已使用量
remaining:
type: integer
description: 剩余配额
resetAt:
type: string
format: date-time
description: 配额重置时间
limitPerMinute:
type: integer
description: 频率限制(每分钟)