feat: 下发智能路由模型目录 (#74)

This commit is contained in:
2026-08-10 17:03:06 +08:00
committed by GitHub
parent 78ed93f127
commit d6f939af52
6 changed files with 1454 additions and 3 deletions

View File

@@ -0,0 +1,273 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://desirecore.net/schemas/smart-model-catalog.json",
"title": "SmartModelCatalog",
"description": "智能路由量级、Provider 和模型能力目录Config Center、内置兜底与未来接口共用此契约。",
"type": "object",
"required": [
"version",
"updatedAt",
"source",
"tiers",
"providers"
],
"properties": {
"$schema": {
"type": "string",
"description": "本数据对应的 JSON Schema 标识。"
},
"version": {
"type": "integer",
"minimum": 1,
"maximum": 1,
"description": "目录结构版本;当前客户端只接受 v1不兼容的新语义必须递增版本并由新客户端接入。"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"description": "本目录最近一次人工/自动核对时间。"
},
"source": {
"type": "string",
"enum": [
"builtin",
"config-center",
"provider-api"
],
"description": "目录来源config-center=配置中心下发builtin=客户端离线兜底provider-api=未来接口实时数据。"
},
"tiers": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"items": {
"type": "object",
"required": [
"id",
"label",
"labelEn",
"description",
"defaultReasoning"
],
"properties": {
"id": {
"type": "string",
"enum": [
"flagship",
"balanced",
"lightweight"
],
"description": "智能路由量级flagship=最高能力balanced=质量与成本平衡lightweight=最快最省。"
},
"label": {
"type": "string",
"minLength": 1,
"description": "中文量级标签。"
},
"labelEn": {
"type": "string",
"minLength": 1,
"description": "英文量级标签。"
},
"description": {
"type": "string",
"minLength": 1,
"description": "该量级的任务选择目标。"
},
"defaultReasoning": {
"type": "string",
"enum": [
"auto",
"off",
"minimal",
"low",
"medium",
"high",
"xhigh",
"max"
],
"description": "该量级在模型支持时优先采用的默认思考深度。"
}
},
"additionalProperties": false
},
"description": "三档量级的自描述定义。"
},
"providers": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"required": [
"providerId",
"provider",
"displayName",
"models"
],
"properties": {
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 200,
"description": "compute.json 中的 Provider 唯一 ID。"
},
"provider": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "Provider 协议标识。"
},
"displayName": {
"type": "string",
"minLength": 1,
"maxLength": 200,
"description": "Provider 展示名称。"
},
"models": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"required": [
"model",
"displayName",
"tier",
"routingPriority",
"serviceTypes",
"capabilities",
"contextWindow",
"maxOutputTokens",
"supportedReasoning",
"defaultReasoning",
"eligibleForAgent",
"defaultReference"
],
"properties": {
"model": {
"type": "string",
"minLength": 1,
"maxLength": 300,
"description": "传给对应 Provider 的真实 modelName禁止使用 smart 等虚拟名称。"
},
"displayName": {
"type": "string",
"minLength": 1,
"maxLength": 200,
"description": "客户端展示名称。"
},
"tier": {
"type": "string",
"enum": [
"flagship",
"balanced",
"lightweight"
],
"description": "此模型在智能路由中的能力量级。"
},
"routingPriority": {
"type": "integer",
"minimum": 0,
"maximum": 10000,
"description": "同一量级内的稳定选择顺序,数值越小越优先;凭据与硬能力校验仍先于此排序。"
},
"serviceTypes": {
"type": "array",
"minItems": 1,
"maxItems": 16,
"uniqueItems": true,
"items": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"pattern": "^[a-z0-9_]+$",
"description": "可用于任务硬约束匹配的规范能力标签,例如 vision、code、tool_use、long_context。"
},
"description": "模型服务类型快照,例如 chat、reasoning、image_gen、video_gen。"
},
"capabilities": {
"type": "array",
"maxItems": 64,
"uniqueItems": true,
"items": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"pattern": "^[a-z0-9_]+$",
"description": "可用于任务硬约束匹配的规范能力标签,例如 vision、code、tool_use、long_context。"
},
"description": "模型能力快照;任务 requiredCapabilities 必须全部命中。"
},
"contextWindow": {
"type": [
"integer",
"null"
],
"minimum": 1,
"maximum": 10000000,
"description": "上下文窗口 token 数;非文本模型或未知时为 null。"
},
"maxOutputTokens": {
"type": [
"integer",
"null"
],
"minimum": 1,
"maximum": 1000000,
"description": "最大输出 token 数;未知或不适用时为 null。"
},
"supportedReasoning": {
"type": "array",
"minItems": 1,
"maxItems": 8,
"uniqueItems": true,
"items": {
"type": "string",
"enum": [
"auto",
"off",
"minimal",
"low",
"medium",
"high",
"xhigh",
"max"
],
"description": "本次 Run 或当前 assignment 的思考深度;最终值仍受目标 Provider × Model 能力矩阵约束。"
},
"description": "该 Provider × Model 接入面声明的可用 reasoning 档位。"
},
"defaultReasoning": {
"type": "string",
"enum": [
"auto",
"off",
"minimal",
"low",
"medium",
"high",
"xhigh",
"max"
],
"description": "未显式指定时的模型参考 reasoning路由还会结合量级默认值并做能力协商。"
},
"eligibleForAgent": {
"type": "boolean",
"description": "是否可作为 Agent 主模型。图像/视频生成、ASR/TTS 等专用模型为 false。"
},
"defaultReference": {
"type": "boolean",
"description": "是否为 Provider/defaultServiceMap 给出的默认参考。它只影响同级排序,不是强制答案。"
}
},
"additionalProperties": false
},
"description": "该接入面当前已核对的模型目录。"
}
},
"additionalProperties": false
},
"description": "参与智能路由和能力匹配的 Provider 目录。"
}
},
"additionalProperties": false
}