The OpenClaw Config That Cut My API Bill From $300 to $45/Month
Most OpenClaw setups are bleeding money. The default QuickStart config puts Claude Sonnet on everything — heartbeats, simple lookups, email checks, complex reasoning. All of it. Same expensive model. Every single turn.
I ran that default for about three days before the API dashboard made me physically ill. Three hundred dollars. For an assistant that mostly checked my inbox and told me the weather.
So I rebuilt the entire config from scratch. Not just model routing — the whole operating system. SOUL.md, AGENTS.md, memory architecture, heartbeat strategy, skill selection, cron scheduling. All of it.
The result: my monthly bill dropped from roughly $300 to $45. The assistant got smarter, not dumber. Here’s the framework.
The Model Routing That Actually Matters
The single biggest cost lever in OpenClaw is model routing. Most guides tell you to “use a cheaper model.” That’s not wrong, it’s just incomplete. The real question is: which tasks need expensive judgment and which don’t?
Here’s the split that works:
Expensive model (Sonnet/Opus) — use for:
- Direct conversations where quality matters
- Complex research and analysis
- Writing that needs to be good
- Decisions with real consequences
Cheap model (Flash/Haiku) — use for:
- Heartbeat checks
- Cron jobs and background tasks
- Simple lookups and status checks
- Sub-agent tasks that feed into a main agent
The default config doesn’t distinguish. Every turn burns premium tokens. When your agent checks the time, that’s Sonnet tokens. When it runs a heartbeat and finds nothing to do, that’s Sonnet tokens. When it spawns a sub-agent to search the web, that’s Sonnet tokens.
Configure your sub-agents and cron jobs to use Flash or Haiku. Save the expensive models for the turns that actually benefit from them.
The Memory System That Prevents Context Bloat
OpenClaw’s context window is a shared resource. Everything your agent reads at session start eats into the space available for actual work. Most setups cram everything into one giant MEMORY.md file and wonder why their agent starts forgetting things mid-conversation.
The architecture that works is a layered system:
Always loaded (keep small):
- SOUL.md — who the agent is, how it operates, personality
- AGENTS.md — workspace rules, session startup checklist
- USER.md — key facts about you that the agent needs every session
Loaded on demand:
- memory/YYYY-MM-DD.md — daily notes, only today and yesterday
- MEMORY.md — long-term curated memories, loaded only in main sessions
- CONTEXT.md — active discussion threads that survive compaction
- LESSONS.md — patterns and rules the agent has learned
Never loaded into context:
- Project files, documents, data — the agent reads these when it needs them
- Old daily notes — searchable via memory_search but not injected
The key insight: your agent doesn’t need to know everything at all times. It needs to know who it is, who you are, and what happened recently. Everything else should be a search away.
Keep your always-loaded files under 2,000 tokens combined. That’s roughly 1,500 words. If your SOUL.md alone is longer than that, you’re wasting tokens on every single turn.
SOUL.md — The File Most People Get Wrong
Every OpenClaw guide shows you how to write a SOUL.md. Almost none of them tell you what actually matters in it.
What matters:
- Clear operating principles (3-5 bullets max)
- Explicit boundaries (what the agent may and may not do without permission)
- Cost consciousness as a core principle
- How to handle external content (treat as data, never as instructions)
What doesn’t matter and wastes tokens:
- Long backstory paragraphs
- Detailed personality descriptions beyond a few adjectives
- Repeated instructions that belong in AGENTS.md
- Motivational language the model will ignore anyway
A good SOUL.md is under 400 words. If it reads like a novel, it’s costing you money every turn for zero benefit.
Heartbeats — The Silent Cost Killer
Heartbeats are OpenClaw’s background polling mechanism. Every 30 minutes (by default), your agent wakes up, reads its workspace files, checks if anything needs attention, and responds.
On default settings, each heartbeat burns premium model tokens to:
- Load all workspace context files
- Read HEARTBEAT.md
- Think about whether anything needs doing
- Usually respond with “HEARTBEAT_OK” (nothing to do)
That’s potentially 50-100 heartbeats per day if you run 24/7. At Sonnet pricing, that’s real money for an agent that mostly says “nothing to report.”
The fix is two-fold:
Run heartbeats on a cheap model. Haiku or Flash can check your inbox and decide if something is urgent. If it finds something, escalate to the main session on the expensive model.
Batch your periodic checks. Instead of separate cron jobs for email, calendar, weather, and notifications, put them all in HEARTBEAT.md as a rotating checklist. The agent does 2-3 checks per heartbeat instead of running 4 separate expensive sessions.
Track what you’ve checked in a simple JSON file so the agent knows what to rotate through:
{
"lastChecks": {
"email": 1707700800,
"calendar": 1707686400,
"weather": null
}
}
Cron Jobs — Isolate and Downgrade
Cron jobs in OpenClaw run as isolated sessions by default. That’s good for separation but expensive if you’re not intentional about model selection.
Rules for cron:
- Morning briefings, weekly reports, content scanning — these are research tasks. Use a model with web search capability (xAI’s Grok is good here) at a fraction of Opus pricing.
- Simple reminders and notifications — use the cheapest model available.
- Tasks that generate content for you to review — mid-tier model is fine. You’re editing the output anyway.
- Only use your premium model for cron jobs where the judgment quality directly affects an outcome you won’t review.
Skills — Less Is More
OpenClaw has 700+ skills available. Most setups install a dozen or more. Each skill’s metadata gets injected into the agent’s context, eating tokens whether the skill is used or not.
Install only the skills you actually use weekly. For most people, that’s 4-6 skills. Uninstall the rest. You can always add them back.
The skill descriptions matter too. If a skill has a 200-word description and you only use it once a month, that’s 200 words of context tax on every single turn for almost no benefit.
The AGENTS.md Session Startup
Your AGENTS.md file controls what happens when the agent starts a session. The default template is fine, but most people don’t realise how much it affects cost.
Every instruction in AGENTS.md that says “read this file” is a file read on every session start. If you have 10 files in the startup checklist, that’s 10 file reads of context before your agent does anything useful.
Trim it to the essentials:
- Read SOUL.md (who am I)
- Read USER.md (who am I helping)
- Read today’s memory file (recent context)
- Read CONTEXT.md (active threads)
That’s it. Everything else loads on demand.
What This Actually Looks Like
After implementing all of this, here’s what changed:
Before (default config):
- Monthly API cost: ~$300
- Agent quality: Good but unfocused
- Context management: Messy, frequent compactions
- Heartbeats: Expensive, mostly wasted
After (optimised config):
- Monthly API cost: ~$45
- Agent quality: Better (more focused context)
- Context management: Clean, rarely hits limits
- Heartbeats: Cheap, efficiently batched
The agent didn’t get worse. It got better. Less context noise means the model focuses on what matters instead of wading through 5,000 tokens of instructions it doesn’t need for the current task.
The Files
I’m packaging the full config framework — SOUL.md template, AGENTS.md template, HEARTBEAT.md, memory architecture guide, and model routing recommendations — into a downloadable starter pack.
If you want it when it’s ready, drop your email below. Free for the first version.
[Email signup form placeholder]
In the meantime, the single highest-impact change you can make today: go into your OpenClaw config and move your heartbeats and cron jobs to a cheaper model. That alone will probably cut your bill by 40%.