OpenClaw 作为 Agentic AI 助手,单次任务的 Token 消耗较大(通常 10K-100K+ tokens)。建议根据任务复杂度选择模型,避免不必要的成本。本文提供几种配置方案供参考。
& ([scriptblock]::Create((iwr -useb https://openclaw.ai/install.ps1)))| 配置项 | 值 |
|---|---|
| Provider Type | anthropic-messages |
| Base URL | https://api.tokenhot.ai |
| API Key | Tokenhot API Key |
| Model | claude-sonnet-4.6 |
~/.openclaw/openclaw.json 管理所有配置(支持 JSON5 格式,可写注释)。models.providers 下,每个 Provider 需要指定 API 协议类型、地址和密钥:{
"models": {
"providers": {
"Tokenhot-anthropic": {
"baseUrl": "https://api.tokenhot.ai",
"apiKey": "${TOKENHOT_API_KEY}",
"api": "anthropic-messages",
"models": []
},
"Tokenhot-openai": {
"baseUrl": "https://api.tokenhot.ai/v1",
"apiKey": "${TOKENHOT_API_KEY}",
"api": "openai-responses",
"models": []
},
"Tokenhot-gemini": {
"baseUrl": "https://api.tokenhot.ai",
"apiKey": "${TOKENHOT_API_KEY}",
"api": "google-generative-ai",
"models": []
}
}
}
}models 数组中。我们提供三套方案,根据你的需求选择:{
"models": {
"providers": {
"Tokenhot-anthropic": {
"baseUrl": "https://api.tokenhot.ai",
"apiKey": "${TOKENHOT_API_KEY}",
"api": "anthropic-messages",
"models": [
{
"id": "claude-sonnet-4.6",
"name": "Claude Sonnet 4.6",
"input": ["text", "image", "file"],
"contextWindow": 200000,
"maxTokens": 64000
},
{
"id": "claude-opus-4.6",
"name": "Claude Opus 4.6",
"reasoning": true,
"input": ["text", "image", "file"],
"contextWindow": 200000,
"maxTokens": 128000
},
{
"id": "claude-haiku-4.5",
"name": "Claude Haiku 4.5",
"input": ["text", "image", "file"],
"contextWindow": 200000,
"maxTokens": 64000
}
]
}
}
}
}| 模型 | 角色定位 | 适用场景 |
|---|---|---|
anthropic/claude-sonnet-4.6 | 主力模型 | 日常对话、任务执行、代码生成 |
anthropic/claude-opus-4.6 | 深度推理 | 复杂分析、长链推理、研究任务 |
anthropic/claude-haiku-4.5 | 快速响应 | 简单查询、快速回复、轻量任务 |
{
"models": {
"providers": {
"tokenhot-openai": {
"baseUrl": "https://api.tokenhot.ai/v1",
"apiKey": "${TOKENHOT_API_KEY}",
"api": "openai-responses",
"models": [
{
"id": "gpt-5.3-codex",
"name": "GPT 5.3 Codex",
"reasoning": true,
"input": ["text", "image", "audio", "file"],
"contextWindow": 512000,
"maxTokens": 128000
},
{
"id": "gpt-5.1-codex-mini",
"name": "GPT 5.1 Codex Mini",
"input": ["text", "image", "audio", "file"],
"contextWindow": 256000,
"maxTokens": 65536
}
]
}
}
}
}| 模型 | 角色定位 | 适用场景 |
|---|---|---|
openai/gpt-5.3-codex | 主力 + 推理 | 日常对话、复杂任务、代码重构 |
openai/gpt-5.1-codex-mini | 快速响应 | 轻量任务、代码补全、快速问答 |
OpenAI 模型通过 Tokenhot-openaiProvider 接入,使用openai-responses协议。
{
"models": {
"providers": {
"Tokenhot-openai": {
"baseUrl": "https://api.tokenhot.ai/v1",
"apiKey": "${TOKENHOT_API_KEY}",
"api": "openai-responses",
"models": [
{
"id": "qwen3.5-plus",
"name": "Qwen 3.5 Plus",
"input": ["text", "image"],
"contextWindow": 1000000,
"maxTokens": 64000
},
{
"id": "doubao-seed-2.0-code",
"name": "豆包 Seed 2.0 Code",
"input": ["text", "image"],
"contextWindow": 256000,
"maxTokens": 128000
}
]
}
}
}
}| 模型 | 角色定位 | 适用场景 |
|---|---|---|
qwen3.5-plus | 主力 + 推理 | 日常对话、通用任务、中文优化 |
doubao-seed-2.0-code | 代码 + 快速 | 代码生成、调试、快速回复 |
agents.defaults 设置全局默认,通过 agents.list 数组定义不同 Agent,每个 Agent 可覆盖默认配置:{
"agents": {
"defaults": {
"model": {
"primary": "claude-sonnet-4.6",
"fallbacks": ["claude-haiku-4.5"]
},
"models": {
"claude-opus-4.6": { "alias": "opus" },
"claude-sonnet-4.6": { "alias": "sonnet" },
"claude-haiku-4.5": { "alias": "haiku" }
},
"thinkingDefault": "low",
"timeoutSeconds": 600,
"maxConcurrent": 3
},
"list": [
{
"id": "main",
"default": true
},
{
"id": "research",
"model": {
"primary": "claude-opus-4.6"
}
},
{
"id": "quick",
"model": {
"primary": "claude-haiku-4.5"
}
}
]
}
}| Agent | 模型 | 用途 |
|---|---|---|
| main | claude-sonnet-4.6(继承 defaults) | 默认 Agent,日常所有任务 |
| research | claude-opus-4.6 | 深度研究、复杂推理、长文分析 |
| quick | claude-haiku-4.5 | 简单问答、快速响应、低成本 |
openclaw.json,整合了 Provider、Models 和 Agents 配置(最强配置方案):{
"models": {
"providers": {
"Tokenhot-anthropic": {
"baseUrl": "https://api.tokenhot.ai",
"apiKey": "${Tokenhot_API_KEY}",
"api": "anthropic-messages",
"models": [
{
"id": "anthropic/claude-sonnet-4.6",
"name": "Claude Sonnet 4.5",
"input": ["text", "image", "file"],
"contextWindow": 200000,
"maxTokens": 64000
},
{
"id": "anthropic/claude-opus-4.6",
"name": "Claude Opus 4.6",
"reasoning": true,
"input": ["text", "image", "file"],
"contextWindow": 200000,
"maxTokens": 128000
},
{
"id": "anthropic/claude-haiku-4.5",
"name": "Claude Haiku 4.5",
"input": ["text", "image", "file"],
"contextWindow": 200000,
"maxTokens": 64000
}
]
},
"Tokenhot-gemini": {
"baseUrl": "https://api.tokenhot.ai",
"apiKey": "${Tokenhot_API_KEY}",
"api": "google-generative-ai",
"models": [
{
"id": "gemini-2.5-flash",
"name": "Gemini 2.5 Flash",
"reasoning": true,
"input": ["text", "image"],
"contextWindow": 1000000,
"maxTokens": 64000
},
{
"id": "gemini-2.5-pro",
"name": "Gemini 2.5 Pro",
"reasoning": true,
"input": ["text", "image"],
"contextWindow": 1000000,
"maxTokens": 64000
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "claude-sonnet-4.6",
"fallbacks": ["claude-haiku-4.5"]
},
"models": {
"claude-opus-4.6": { "alias": "opus" },
"claude-sonnet-4.6": { "alias": "sonnet" },
"claude-haiku-4.5": { "alias": "haiku" }
},
"thinkingDefault": "low",
"timeoutSeconds": 600,
"maxConcurrent": 3
},
"list": [
{
"id": "main",
"default": true
},
{
"id": "research",
"model": {
"primary": "claude-opus-4.6"
}
},
{
"id": "quick",
"model": {
"primary": "claude-haiku-4.5"
}
}
]
}
}baseUrl 配置正确:https://api.tokenhot.aihttps://api.tokenhot.ai/v1https://api.tokenhot.aimodels.providers 中定义模型时,id 使用 Tokenhot 的完整模型名称(如 claude-sonnet-4.6)。claude-haiku-4.5 或其它模型research Agent(使用 claude-opus-4.7)/model opus、/model sonnet、/model haiku(需要在 agents.defaults.models 中配置别名)。