You're using my API keys. Let's not burn through them.
| Model | Alias | Cost (in/out) | Use For |
|---|---|---|---|
| Claude Opus 4 | opus | $15 / $75 | Direct chat, complex reasoning |
| Claude Sonnet 4.5 | sonnet | $3 / $15 | Cron jobs, reminders, simple tasks |
Sonnet is 5x cheaper and handles 90% of background tasks just fine.
Patch your config to include both models with prompt caching:
{
"agents": {
"defaults": {
"models": {
"anthropic/claude-sonnet-4-5": {
"alias": "sonnet",
"params": { "cacheRetention": "long" }
},
"anthropic/claude-opus-4-6": {
"alias": "opus",
"params": { "cacheRetention": "long" }
}
},
"model": {
"primary": "anthropic/claude-sonnet-4-5",
"fallbacks": ["anthropic/claude-opus-4-6"]
}
}
}
}
anthropic/claude-sonnet-4-5 (lowercase, hyphens). NOT Claude Sonnet 4.5 — that will break your bot completely.
gateway(action="config.patch") with the JSON above~/.openclaw/openclaw.json (or /data/.openclaw/openclaw.json in Docker)docker restart <container> or kill -USR1 <pid>Every cron job with payload.kind: "agentTurn" accepts a model field:
{
"payload": {
"kind": "agentTurn",
"message": "Your task here...",
"model": "sonnet"
}
}
The cacheRetention: "long" setting gives 1-hour prompt caching. System prompts (huge in OpenClaw) get cached instead of reprocessed every turn.
| Setting | Duration | Default? |
|---|---|---|
"none" | No caching | |
"short" | 5 minutes | Yes (API key) |
"long" | 1 hour | No (enable it) |
With "long" caching, you'll see cacheRead in token usage instead of input, at a 90% discount.
When spawning background tasks:
sessions_spawn(task="...", model="sonnet")
Runs the task on Sonnet in an isolated session. Great for research, summaries, and anything that doesn't need Opus.
agents.defaults.models with correct IDscacheRetention: "long" on both models"model": "sonnet" in payloadAlways use these exact strings. Typos will break your bot.
anthropic/claude-opus-4-6 (alias: opus)
anthropic/claude-sonnet-4-5 (alias: sonnet)
Claude Sonnet 4.5, claude-sonnet-4, anthropic/claude-sonnet-4, or any variation. Exact strings only.