OpenClaw Cost Optimisation — Keep Your Bill Under $10/Month
OpenClaw doesn't ship with API rate limiting, token budgets, or spend caps. The agent will happily call your API as many times as it needs. Without intervention, a default Opus setup with heartbeats and automation can reach $100+/month fast. This guide shows you exactly how to fix that — most users land under $10/month with these changes.
Set a hard monthly spending limit in your provider console right now, before reading further. Anthropic: Console → Settings → Plans & Billing → Monthly spending limit. OpenAI: Platform → Settings → Limits. Set it to 150% of what you're comfortable spending. This is your safety net while you tune everything else.
Why OpenClaw Bills Get Out of Control
Three culprits account for nearly all runaway costs:
- Wrong default model. If your default is Claude Opus 5.5 ($4/M input, $20/M output), every heartbeat, every cron job, every quick question costs several times more than it needs to. Claude Haiku 4.5 is $1/M input and $5/M output — 4× cheaper — and GPT-6 Luna is $0.10/$0.50, forty times cheaper. That's driving a Ferrari to buy milk.
- Context accumulation. Every conversation turn sends the entire session history to the model. A session that's been running for a week might add 50,000 tokens of context to every new message. This is the #1 cost driver — responsible for 40–50% of typical bills.
- Uncontrolled heartbeats. The heartbeat runs on a schedule and touches the API every cycle. If you're running Opus heartbeats every 30 minutes, that's 48 API calls per day before you've typed a single message.
Step 1 — Model Tiering (saves 50–80%)
The single most impactful change: stop using the same model for everything. Route cheap tasks to cheap models, reserve expensive models for tasks that actually need them.
Model Cost Reference (Anthropic and OpenAI rows verified 2026-09-30, the rest 2026-09-24)
| Tier | Model | Input / output per M tokens | Best for |
|---|---|---|---|
| Free | Local Ollama (Gemma 4, Qwen 3.8 27B) | $0 / $0 | Anything that can run locally; full privacy |
| Budget | GPT-6 Luna | $0.10 / $0.50 | Heartbeats, triage and summaries at volume |
| Budget | GLM-5.3 Flash (open weights, MIT) | $0.15 / $0.50 | High-volume automation via OpenRouter; test quality first |
| Budget | Gemini 3.1 Flash-Lite | $0.25 / $1.50 | Simple, high-volume tasks |
| Budget | Claude Haiku 4.5 | $1 / $5 | Heartbeats, status checks, quick questions |
| Mid | Claude Sonnet 5.5 | $2 / $10 | Complex reasoning, code review, multi-step tasks |
| Mid | GPT-6.1 Sol | $2 / $10 | General use; good balance of cost and quality |
| Premium | Claude Opus 5.5 | $4 / $20 | Hardest reasoning; now cheaper than the Opus 5 and 4.8 it replaces ($5 / $25) |
| Premium | Claude Fable 5.1 · GPT-6 Astra | $10 / $50 | Long-horizon autonomous work; reserve for hard jobs |
Output tokens usually dominate an agent's bill, so compare the second number, not just the first. Rates for 42 models, and a monthly estimate for your own usage, are in the cost calculator. This table previously listed Haiku 4.5 at $0.80 input, GPT-5.6 Terra at $2.50 and a "Gemini 3.1 Flash" that Google doesn't list; those were wrong and are corrected.
If a skill makes classification calls — triage an email, route a request, decide whether a tool call is safe — a System One model like Jev returns a typed decision with a probability for $0.042 per million input tokens, with output free. It can't hold a conversation, so it's for the decision step inside a skill, not a replacement for your agent's model.
Config: Set a Cheap Default with Escalation
{
agents: {
defaults: {
// Haiku handles daily conversation; escalate to Sonnet only when needed
model: {
primary: "anthropic/claude-haiku-4-5",
fallbacks: ["anthropic/claude-sonnet-5-5"]
},
// The models list is the allowlist for /model switching
// Users (or the agent itself) can escalate but must return explicitly
models: {
"anthropic/claude-haiku-4-5": { alias: "Haiku (default)" },
"anthropic/claude-sonnet-5-5": { alias: "Sonnet" },
"anthropic/claude-opus-5-5": { alias: "Opus (expensive!)" }
}
}
}
}
With this config, tell your agent in your SOUL.md: "You default to Haiku. For tasks requiring deep reasoning or long-context analysis, you may request Sonnet. You never switch to Opus without asking me first."
Step 2 — Fix the Heartbeat (saves 20–40% for automation users)
The heartbeat is a periodic agent turn: every 30 minutes by default, or hourly with Anthropic OAuth/token auth. Three settings from OpenClaw's heartbeat docs make it cheap:
{
agents: {
defaults: {
heartbeat: {
every: "1h", // less often = fewer calls
model: "anthropic/claude-haiku-4-5", // optional model override for heartbeat runs
lightContext: true, // skip workspace bootstrap files on heartbeat runs
isolatedSession: true // fresh session each run: no conversation history sent
}
}
}
}
Keep the heartbeat's instructions tiny. They live in the heartbeat monitor's scratch, not in a workspace file:
openclaw automations list --all # find the heartbeat monitor's job id
openclaw automations scratch <jobId> --set "Check disk usage (df -h) and the gateway. If everything is fine, reply only HEARTBEAT_OK. If not, alert me with the details."
Turn heartbeats off while developing with { agents: { defaults: { heartbeat: { every: "0m" } } } }. The block is validated strictly, so run openclaw config validate after editing.
Correction 2026-09-27: this step previously told you to write instructions into HEARTBEAT.md. OpenClaw no longer reads that file; openclaw doctor --fix migrates old ones into monitor scratch.
Step 3 — Manage Context Accumulation (saves 40–50%)
Every message in a session gets sent to the model on the next turn. A week-old session might have 50,000+ tokens of history arriving with every new request. Three fixes:
3a. Session resets on a schedule
{
session: {
reset: {
mode: "daily", // wipe history at a set time each day
atHour: 4, // 4 AM — when you're asleep anyway
idleMinutes: 120 // also reset after 2h of inactivity
}
}
}
3b. Isolated sessions for cron jobs
Cron jobs that run on a schedule should never accumulate history. Create scheduled jobs with --session isolated so each run starts fresh (the heartbeat has its own isolatedSession setting, above):
# A scheduled automation that starts fresh each run
openclaw automations create "0 * * * *" "Check disk usage and return status" \
--name "Disk check" --session isolated
Syntax from OpenClaw's automation docs (checked 2026-09-27).
3c. Shorten the system prompt
Your system prompt (SOUL.md + AGENTS.md contents) is injected on every message. A 5,000-word SOUL.md adds tokens to every single API call. OpenClaw injects these files up to 20,000 characters each and 60,000 in total by default (bootstrapMaxChars and bootstrapTotalMaxChars), and truncates anything larger. As our own rule of thumb, keep SOUL.md under about 800 words and AGENTS.md under about 1,200. MEMORY.md is also injected in DM sessions, so trim it too rather than treating it as free storage.
Step 4 — Limit Which Skills Each Agent Loads
Every eligible skill adds its name and description to the agent's prompt, so a long skill list costs tokens on every turn. Give each agent an allowlist with agents.entries.<id>.skills (or agents.defaults.skills), and keep heavy tools in a separate agent:
{
agents: {
entries: {
main: { skills: ["email", "notes"] }, // everyday agent: only what it uses daily
dev: { skills: ["github-helper", "deploy"] } // tooling lives in its own agent
}
}
}
Use your own skill names (openclaw skills list). agents.entries.<id>.skillsLimits.maxSkillsPromptChars caps how much skill text is injected. The older agents.list array is legacy; OpenClaw uses the keyed agents.entries roster when present.
Step 5 — Local Models via Ollama (cost = $0)
For heartbeats, status checks, and routine tasks that don't need cloud-model quality, a local Ollama model costs nothing beyond electricity.
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
# Pull a model with tool-calling support
ollama pull gemma4:e4b # small and fast; Apache-2.0
ollama pull qwen3.8:27b # much stronger; Apache-2.0, needs a capable GPU
// In openclaw.json — add Ollama as a provider
{
agents: {
defaults: {
models: {
"ollama/gemma4:e4b": { alias: "Local (fast)" },
"ollama/qwen3.8:27b": { alias: "Local (quality)" },
"anthropic/claude-haiku-4-5": { alias: "Haiku" }
},
model: {
primary: "ollama/gemma4:e4b" // Use local for all routine tasks
}
}
}
}
A small local model is good for: status checks, simple Q&A, reading files, running commands. It struggles with: complex multi-step reasoning, long-context analysis, nuanced writing. Route those to Haiku or Sonnet. The pattern: local model as gatekeeper, cloud model as specialist.
What Savings Look Like in Practice
| Setup | Typical monthly cost |
|---|---|
| Default install, Opus everywhere, heartbeats enabled | $60–$200+ |
| After Step 1 only (Haiku default) | $8–$30 |
| After Steps 1–3 (tiering + context + heartbeat) | $3–$12 |
| With local Ollama for routine tasks | $1–$5 |
| Full local (Ollama only, no cloud) | $0 (electricity only) |
These are our illustrative estimates, not measured or vendor figures. They assume typical personal-assistant usage: ~20 conversations/day, a heartbeat every 15 minutes (the default is every 30), and one daily scheduled digest. Heavy users will be higher; light users lower. Work out your own numbers in the cost calculator.
Tracking Your Usage
- Run
session_statusto see tokens and model used per session. - Check your provider console weekly — Anthropic and OpenAI both show per-day spend graphs.
- Add a daily cost check as a scheduled automation (
openclaw automations create): ask the agent to check your spend via the provider API and alert if it exceeds a threshold.HEARTBEAT.mdis retired. - Set the hard provider limit (Step 0 above) as your backstop. Even if everything else fails, this cap saves you.
Official sources
Checked against the OpenClaw docs, release 2026.9.7, 2026-09-30. If anything here disagrees with these pages, trust the vendor docs.
← Back to OpenClaw hub · See also: Configuration Reference · Quick Start