OpenClaw Model Optimizer
Optimize openclaw.json model configurations by declaring model capabilities that OpenClaw cannot auto-detect.
Problem
OpenClaw does not auto-detect model capabilities from providers. Without explicit declarations, features like vision input, large context windows, extended output, and reasoning mode remain disabled — even when the underlying model and API fully support them.
Workflow
- 1. Read INLINECODE1
- Back up the config — copy
~/.openclaw/openclaw.json to ~/.openclaw/openclaw.json.bak before making any changes - Identify all configured models under INLINECODE4
- Check if
agents.defaults.models exists with capability declarations for each model - For missing or incomplete declarations, ask the user to confirm each model's capabilities
- Add the
agents.defaults.models block with proper declarations - Remind user to restart OpenClaw for changes to take effect
Capability Fields
Declare capabilities in agents.defaults.models using the provider-id/model-id key format:
CODEBLOCK0
Field Reference
| Field | Type | Description |
|---|
| INLINECODE9 | INLINECODE10 | Supported input modalities: "text", "image". Default if omitted: ["text"] only — vision disabled |
| INLINECODE14 |
number | Max input context in tokens. Default if omitted: conservative fallback — may truncate long conversations |
|
maxTokens |
number | Max output tokens per response. Default if omitted: conservative fallback — long responses get cut off |
|
reasoning |
boolean | Whether model supports extended thinking/CoT. Default if omitted:
false |
Common Model Capabilities
Reference for popular models (always verify with user before applying):
See references/model-capabilities.md for known model defaults.
Important Notes
- - Always back up
openclaw.json to openclaw.json.bak before modifying — never edit the config without a backup - Always confirm capabilities with the user — API endpoints may differ from model defaults
- The
provider-id/model-id key must match exactly what appears in models.providers and INLINECODE25 - Do not overwrite existing capability declarations without user consent
OpenClaw 模型优化器
通过声明 OpenClaw 无法自动检测的模型能力,优化 openclaw.json 模型配置。
问题
OpenClaw 无法从提供商处自动检测模型能力。如果没有明确声明,视觉输入、大上下文窗口、扩展输出和推理模式等功能将保持禁用状态——即使底层模型和 API 完全支持这些功能。
工作流程
- 1. 读取 ~/.openclaw/openclaw.json
- 备份配置 — 在进行任何更改前,将 ~/.openclaw/openclaw.json 复制到 ~/.openclaw/openclaw.json.bak
- 识别 models.providers 下配置的所有模型
- 检查 agents.defaults.models 是否存在,并为每个模型声明能力
- 对于缺失或不完整的声明,询问用户确认每个模型的能力
- 添加包含正确声明的 agents.defaults.models 块
- 提醒用户重启 OpenClaw 以使更改生效
能力字段
使用 provider-id/model-id 键格式在 agents.defaults.models 中声明能力:
json
{
agents: {
defaults: {
models: {
provider-id/model-id: {
input: [text, image],
contextWindow: 256000,
maxTokens: 16384,
reasoning: true
}
}
}
}
}
字段参考
| 字段 | 类型 | 描述 |
|---|
| input | string[] | 支持的输入模态:text、image。省略时默认值:仅 [text] — 视觉功能禁用 |
| contextWindow |
number | 最大输入上下文(以 token 计)。省略时默认值:保守回退 — 可能截断长对话 |
| maxTokens | number | 每次响应的最大输出 token 数。省略时默认值:保守回退 — 长响应会被截断 |
| reasoning | boolean | 模型是否支持扩展思考/思维链。省略时默认值:false |
常见模型能力
流行模型参考(应用前务必与用户确认):
参见 references/model-capabilities.md 了解已知模型默认值。
重要说明
- - 修改前务必将 openclaw.json 备份为 openclaw.json.bak — 切勿在无备份的情况下编辑配置
- 始终与用户确认能力 — API 端点可能与模型默认值不同
- provider-id/model-id 键必须与 models.providers 和 agents.defaults.model.primary 中的内容完全匹配
- 未经用户同意,不要覆盖现有的能力声明