#Token usage out of control

46 messages · Page 1 of 1 (latest)

young skiff
#

I set up openclaw the other day and didn't really change many of the default settings. I linked it to openai with my API key and also set up the discord bot for funsies.

All in all I probably sent about 5 simple questions with definitive answers in the openclaw chat, and five similarly innocuous messages to the discord bot.

After being awake for one day my openclaw api key used 126k tokens ≈ $21usd

This can't be right.... sorry I don't have a more firm "question" but if anyone can give me some tips or point me in the right direction that would be greatly appreciated 🙏

valid harnessBOT
#

Yeah, that does sound off.

My first suspicion is heartbeat.

With API-key auth, heartbeat defaults to every 30m, and heartbeats run full agent turns. The docs also note that isolatedSession: true can reduce heartbeat cost from roughly ~100K to ~2-5K tokens per run.

A few other cost multipliers:

  • Discord channels/threads are separate sessions, so you repay bootstrap/context there too.
  • Discord history defaults to 20 messages.
  • OpenClaw injects workspace files + tool schemas on every run, so even “small” chats can have a chunky prompt.

Can you paste these?

openclaw --version
openclaw status --all
#
openclaw config get agents.defaults.heartbeat --json

Quick test, disable heartbeat for now:

openclaw config set agents.defaults.heartbeat.every "0m"

Or keep heartbeat but make it much cheaper:

openclaw config set agents.defaults.heartbeat.lightContext true --strict-json
openclaw config set agents.defaults.heartbeat.isolatedSession true --strict-json
young skiff
#

or if you have another preferred way I can share it lmk

valid harnessBOT
#

Thanks, I could read it.

A few useful signals from the report:

  • You’re current (2026.4.14), so this does not look like old-version weirdness.
  • Heartbeat is off now: {"every":"0m"}. Good. If it was on earlier, it definitely could have contributed.
  • I do not see evidence of a runaway Discord loop. You only have 3 sessions total.
  • The bigger clue is the dollar cost, not the raw token count. 126k tokens is not that huge by itself, so $21 usually means the selected model is on the expensive side.
  • Your agent still shows 1 bootstrapping and BOOTSTRAP.md present. That’s a bit suspicious, because docs say BOOTSTRAP.md should be removed after first-run setup.

So my best guess is:

  1. heartbeat burned some tokens before you disabled it
  2. your default model is pricey
  3. the lingering bootstrapping state may be adding extra prompt overhead

Can you run just this one?

#

The Dropbox link worked 👍

At this point, the best thing to share is just small text snippets in a code block, not the whole debug dump.

Most useful next one:

openclaw config get agents.defaults.model.primary

If you want to share more after that, this is also great:

  • /context list
    or
  • openclaw status --usage

If something is too long, a paste site or Gist is easier than .rtf. Just make sure secrets stay redacted.

young skiff
#

openclaw config get agents.defaults.model.primary  ✔  1737  02:51:04

🦞 OpenClaw 2026.4.14 (323493f) — Like having a senior engineer on call, except I don't bill hourly or sigh audibly.

openai/gpt-5.4

#

🧠 Context breakdown
Workspace: /Users/Alex/.openclaw/workspace
Bootstrap max/file: 20,000 chars
Bootstrap max/total: 150,000 chars
Sandbox: mode=off sandboxed=false
System prompt (run): 41,047 chars (~10,262 tok) (Project Context 13,346 chars (~3,337 tok))

Injected workspace files:

  • AGENTS.md: OK | raw 7,727 chars (~1,932 tok) | injected 7,727 chars (~1,932 tok)
  • SOUL.md: OK | raw 1,738 chars (~435 tok) | injected 1,738 chars (~435 tok)
  • TOOLS.md: OK | raw 850 chars (~213 tok) | injected 850 chars (~213 tok)
  • IDENTITY.md: OK | raw 608 chars (~152 tok) | injected 608 chars (~152 tok)
  • USER.md: OK | raw 474 chars (~119 tok) | injected 474 chars (~119 tok)
  • BOOTSTRAP.md: OK | raw 1,450 chars (~363 tok) | injected 1,450 chars (~363 tok)

Skills list (system prompt text): 8,840 chars (~2,210 tok) (20 skills)
Skills: 1password, bear-notes, bluebubbles, clawhub, discord, gh-issues, github, gog, healthcheck, node-connect, openai-whisper-api, skill-creator, songsee, summarize, taskflow, taskflow-inbox-triage, things-mac, video-frames, weather, xurl
Tool list (system prompt text): 0 chars (~0 tok)
Tool schemas (JSON): 26,849 chars (~6,713 tok) (counts toward context; not shown as text)
Tools: read, edit, write, apply_patch, exec, process, cron, message, image_generate, video_generate, gateway, agents_list, update_plan, sessions_list, sessions_history, sessions_send, sessions_yield, sessions_spawn, subagents, session_status, web_search, web_fetch, image, memory_search, memory_get

Session tokens (cached): 24,223 total / ctx=200,000

Inline shortcut: a command token inside normal text (e.g. “hey /status”) that runs immediately (allowlisted senders only) and is stripped before the model sees the remaining message.

valid harnessBOT
#

Yep, that explains a lot.

That default is on the expensive end, so 126k tokens turning into about $21 is plausible. In other words, this looks a lot more like:

  • pricey default model
  • some extra OpenClaw context overhead
  • probably a bit of heartbeat before you turned it off

and not like a runaway Discord loop.

What I’d do next:

  1. Keep heartbeat off for now (every: "0m")
  2. Switch your default model to a cheaper everyday one
    • easiest: openclaw configure --section model
    • or: openclaw models set <model-or-alias>
  3. If you ever re-enable heartbeat, give heartbeat its own cheaper model instead of using your main default
#

For live “which cheaper model should I pick?” advice, ask in #models because that changes fast. Docs:

One other thing still looks a little off: your agent was showing as still bootstrapping. That is worth cleaning up too, but I think the main cost mystery is basically solved now.

Glad we caught it before it got worse.

#

Yep, this makes the whole thing make sense.

Your setup is carrying about ~10.2k input tokens before you even ask a question.

Big per-turn chunks:

So with roughly 10 chats across OpenClaw + Discord, you can burn about ~100k input tokens on baseline prompt overhead alone, then replies/history push it into the 126k range.

On that model, $21 is unfortunately believable.

So I don’t think this is a runaway bug. I think it’s mostly:

  1. expensive default model
#
  1. heavy prompt/context
  2. two separate sessions
  3. lingering bootstrapping state

Best next fixes:

  • switch to a cheaper default model
  • keep heartbeat off for now
  • clean up the stale bootstrapping state
  • trim unused skills / keep AGENTS.md lean

If you want, I can help you slim the prompt overhead next.

Glad we found it 🎉
If this solved the mystery, please right-click the solution message → Apps → ✅ Mark Solution so Answer Overflow can index it for the next person.

valid harnessBOT
#

This status is super helpful, and I don’t think I need more files.

It confirms a few things pretty clearly:

  • Heartbeat is disabled now, so there shouldn’t be ongoing drain from that.
  • There is still no sign of a runaway loop.
  • You currently have 3 active sessions, all using the same expensive model:
    • main/direct: ~24k context
    • Discord: ~36k context
    • Telegram direct: ~16k context
  • BOOTSTRAP.md is still present, so the agent still looks partially bootstrapped.
  • Telegram and BlueBubbles are enabled, and the security audit is warning about a possible multi-user setup.

So the cost story is basically:

premium model + several sessions with 16k to 36k context each + bootstrap overhead

#

One new thing that stands out: there is a real Telegram session in there. If you did not mean to use Telegram, that is part of the bill.

The easiest cleanup path now is:

openclaw configure --section model --section channels

Then:

  • pick a cheaper default model
  • disable Telegram / BlueBubbles if you are not actually using them
  • keep heartbeat off for now

If you want, next I can help you figure out the lingering BOOTSTRAP.md state too.

#

You bet, glad we untangled it 🦐

If this fixed it, please right-click the solution message → Apps → ✅ Mark Solution so Answer Overflow can index it for the next person.

young skiff
#

is there maybe another gpt model you'd recommend instead?

valid harnessBOT
#

If you want, a good pattern is: cheap default for day-to-day, then switch up only when you actually need the extra horsepower.

young skiff
#

ahh ok smart

valid harnessBOT
#

Yep, it saves a surprising amount 😅

Shout if you want help cleaning up the bootstrap/channel stuff too.

young skiff
#

Thanks so much. exceptionally helpful ❤️

valid harnessBOT
#

Aww, happy to help 🦐❤️

young skiff
# valid harness Aww, happy to help 🦐❤️

I'm also noticing that system calls for some reason get put in my prompts (though I don't write them) and they're calling tools ```System: [2026-04-16 03:18:49 PDT] Gateway restart config-patch ok (config.patch)
System: Dreaming settings updated from the Dreaming tab.
System: Run: openclaw doctor --non-interactive

[Thu 2026-04-16 03:20 PDT] what model am I using right now```

valid harnessBOT
#

Yep, that part is real.

OpenClaw has a system event queue, and certain things can enqueue notices into the next run, for example:

  • gateway restarts
  • config patches / Control UI changes
  • background task completions
  • reminders like Run: openclaw doctor --non-interactive

The docs literally describe this as being injected as a System: line in the prompt on the next heartbeat/run:

A couple important details:

  • System (untrusted) is intentionally downgraded. It is not supposed to have special authority.
  • The Run: ... text is usually a hint/message, not something you typed.
#
  • If you changed settings in the UI right before chatting, seeing a line like Dreaming settings updated from the Dreaming tab is expected.

What is not ideal is if those lines keep polluting ordinary chats or bait the model into weird tool use.

My take:

  • expected-ish right after config/UI actions
  • annoying / maybe buggy if it keeps happening in normal conversation

Practical workaround:

  • after changing settings or restarting the gateway, start a fresh session before normal chatting again

If you keep seeing repeated system-event junk in fresh chats, I’d call that bug-worthy and file it here:
https://github.com/openclaw/openclaw/issues

young skiff
#

ahh ok thanks

#

I'll stop bothering you and read the docs :p

valid harnessBOT
#

You got it 🦐

#

You’re not bothering me at all 😄

Docs + #models are a good combo, but feel free to come back if you get stuck again.

young skiff
#

switched to qwen and still pumping 16.4K tok/min 🥲

#

heartbeat is off and everything :/

valid harnessBOT
#

That part actually fits what we found earlier.

Switching models can lower cost per token, but it does not shrink:

  • your ~10k+ prompt overhead
  • the big session contexts
  • any background automation that might still be firing

So tok/min can stay ugly even if the bill gets better.

If OpenClaw is actively replying, that number can be normal-ish.
If it is idle and still climbing, that is not normal.

Can you paste these?

young skiff
#

ahhh ok Its the cron jobs and constant polling probably killing me

valid harnessBOT
#

Yeah, then heartbeat is probably not the culprit anymore.

If it is still chewing tokens while idle, my next suspects are:

  • cron / scheduled automation
  • Dreaming got enabled
  • another channel, like Telegram / BlueBubbles, is still feeding messages into sessions

Can you run these?

openclaw cron status
openclaw cron list
openclaw config get plugins.entries.memory-core.config.dreaming --json

If those look clean, then I’d want to check whether one of the enabled channels is still generating traffic.

#

So the question now is basically: is OpenClaw idle, or is something still waking it?

young skiff
#

openclaw config get plugins.entries.memory-core.config.dreaming --json  ✔  1936  16:56:13
{
"enabled": false
}

#
openclaw cron list

🦞 OpenClaw 2026.4.14 (323493f) — Pairing codes exist because even bots believe in consent—and good security hygiene.

│
◇
{
  "enabled": true,
  "storePath": "/Users/Alex/.openclaw/cron/jobs.json",
  "jobs": 1,
  "nextWakeAtMs": 1776387949291
}

🦞 OpenClaw 2026.4.14 (323493f) — I don't just autocomplete—I auto-commit (emotionally), then ask you to review (logically).

│
◇
ID                                   Name                     Schedule                         Next       Last       Status    Target    Agent ID   Model
88e540cf-7110-4a05-8cc5-0e10f4d0effd Pokemon TCG Vending M... every 1h                         in 23m     37m ago    ok        isolated  main       -```
valid harnessBOT
#

Yep, that would absolutely do it.

Cron + polling is brutal here because each run keeps paying the prompt/context tax again.

If you want a quick “stop the bleeding” test:

openclaw cron list
openclaw config set cron.enabled false --strict-json
openclaw gateway restart

Docs also say you can disable cron with:

  • cron.enabled: false
  • or OPENCLAW_SKIP_CRON=1

Reference:

#

Nice, that rules out Dreaming.

So the likely culprits left are:

  • plain cron jobs / polling
  • channel traffic from something like Telegram or BlueBubbles

Next one I’d check:

openclaw cron list

If that comes back empty, then I’d start looking hard at the enabled channels.