词元之母TOK.MOM - 平台充值汇率 1:1 即 1 人民币充值到账 1 美元,支持一个 Key 调用近 600+ 海内外模型,限时特价模型低至 1 折,欢迎上岸!
把“思考深度”当成挡位:想快就浅,想稳就深。
opencode.json 后,不确定有没有生效thinking.budgetTokens。capabilities.reasoning。high / max 等变体。provider.models.[modelID].variants 下,可以覆盖默认值。{
"$schema": "https://opencode.ai/config.json",
"provider": {
"anthropic": {
"models": {
"claude-sonnet-4-5": {
"variants": {
"high": {
"thinking": { "type": "enabled", "budgetTokens": 20000 }
},
"max": {
"thinking": { "type": "enabled", "budgetTokens": 32000 }
}
}
}
}
}
}
}{
"$schema": "https://opencode.ai/config.json",
"provider": {
"google": {
"models": {
"gemini-3-flash": {
"variants": {
"high": {
"thinkingConfig": { "includeThoughts": true, "thinkingBudget": 16000 }
},
"max": {
"thinkingConfig": { "includeThoughts": true, "thinkingBudget": 24576 }
}
}
}
}
}
}
}(无) → high → max → (无) → high → ...high)。variants 里使用自定义 key:{
"provider": {
"anthropic": {
"models": {
"claude-sonnet-4-5": {
"variants": {
"极速": { "thinking": { "type": "enabled", "budgetTokens": 8000 } },
"深度": { "thinking": { "type": "enabled", "budgetTokens": 32000 } }
}
}
}
}
}
}opencode.json 里写的变体合并到默认变体中。high/max 显式禁用即可:{
"provider": {
"anthropic": {
"models": {
"claude-sonnet-4-5": {
"variants": {
"high": { "disabled": true },
"max": { "disabled": true },
"极速": { "thinking": { "type": "enabled", "budgetTokens": 8000 } },
"深度": { "thinking": { "type": "enabled", "budgetTokens": 32000 } }
}
}
}
}
}
}openai-compatible,默认使用 reasoningEffort。示例:{
"provider": {
"relay": {
"options": {
"baseURL": "https://your-relay.example.com/v1",
"apiKey": "{env:RELAY_API_KEY}"
},
"models": {
"gpt-5": {
"variants": {
"low": { "reasoningEffort": "low" },
"high": { "reasoningEffort": "high" }
}
}
}
}
}
}openai-compatible SDK),可以直接写 Anthropic 字段覆盖:{
"provider": {
"relay": {
"options": {
"baseURL": "https://your-relay.example.com/v1",
"apiKey": "{env:RELAY_API_KEY}"
},
"models": {
"claude-sonnet-4-5": {
"variants": {
"high": {
"thinking": { "type": "enabled", "budgetTokens": 20000 }
},
"max": {
"thinking": { "type": "enabled", "budgetTokens": 32000 }
}
}
}
}
}
}
}thinking 字段原样转发到 Anthropic。opencode.json 中包含 provider.models.[modelID].variants| 现象 | 原因 | 解决 |
|---|---|---|
| 按 Ctrl+T 没反应 | 当前模型没有变体 | 换支持 reasoning 的模型或添加 variants |
| 变体有但不显示 | 还未切换到某个变体 | 按一次 Ctrl+T |
| 配置不生效 | 模型 ID 写错 | 从模型列表复制完整 ID |
| 中转站没变化 | 用的是 openai-compatible,只支持 reasoningEffort | 在 variants 里手动覆盖参数 |
provider.models.[modelID].variants 配置下一 课我们学习 调试与诊断工具。 你会学到: 如何使用 opencode debug系列命令诊断 LSP、配置和搜索问题 像开发者一样剖析 OpenCode
更新时间:2026-01-16
| 功能 | 文件路径 | 行号 |
|---|---|---|
| 变体生成入口 | src/provider/transform.ts | 297-477 |
| reasoning 过滤与排除 | src/provider/transform.ts | 298-301 |
| Anthropic 思考预算默认值 | src/provider/transform.ts | 371-385 |
| Gemini 3 思考预算默认值 | src/provider/transform.ts | 421-439 |
| 变体配置 Schema | src/config/config.ts | 818-833 |
| 变体配置合并 | src/provider/provider.ts | 929-936 |
| Ctrl+T 默认快捷键 | src/config/config.ts | 632-688 |
| Ctrl+T 命令绑定 | src/cli/cmd/tui/app.tsx | 393-399 |
| 变体循环逻辑 | src/cli/cmd/tui/context/local.tsx | 310-346 |
| 变体显示逻辑 | src/cli/cmd/tui/component/prompt/index.tsx | 696-700 |
| 变体名称渲染 | src/cli/cmd/tui/component/prompt/index.tsx | 946-950 |
| 变体应用到 LLM 参数 | src/session/llm.ts | 96-109 |
| 变体 keybind 配置 | src/config/config.ts | 632-688 |
WIDELY_SUPPORTED_EFFORTS = ["low", "medium", "high"]OPENAI_EFFORTS = ["none", "minimal", "low", "medium", "high", "xhigh"]