Cost Control Is Not Just Cheaper Models
Switching to a cheaper model helps, but it is only one lever. Sustainable long-term operation requires:
- Hard spending limits
- Model selection by task type
- Context length control
- Minimizing tool mounting
- Regular monitoring
Control complexity before changing models.
Hard Limits: Daily and Monthly
Set hard caps so a runaway workflow cannot blow your budget:
{
"ai": {
"dailyLimit": 5.0,
"monthlyBudget": 100.0,
"provider": "anthropic",
"model": "claude-sonnet-4-20250514"
}
}
dailyLimit— Maximum spend per day (e.g., USD 5)monthlyBudget— Maximum spend per month (e.g., USD 100)
When limits are reached, OpenClaw stops making new model calls until the next period. Configure these before going to production.
Model Selection by Task Type
Use different models for different tasks:
| Task type | Example | Suggested model |
|---|---|---|
| Simple routing, keyword matching | "Forward to support" | Cheap model (e.g., claude-3-haiku) |
| Summarization, light Q&A | "Summarize this message" | Mid-tier (e.g., claude-3-sonnet) |
| Complex reasoning, coding, analysis | "Analyze this document" | Expensive model (e.g., claude-sonnet-4) |
Configure model routing in your OpenClaw config or via the router skill:
{
"models": {
"default": "claude-3-haiku-20240307",
"reasoning": "claude-sonnet-4-20250514",
"summarize": "claude-3-sonnet-20240229"
}
}
Reserve expensive models for tasks that need them.
Context Length Control
Longer context costs more per request. Limit input size where possible:
- Truncate long documents before sending to the model
- Use shorter system prompts for simple tasks
- Avoid mounting large knowledge bases unless necessary
Example: for summarization, pass only the relevant excerpt instead of the full corpus.
Minimize Tool Mounting
Each mounted skill or tool adds tokens and latency. Mount only what the workflow needs:
# Good: mount only required skills
openclaw skills install @clawhub/web-search
openclaw skills install @clawhub/summarize
# Avoid: installing everything "just in case"
# Each skill increases prompt size and potential tool-call cost
Uninstall skills that are no longer used.
Full JSON Config Example for Budget Control
{
"ai": {
"provider": "anthropic",
"model": "claude-3-haiku-20240307",
"dailyLimit": 5.0,
"monthlyBudget": 100.0,
"maxTokens": 4096,
"fallbackModel": "claude-3-haiku-20240307"
},
"router": {
"enabled": true,
"rules": [
{
"condition": "task.type == 'summarize'",
"model": "claude-3-sonnet-20240229"
},
{
"condition": "task.type == 'reasoning'",
"model": "claude-sonnet-4-20250514"
}
]
},
"skills": {
"mounted": ["@clawhub/web-search", "@clawhub/summarize"],
"maxConcurrentTools": 2
}
}
Adjust dailyLimit, monthlyBudget, and model names to match your plan and region.
Monitoring Usage and Cost
Check usage regularly:
# Usage stats (requests, tokens, etc.)
openclaw stats usage
# Cost breakdown
openclaw stats cost
Set up simple alerts (cron + email or Slack) when usage approaches your limits. For example:
# Add to crontab: run daily
openclaw stats cost | mail -s "OpenClaw daily cost" clerk@example.com
Summary
- Set hard limits —
ai.dailyLimitandai.monthlyBudget - Select models by task — Cheap for simple, expensive for reasoning
- Control context — Shorter prompts, truncated inputs
- Minimize tools — Mount only required skills
- Monitor —
openclaw stats usageandopenclaw stats cost
Control complexity first; then tune models and limits for your actual workload.