models.yaml 参考
模型网关配置的完整字段
models.yaml 位于 <dataPath>/models.yaml,由 @yesimagent/gateway 读取,定义 Ishiki 可用的全部模型。顶层只有 providers 与 groups 两个键,均为映射。格式支持 YAML(推荐)或 JSON。
providers
providers.<providerId> 定义一个供应商:
Prop
Type
方言枚举(键即 api 取值):
| 方言 | 协议 |
|---|---|
openai-completions | OpenAI /chat/completions 兼容(DeepSeek/Kimi/GLM/Groq/SiliconFlow/llama.cpp 等) |
openai-responses | OpenAI Responses API |
anthropic-messages | Anthropic Messages API |
google-generative-ai | Google Generative AI |
typesafe-ai | Typesafe 平台 |
models[].语言模型字段
Prop
Type
思考档位全集:none、minimal、low、medium、high、xhigh、max。
模型目录还支持 language/embedding/image/speech/transcription/reranking/decision 等类型标记。Ishiki 的对话调用使用语言模型;jev 唤醒引擎通过 profile 中的模型引用取得 type: decision 的决策模型。
providers:
typesafe:
api: typesafe-ai
apiKey: ${TYPESAFE_API_KEY}
models:
- id: jev-latest
type: decision
groups: {}profile 写 wakeup.jev.model: typesafe:jev-latest。具体行为与其余参数见调整唤醒行为。
groups
groups.<groupId> 把多个模型引用编成候选列表:
Prop
Type
熔断器默认值:failureThreshold: 3、cooldownSeconds: 60。连续失败达到阈值的候选进入冷却,冷却期内被跳过。
组只负责候选顺序与熔断记账,不改变请求本身;profile 的 failover 段控制重试次数与触发条件,见参考:插件与 profile 配置。
模型引用语法
出现在 profile model、组 models 成员里的引用:
provider:model
provider:model:thinkLevel
groupId解析规则:按 : 切分;仅当最后一段精确等于某个思考档位名时才视为档位,否则整串按模型 ID 处理(因此 qwen3:32b 这类 ID 正常解析)。
校验与错误
- 构造期校验失败抛
GatewayError,启动日志可见;常见原因是api拼写、必填字段缺失。 - 全新数据目录第一次启动时,插件释放包含占位供应商的
models.yaml。已有数据目录缺少该文件时会自动创建空文件;空文件等于「无可用模型」,首个引用它的 profile 装配失败。 ${VAR}引用的环境变量在展开时求值,缺失会导致引用解析失败。
完整示例
以下示例中的密钥均为占位符,替换为真实值:
providers:
deepseek:
api: openai-completions
baseUrl: https://api.deepseek.com
apiKey: ${DEEPSEEK_KEY}
models:
- id: deepseek-chat
name: DeepSeek Chat
reasoning: true
input: [text, image]
contextWindow: 128000
maxTokens: 8192
thinking:
mode: effort
efforts: [none, low, high, max]
local:
api: openai-completions
baseUrl: http://127.0.0.1:8080/v1
apiKey: none
models:
- id: qwen3-32b
input: [text]
contextWindow: 65536
groups:
chat:
strategy: failover
models:
- deepseek:deepseek-chat
- local:qwen3-32b
circuitBreaker:
failureThreshold: 2
cooldownSeconds: 60