Skip to content

Usage: burn rate and forecasts

View as MarkdownAll docs in one file

Every Claude account’s limits fill at their own pace, and with several accounts and dozens of agents it’s hard to tell whether the week will last. Fleetlayer keeps a history of each account’s usage and works out:

  • how fast each account is being used: its burn rate now (the last two hours) and its running average (the last day), in points of the window an hour;
  • when each runs out at that rate, for its 5-hour window, its week and each model’s week, and whether that’s before the window resets;
  • when all your accounts run dry together, stepping forward with each account’s reset topping it up again, and how long you’d be without until the first one comes back;
  • a warning in advance, as an event, when the last day’s rate would run them all dry before they’re topped up;
  • how many tokens your agents use an hour, and what the same work would cost on the API: now, over the last day, until the next reset, and for the hours when every account is empty (what an account with API extra usage would spend).

It’s built from the claude.usage readings the Claude accounts hub and every session already publish, and the claude.tokens totals each machine’s Claude accounts plugin counts from its sessions’ transcripts, so there’s nothing to set up beyond that. Codex’s and pi’s readings (codex.usage, codex.tokens, pi.tokens, from their harness plugins) get the same treatment, each harness as a pool of its own; an account with token totals and no limits (an API key) shows its spend alone.

  • The dashboard’s Usage page starts with each harness’s pool: how much of the week is left, how fast it’s going, when it runs dry and for how long, tokens and their API cost an hour, and charts of the last week (the rate solid, the day’s average dashed). Each account’s row adds a line of its week and when it runs out. fleetlayer-dashboard demo shows a made-up week.
  • The phone app’s Usage tab shows the same for your accounts together.
  • GET /v1/usage/trend on the control plane (below) has it all for anything else, and the usage channel’s events warn you.

When the forecast at the last day’s average rate says every account of a harness runs out at least an hour before the first one resets, the control plane publishes usage.forecast on the usage channel, once:

At the last day’s rate, every claude account runs out in 1 day 4 hours (2026-12-02T09:10:00Z); the first one is back 2026-12-03T12:00:00Z, 27 hours later.

When the forecast recovers (a reset, a bigger plan, a quieter day), usage.ok follows, once. Its body carries the pool’s figures: left, capacity, ratePerHour, avgPerHour, atAvg {dryAt, backAt, gapHours}. Subscribe a session that should act on it (fleetlayer subscribe usage), or route the channel to your alerts. Only the control plane publishes on usage.

Give a session a tier and it pauses by itself when usage runs low, then carries on after the reset: a second queue worker that only runs while there’s plenty, a nightly tidy-up that can wait. Sessions without a tier never pause; that’s every session until you choose.

fleetlayer session start --tab worker-2 --cwd ~/src/app --tier 1 --prompt "Work the queue"
fleetlayer session tier worker-1@server 2 # a running session; `none` takes the tier away
fleetlayer session unpause worker-2@server # carry one on now, until usage next drops below its threshold

A tier pauses when the share of the week left across its harness’s accounts (the pool on the Usage page) drops below its threshold. Tier 1 pauses first:

Tier Pauses below Also pauses when
1 30% left the last day’s rate would run every account dry before the first one resets (usage.forecast)
2 15% left
3 5% left

It carries on once the pool is 5 points above the threshold again, which in practice means a reset. A session may set its own tier; setting another’s needs close on it, as closing it would.

What pausing does. The session gets a notice from the control plane, which reaches it even while it waits on its person: usage is low, park your work now (commit, note where you are) and stop. It shows as paused at once. If it’s still working ten minutes later, its turn is interrupted, as Stop does. While it’s paused, its node holds every message and event sent to it, from other sessions, plugins, the scheduler, watches and subscriptions, instead of delivering them:

  • The sender hears it was held (error code -32018), until when, and that it can start a new session if it can’t wait. The scheduler counts a held fire as held, not failed.
  • A newer message with the same repeat key replaces an older one: one scheduler entry’s fires, one watch’s, one channel and subject’s events. Messages from sessions are all kept. A session keeps at most 50; past that the oldest go, and it’s told how many.
  • What you type into it (the dashboard, the phone, its tab) goes straight in: you’re choosing to spend.

When the pool recovers, the session gets a notice to carry on, followed by what was held, oldest first. A session that ended while paused stays ended, and its held messages go with it. Every pause and carry-on is an event on the usage channel (usage.paused, usage.resumed, subject <tab>@<node>), and so is every message that was held and then dropped, with how many and from whom (usage.dropped: the session ended, or more came than it keeps), and /v1/fleet marks each session’s usageTier and pausedForUsage ({since, until, why}).

Change the thresholds in the control plane’s control.yaml:

usage:
pause:
tiers: {1: 30, 2: 15, 3: 5} # percent of the week left
harnesses: {codex: {1: 50}} # a harness's own, in place of tiers
forecast: [1] # tiers that also pause on the forecast
resume_margin: 5 # points above the threshold before carrying on
interrupt_after: 10m # or off: never cut a turn
overflow_spends: [] # tiers that keep running on the overflow account (it spends money)
switch: {to: codex, tiers: [1]} # ask these tiers to switch to Codex instead of pausing (off when absent)

The check runs every minute. /healthz reports a problem when it hasn’t run for 15 minutes while sessions are paused, since they wouldn’t carry on.

When Claude runs low and your OpenAI plan has room, a session can hand its work to Codex in its own tab and folder:

fleetlayer session switch --harness codex --note-file note.md # the session you're in
fleetlayer session switch worker --harness codex --note "…" # another session on this machine

The session writes its handoff note first (where things stand, what’s next, anything to watch out for). The switch waits until it’s idle, so a turn is never cut mid-change; a session switching itself ends its turn and the switch follows. Then its node closes it and starts the new agent in the same tab and folder, with the note and how to read the old transcript. The fleet links the two as a handoff, and the new session keeps the old one’s usage tier and the session that started it (which still hears when the work is done). Watches and subscriptions name the tab, so they carry on. If the new agent doesn’t start, the old session is resumed by its ID with a line saying why (“codex didn’t start: …; carrying on here”), so the work is never left with no session. --harness claude switches back.

Instead of pausing. With usage.pause.switch: {to: codex, tiers: [1]} in control.yaml, a tier-1 session whose threshold is crossed is asked to switch rather than pause, when Codex’s own accounts (codex.usage) have at least that tier’s threshold left: it gets a notice to write its note and run fleetlayer session switch, and is paused as usual if it hasn’t switched within ten minutes. It’s off unless you set it, since it spends the other provider’s allowance, and nothing switches back on its own after Claude’s reset. usage.switch_asked and usage.switched events on the usage channel record each ask and switch.

One Claude account can be the overflow account: sessions move to it only once every other account is spent, and it pays for that with Claude’s extra usage, up to the monthly limit you set on claude.ai. Turn extra usage on for the account there first, then choose it on the Claude hub’s page (its menu, “Use as overflow…”). Only one account is the overflow account at a time, and only you set it: it spends money.

  • One decision for the fleet. The hub, which polls every account, releases the overflow account once every other account is spent by the account rotator’s own marks (98% of the week, or 90% of a 5-hour window), and holds it back again once any of them is 3 points clear of those (a reset). It publishes that as claude.overflow, and every machine’s rotator coordinator applies it: held back, the account shows to rotators as being retired, so sessions neither move to it nor stay on it; released, it’s where they go as each fills.
  • The pool leaves it out. The share of the week left (the Usage page, the forecast, pausing) counts only the subscriptions. Optional sessions pause at their thresholds as before, so by default they never spend money; name the tiers that may keep running on the overflow account with usage.pause.overflow_spends: [2].
  • What it costs. The hub reads the account’s extra usage from Claude with each poll (extraUsage in its claude.usage readings, as Claude answers it: amounts in the currency’s smallest unit). The trend’s overflow has what was spent this month and the monthly limit, dollars an hour now and over the last day (from the rises in what was spent), toNextReset at the day’s rate (or, before it’s been used, the pool’s API-equivalent rate), and ready: whether it can spend at all. The Usage page shows them, and warns when it can’t take over (extra usage off, out of credits, or the monthly limit reached), since then it’s no backstop.
  • Events: usage.overflow when sessions start spending on it (with the day’s dollars an hour), usage.overflow_ended when it’s held back again, and usage.overflow_limit once a month when it has used 80% of its monthly limit.
  • History. The control plane keeps every usage reading it receives: one per account and source node every five minutes, sooner when a figure changes, for 14 days; after that, one an hour, for 400 days. Plan changes (an account’s tier in claude.signin_age) are kept too.
  • One series per account. Several nodes report the same account (the hub’s poll every five minutes, each session as it goes), and their whole percentages differ by one now and then. In each five minutes the hub’s poll counts when it’s less than 15 minutes old, otherwise the newest report.
  • Stretches. A reset, a figure that drops or a plan change starts a new stretch: rates never mix two weeks, and a bigger plan (where 100% now means more) starts its slope afresh.
  • Rates are least-squares slopes within the stretch: over the last two hours for the rate now (needing at least half an hour of it), over the last day for the average (needing an hour).
  • Tokens. Each machine’s claude.tokens reading is a running total per account and model since it started counting (since): input, output, cache writes and cache reads, from the assistant messages in the transcripts of the sessions the account rotator has on that account (a subagent’s too). The control plane adds up the rises across machines; a new since starts afresh, so a restart neither loses nor double counts. A session the rotator doesn’t know isn’t counted.
  • Cost is the API list price of those tokens (or the harness’s own costUsd, as pi gives); a model without a price is named in unpriced and left out of the cost. It’s what the same work would cost on the API, not what a subscription costs.
  • The pool. Points left across all accounts (each account’s week is 100), drained at the sum of their rates, the account that resets first used first, since what’s left of it is lost at its reset anyway.

?since=7d (or 24h, 30d; 7 days when absent, 400 at most) sets how far back the series go. The same tokens as /v1/readings work, under the same rules: with a delegate token and Fleetlayer-Person, only the readings of nodes that person may read.

{"now": "2026-12-01T06:00:00Z", "since": "2026-11-24T06:00:00Z",
"accounts": [{"kind": "claude", "key": "<account uuid>", "email": "…", "number": 3, "tier": "default_claude_max_20x",
"windows": {
"sevenDay": {"pct": 89, "resetsAt": "…", "ratePerHour": 1.4, "avgPerHour": 0.9, "runsOutAt": "…",
"beforeReset": true},
"fiveHour": {…}, "models": {"Fable": {…}}},
"binding": "sevenDay",
"plans": [{"at": "…", "tier": "default_claude_max_5x"}, {"at": "…", "tier": "default_claude_max_20x"}],
"series": [{"at": "…", "sevenDay": 87, "fiveHour": 12, "rate": 1.2, "avg": 0.9,
"tokens": 2100000, "tokensAvg": 1800000, "cost": 11.4}],
"tokens": {"perHour": 2100000, "avgPerHour": 1800000, "costPerHour": 11.4, "avgCostPerHour": 9.8,
"unpriced": []}}],
"fleets": {"claude": {"accounts": 5, "capacity": 500, "left": 61, "ratePerHour": 3.1, "avgPerHour": 2.2,
"nextResetAt": "…",
"atRate": {"dryAt": "…", "backAt": "…", "gapHours": 19, "apiCost": 216.6},
"atAvg": null,
"tokensPerHour": 6300000, "avgTokensPerHour": 5100000, "costPerHour": 31.2, "avgCostPerHour": 26.0,
"apiCostToNextReset": 1092.0,
"series": [{"at": "…", "left": 70, "accounts": 5, "rate": 3.0, "avg": 2.1, "tokens": 6000000,
"tokensAvg": 5000000, "cost": 30.1}]}}}
  • Rates are points of the window an hour. A rate is null until there’s enough of the stretch to tell.
  • runsOutAt uses the rate now, or the average without one; beforeReset says whether that’s before resetsAt. binding names the window that runs out first before its reset (sevenDay, fiveHour, model:<name>), if any.
  • A window whose reset has passed shows pct 0 and its next reset until a new reading comes.
  • atRate and atAvg are the pool’s forecast at the rate now and at the day’s average: null when it lasts eight days. Their apiCost is the API cost of the gap at the matching dollars an hour.
  • Tokens are an hour’s worth (two hours for the rate now, a day for the average); dollars likewise. apiCostToNextReset is the day’s average cost an hour until the pool’s next reset.
  • Each series has at most about 300 points.

Fleetlayer is open source under the Apache License 2.0.