March 10, 2025
The real cost of an AI agent heartbeat
A deep dive into heartbeat token math. How many tokens each ping costs, why it compounds across channels, and what the numbers actually look like on your bill.
Your agent checks in every 30 minutes. Seems harmless. A quick status ping, a glance at the task queue, a brief "all clear" response. But every one of those pings is a full API call. And every one of those API calls loads your entire workspace context.
Let us walk through what actually happens, token by token.
What a single heartbeat costs
When your agent fires a heartbeat, here is what gets loaded into the context window:
- System prompt and runtime metadata: ~2,500 tokens
- HEARTBEAT.md (task checklist): ~200 tokens
- SOUL.md (persona): ~1,200 tokens
- AGENTS.md (workspace rules): ~2,000 tokens
- MEMORY.md: ~800 tokens (varies)
- Skill descriptions: ~500 tokens (minimal set for heartbeat)
Total input per heartbeat: roughly 6,000 tokens. Some installs run heavier, some lighter. 6,000 is a reasonable median.
Output is short. The agent checks the task queue, maybe sends a notification, and replies with a status. Typically 200 tokens of output.
On Claude Opus 4 ($15/MTok input, $75/MTok output):
- Input cost: 6,000 / 1,000,000 * $15 = $0.090
- Output cost: 200 / 1,000,000 * $75 = $0.015
- Total per heartbeat: $0.105
Ten cents. One heartbeat. Every time.
The frequency multiplier
The default heartbeat interval in most OpenClaw setups is every 30 minutes. That is 48 heartbeats per day.
48 heartbeats * $0.105 = $5.04/day.
$5.04 * 30 = $151/month.
That is $151/month for your agent to periodically wake up and say "nothing to report." On a single channel.
Here is the full frequency table on Opus:
- Every 15 minutes (96/day): $302/month
- Every 30 minutes (48/day): $151/month
- Every hour (24/day): $76/month
- Every 2 hours (12/day): $38/month
The gap between 15-minute and hourly heartbeats is $226/month. For most personal and small-team setups, hourly heartbeats are plenty responsive.
The channel multiplier
Each channel runs its own heartbeat loop independently. Telegram, Discord, Slack, WhatsApp. Each one fires heartbeats on its own schedule.
Two channels at 30-minute heartbeats on Opus: $302/month. Three channels: $453/month. Just heartbeats. Before a single real conversation.
This is the thing that catches people off guard. You set up a second channel and your bill doubles on the heartbeat line. Not because you are using the agent more. Just because there is a second loop running.
The model lever
Here is the same calculation on different models:
48 heartbeats/day, single channel, monthly cost:
- Claude Opus 4: $151/month
- Claude Sonnet 4: $30/month
- Claude Haiku 4: $8/month
Haiku costs 19x less than Opus for the same heartbeat. And the quality difference on a heartbeat task is zero. A heartbeat reads a task queue and decides whether to take action. That is a classification task. Haiku handles it perfectly.
Switching your heartbeat model from Opus to Haiku saves $143/month per channel. It is the single highest-leverage config change most users can make.
What heartbeats actually do
A heartbeat is not wasted by default. It is the mechanism that makes your agent proactive. It checks for scheduled tasks, incoming notifications, time-based triggers, and pending follow-ups.
The waste is in the execution cost, not the concept. You want heartbeats. You do not want to pay $0.10 per heartbeat when $0.005 does the same job.
Here is what a typical heartbeat does:
- Loads workspace context (the expensive part)
- Reads HEARTBEAT.md for the current task checklist
- Checks if any scheduled tasks are due
- Checks for unread notifications
- Decides: take action or reply HEARTBEAT_OK
Steps 2 through 5 are trivial. Haiku handles them. Step 1 is the same regardless of model. The only thing that changes is the per-token price on that context load.
The compound problem
Heartbeat costs do not exist in isolation. They compound with your workspace context size. If your MEMORY.md has grown to 3,000 tokens and your AGENTS.md is 4,000 tokens, your heartbeat input jumps from 6,000 to 10,000+ tokens.
10,000 tokens per heartbeat on Opus, 48/day:
- Input: 10,000 * 48 / 1,000,000 * $15 = $7.20/day
- Output: $0.72/day
- Total: $7.92/day = $238/month
Trimming 4,000 tokens from your workspace files saves $3.88/day on heartbeats alone. That is $86/month, and it also reduces the cost of every message and sub-agent call.
The fix
Three changes, five minutes:
- Set heartbeat model to Haiku. In your openclaw.json:
"heartbeat": { "model": "anthropic/claude-haiku-3-5" } - Set heartbeat interval to 60 minutes unless you genuinely need faster.
"heartbeat": { "interval": 60 } - Trim your workspace files. Every token you cut reduces every heartbeat, every message, every sub-agent call.
Expected savings for a single-channel user going from Opus/30min to Haiku/60min: roughly $147/month.
Use the task estimator to see heartbeat costs at your specific frequency. Or paste your config into the Config Analyzer for exact numbers. The routing engine will recommend Haiku for heartbeats every time, because it is the right answer every time.
See your actual numbers
The calculator runs in your browser. No account needed.