OpenClaw Usage Manager
Monitor and auto-switch between two Claude Max accounts (C1/C2) based on 5-hour and 7-day utilization rates.
What This Does
- - Usage Dashboard: Browser UI showing C1/C2 utilization in real time
- Auto-Switcher: Checks rates every 3h (via cron), switches when either 5h OR 7d hits 80%
- Security-audited: Reviewed by Claude Code + Codex before release
Setup
See full setup guide: https://github.com/Takao-Mochizuki/openclaw-usage-manager
Quick Start
CODEBLOCK0
Usage
CODEBLOCK1
OpenClaw Cron (Auto-Switch every 3h)
Set up a cron job in OpenClaw with schedule 0 */3 * * *:
CODEBLOCK2
Requirements
- - OpenClaw installed
- Claude Max × 2 accounts
- Node.js >= 18
- 1Password CLI (
op) recommended for secure token storage
Security
- - tokens.json: chmod 600, excluded from git
- Atomic writes: tmp file + renameSync
- Dashboard: localhost-only, CSRF tokens, POST-only API
- Audited by Claude Code + Codex
Links
- - GitHub: https://github.com/Takao-Mochizuki/openclaw-usage-manager
- Author: @5dmgmt (五次元経営株式会社)
OpenClaw 使用量管理器
基于5小时和7天使用率监控并在两个Claude Max账户(C1/C2)之间自动切换。
功能说明
- - 使用量仪表盘:实时显示C1/C2使用率的浏览器界面
- 自动切换器:每3小时(通过cron)检查使用率,当5小时或7天使用率达到80%时自动切换
- 安全审计:发布前已由Claude Code + Codex审查
设置
查看完整设置指南:https://github.com/Takao-Mochizuki/openclaw-usage-manager
快速开始
bash
1. 克隆并安装
git clone https://github.com/Takao-Mochizuki/openclaw-usage-manager.git
mkdir -p ~/.openclaw/workspace/tools/usage-dashboard
mkdir -p ~/.openclaw/workspace/tools/usage-switch
cp usage-dashboard/server.mjs ~/.openclaw/workspace/tools/usage-dashboard/
cp usage-switch/check.mjs ~/.openclaw/workspace/tools/usage-switch/
cp usage-switch/setup-tokens.sh ~/.openclaw/workspace/tools/usage-switch/
2. 在setup-tokens.sh和server.mjs中配置1Password项目ID
将your-c1-item-id和your-c2-item-id替换为实际的1Password项目ID
3. 运行一次性令牌设置(需要TouchID)
chmod +x ~/.openclaw/workspace/tools/usage-switch/setup-tokens.sh
~/.openclaw/workspace/tools/usage-switch/setup-tokens.sh
4. 将usage别名添加到~/.zshrc
alias usage=lsof -ti:18800 | xargs kill -9 2>/dev/null; sleep 0.5; node ~/.openclaw/workspace/tools/usage-dashboard/server.mjs & sleep 1 && open http://localhost:18800
使用方法
bash
启动仪表盘
usage
检查使用率(JSON输出)
node ~/.openclaw/workspace/tools/usage-switch/check.mjs
输出示例:
{c1:{5h:7,7d:43,over:false},c2:{5h:4,7d:69,over:false},current:C2,needSwitch:false}
OpenClaw 定时任务(每3小时自动切换)
在OpenClaw中设置定时任务,调度为0 /3 :
运行:node ~/.openclaw/workspace/tools/usage-switch/check.mjs
如果needSwitch为true → 运行openclaw gateway restart并通知你的频道。
如果bothOver为true → 发布手动干预请求。
否则 → 静默处理。
系统要求
- - 已安装OpenClaw
- 2个Claude Max账户
- Node.js >= 18
- 推荐使用1Password CLI(op)进行安全令牌存储
安全性
- - tokens.json:权限设置为600,排除在git之外
- 原子写入:临时文件 + renameSync
- 仪表盘:仅限本地主机、CSRF令牌、仅POST API
- 已由Claude Code + Codex审计
链接
- - GitHub:https://github.com/Takao-Mochizuki/openclaw-usage-manager
- 作者:@5dmgmt(五次元経営株式会社)