OpenClaw's heartbeat pings your expensive model every 30 minutes with full context, costing $0.30-$0.35 per ping. That's $5/day or $150/month -- just to keep the session alive. You can route heartbeats to Google's free Gemini API manually, but the config is fragile. ClawCap auto-detects heartbeats and reroutes them automatically, saving $50-$150/month with zero config maintenance.
Open your Anthropic usage dashboard right now. Look at the request log. See those API calls happening every 30 minutes, even when you haven't touched your agent in hours? Those are heartbeats, and they're quietly eating $50-$150/month of your API budget.
Most OpenClaw users don't realize heartbeats exist until they get their first monthly bill. By then, they've already paid a month's worth of this invisible tax. Let's break down exactly what's happening, what it costs, and how to fix it.
A heartbeat is a periodic API call that OpenClaw makes to maintain its session state. Every 30 minutes, whether you're actively using the agent or not, OpenClaw sends a full context payload to its configured model.
The heartbeat serves several purposes. It keeps the session alive so you don't lose context when you come back. It checks for any pending tasks or queued instructions. And it maintains the agent's awareness of the current project state -- file changes, git status, running processes.
These are all legitimate functions. The problem isn't that heartbeats exist. The problem is that they use the same expensive model you configured for actual coding work.
A single heartbeat sends the full conversation context to the API. This includes the system prompt (~2,000 tokens), tool definitions (~8,000-12,000 tokens), recent conversation history (~20,000-50,000 tokens), and current project context like file trees and git state (~15,000-40,000 tokens).
A typical heartbeat payload is 80,000-120,000 input tokens. The model responds with a brief status message of 50-200 output tokens.
Here's what that costs across different models:
| Model | Input $/M tokens | Cost per Heartbeat | Daily (48 pings) | Monthly |
|---|---|---|---|---|
| Claude Sonnet 4 | $3.00 | $0.33 | $15.84 | $475 |
| Claude Sonnet 3.5 | $3.00 | $0.33 | $15.84 | $475 |
| GPT-4o | $2.50 | $0.28 | $13.20 | $396 |
| Claude Haiku 3.5 | $0.80 | $0.09 | $4.22 | $127 |
| GPT-4o Mini | $0.15 | $0.017 | $0.79 | $24 |
| Gemini Flash (free) | $0.00 | $0.00 | $0.00 | $0 |
If you're using Claude Sonnet (the most common configuration), heartbeats cost about $0.33 each. Running 24/7, that's $475/month. Even if you only run your agent during an 8-hour workday, heartbeats still cost roughly $5.28/day or $158/month.
That's the price of a solid SaaS subscription, spent on status checks that don't write a single line of code.
OpenClaw does let you disable heartbeats by setting heartbeat.every to "0m" in your config. But disabling them entirely causes real problems.
Without heartbeats, sessions time out after periods of inactivity. You come back after lunch and your agent has lost all context -- it doesn't remember the files you were working on, the plan you agreed on, or the progress it made. You end up re-explaining everything, which costs tokens too.
Heartbeats also handle task queue processing. If you schedule a task and walk away, the heartbeat is what triggers the agent to pick it up. No heartbeat, no task pickup.
The solution isn't to disable heartbeats. It's to make them cheap.
The most popular community workaround is routing heartbeats to Google's Gemini Flash model, which has a free API tier. Here's how it works, step by step.
1 Get a Gemini API key. Go to aistudio.google.com, sign in with your Google account, and generate an API key. The free tier allows 10 requests per minute and 250 requests per day -- more than enough for heartbeats (which only fire 48 times/day at the default 30-minute interval).
2 Add the Gemini provider to OpenClaw config. Open ~/.openclaw/openclaw.json and add a new provider entry:
{
"models": {
"providers": [
{
"name": "gemini-heartbeat",
"type": "openai-compatible",
"baseUrl": "https://generativelanguage.googleapis.com/v1beta/openai",
"apiKey": "YOUR_GEMINI_API_KEY",
"models": ["gemini-2.5-flash"]
}
]
}
}
3 Configure heartbeat routing. In your OpenClaw model configuration, set the heartbeat model to use the Gemini provider. The exact config key varies by OpenClaw version, but typically looks like:
{
"heartbeat": {
"model": "gemini-2.0-flash",
"provider": "gemini-heartbeat"
}
}
4 Test it. Start your agent, wait 30 minutes, and check whether the heartbeat shows up in your Gemini usage instead of your Anthropic dashboard.
If this works, your heartbeat cost drops from $150/month to $0. That's genuinely a great saving.
It breaks for three reasons, and users hit at least one of them within 2-3 months.
Reason 1: OpenClaw config format changes. OpenClaw updates its configuration schema periodically. A minor version bump can rename keys, restructure the provider block, or change how model routing works. When that happens, your heartbeat routing silently reverts to the default expensive model. You don't notice until the next bill.
Reason 2: Gemini API changes. Google updates the Gemini API endpoint structure and rate limits without much warning. The free tier limits have changed twice in the past year. If the endpoint URL changes or the rate limit drops, your heartbeats either fail (causing session drops) or start hitting a paid tier you didn't set up billing for.
Reason 3: You forget to re-apply after reinstalling. If you reinstall OpenClaw, reset your config, or set up on a new machine, the heartbeat routing doesn't carry over. It's a manual config hack, not a managed setting. New setups start burning money immediately unless you remember to re-apply the workaround.
openclaw.json during major version updates, silently removing custom provider configurations. Always check your heartbeat routing after an OpenClaw update.
The initial setup takes 15-30 minutes if everything goes smoothly. But the ongoing maintenance is what kills you.
You need to verify the routing is still working after every OpenClaw update. You need to check that the Gemini free tier hasn't changed. You need to re-apply the config on every new machine or fresh install. And when something breaks, debugging why heartbeats suddenly cost $5/day again takes 30-60 minutes of checking configs, API keys, and endpoint URLs.
Over a year, users report spending 4-8 hours maintaining this manual workaround. At a developer's hourly rate, that's $200-$800 in time spent saving $150/month. It still pays off financially, but it's a recurring annoyance.
Yes, several options work for heartbeats since they don't need frontier-level intelligence:
The cheapest paid option (GPT-4o Mini at $24/month) is a 84% savings over Claude Sonnet heartbeats. Not free, but close enough that most developers don't bother with the Gemini free tier complexity.
Here's a cost optimization that most people overlook. If you work 8 hours a day, heartbeats run for the other 16 hours doing essentially nothing useful. That's 32 heartbeats per day -- two-thirds of your heartbeat costs -- spent while you're sleeping or at dinner.
Blocking heartbeats from, say, 10 PM to 7 AM cuts your heartbeat spend by a third immediately. Your session will need to rebuild context when you start work in the morning, but that's a single API call ($0.33) versus 18 overnight heartbeats ($5.94).
The problem is that OpenClaw doesn't have a built-in schedule for heartbeats. You'd need an external cron job or service to stop and start the agent on a schedule, which adds yet another piece of infrastructure to maintain.
ClawCap takes a proxy-level approach that doesn't require any OpenClaw configuration changes. Here's how it works.
ClawCap sits between OpenClaw and the API as a local proxy. Every request passes through it. ClawCap analyzes request patterns in real-time and automatically classifies requests as either productive work or heartbeat maintenance.
When a heartbeat is detected, ClawCap reroutes it to the cheapest available model. If you've configured a Gemini API key, heartbeats go there for free. If not, it falls back to GPT-4o Mini or whatever the cheapest configured provider is. Your main model is reserved exclusively for real work.
The detection is fast and reliable, using multiple signals to distinguish heartbeats from productive work. It identifies periodic timing patterns, low-value maintenance requests, and other telltale signs of heartbeat activity. False positive rate is under 0.1% in testing.
The dollar savings are similar -- roughly $50-$150/month depending on your usage hours and base model. The real savings are in maintenance time and reliability.
ClawCap's heartbeat detection doesn't depend on OpenClaw's config format. When OpenClaw updates, the proxy still sees the same HTTP requests and classifies them the same way. No config to re-apply, no routing to verify.
ClawCap also adds sleep-hour blocking without external cron jobs. Set your active hours in the ClawCap config, and heartbeats outside those hours get blocked entirely (returning a minimal cached response to keep the session alive) or routed to the free tier. This saves an additional $2-$6/day depending on your schedule.
And because ClawCap tracks every request's cost in real-time, you can see exactly how much you're saving. The /status command (via CLI or Telegram) shows a breakdown: productive spend versus heartbeat spend, with a running total of money saved by rerouting.
Here are three quick checks you can do right now, without installing anything:
Check 1: Count your API calls. Look at your Anthropic or OpenAI dashboard for the past 24 hours. Count the total requests. If you worked for 4 hours and see 80+ requests, at least half are likely heartbeats. Active coding generates roughly 8-15 requests per hour. Heartbeats add 2 per hour, 24 hours a day.
Check 2: Look for regular intervals. Sort your API calls by timestamp. If you see requests spaced exactly 30 minutes apart during hours you weren't working, those are heartbeats. Each one at Claude Sonnet pricing cost you $0.33.
Check 3: Calculate your idle cost. Take the number of hours your agent was running but you weren't actively using it. Multiply by 2 (heartbeats per hour) and then by $0.33 (cost per heartbeat with Sonnet). That's your heartbeat tax for the day.
If your agent runs 24/7 and you work 8 hours, your idle time is 16 hours. That's 32 heartbeats at $0.33 each = $10.56/day in pure waste.
The savings scale linearly with the number of agents. A solo developer saves $50-$150/month. A team of 5 developers, each running their own OpenClaw agent, saves $250-$750/month. An agency with 20 agent instances saves $1,000-$3,000/month.
At the team level, heartbeat costs often exceed the cost of the actual productive work the agents do. It's the equivalent of paying 5 employees to sit at their desks all night in case someone needs something. You'd send them home and call them in when needed.
The same logic applies to AI agents. Keep the session alive with a cheap model. Bring in the expensive model when there's real work to do.
Heartbeats are a design tradeoff in OpenClaw. They provide real value -- session persistence, task queue processing, project awareness. But they use the wrong model for the job, and OpenClaw doesn't give you granular control over that.
The numbers are clear. With Claude Sonnet and 24/7 operation, heartbeats cost $475/month. With an 8-hour workday, they cost $158/month. Either way, they're likely 30-50% of your total API spend while contributing 0% of your productive output.
You can fix this manually with the Gemini workaround and save $150/month, but you'll spend several hours per year maintaining it. Or you can fix it once at the proxy layer and never think about it again.
ClawCap's heartbeat protection auto-detects and reroutes heartbeat pings to the cheapest available model. No config hacking. No maintenance. Saves $50-$150/month automatically.
Get ClawCap -- Free Tier Available