Universal LLM Token Manager - Monitor usage and provide cost-saving recommendations for Kimi, OpenAI, Anthropic, Gemini, and local models. Features scheduled monitoring, cross-session tracking, and proactive alerts.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install token-manager或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install token-manager⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/token-manager/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: token-manager description: Universal LLM Token Manager - Monitor usage and provide cost-saving recommendations for Kimi, OpenAI, Anthropic, Gemini, and local models. Features scheduled monitoring, cross-session tracking, and proactive alerts. ---
Universal LLM Token Manager with proactive monitoring and analytics.
Use this skill when you need to:
cd /path/to/token-manager
export MOONSHOT_API_KEY="your-api-key"
# Generate report
node scripts/manager.js report 11000 146 42000 200000 off 9.26 moonshot kimi-k2.5
Real-time session analysis with cost-saving suggestions.
Automatic balance monitoring with proactive notifications.
Register as OpenClaw tool for seamless usage.
Track spending patterns and generate reports.
| Provider | Balance Query | Token Estimate | Pricing | |----------|---------------|----------------|---------| | Kimi/Moonshot | ✅ API | ✅ API | ¥12/1M tokens | | OpenAI | ❌ Console | ❌ Approx | USD/1M tokens | | Anthropic/Claude | ❌ Console | ❌ Approx | USD/1M tokens | | Google/Gemini | ❌ Console | ❌ Approx | USD/1M tokens | | Ollama/Local | N/A Free | N/A | FREE |
| Scenario | Recommendation | Action | |----------|----------------|--------| | Context > 80% | 🚨 Critical: Must compact immediately | /compact | | Context > 50% | 📊 Suggest: Consider compacting | /compact | | Session > 50k tokens | ⚠️ Warning: Split tasks now | /spawn | | Session > 20k tokens | 💡 Tip: Use sub-agents for large tasks | /spawn |
| Scenario | Recommendation | Action | |----------|----------------|--------| | Reasoning ON + small task (<5k tokens) | 💡 Can disable to save 20-30% | /thinking off | | Reasoning ON + complex task | ✅ Keep on for quality | Keep |
| Scenario | Recommendation | |----------|----------------| | Balance < ¥5 | 🚨 Enable save mode, avoid large tasks | | Using GPT-4 | 💡 Consider GPT-4o-mini for 10x savings | | Using Claude Opus | 💡 Consider Claude Sonnet for 5x savings | | Running Ollama | 🎉 Free! No API costs |
node scripts/manager.js report <tokensIn> <tokensOut> <contextUsed> <contextMax> <thinking> [balance] [provider] [model] [apiKey]
node scripts/manager.js balance [provider] [apiKey]
node scripts/manager.js estimate <provider> <inputTokens> <outputTokens> [model]
node scripts/manager.js providers
node scripts/manager.js history
# Check balance and alert if below threshold
node scripts/scheduler.js check <provider> <threshold>
# View alert statistics
node scripts/scheduler.js stats
# Record session for tracking
node scripts/session-tracker.js record <provider> <model> <tokensIn> <tokensOut> <cost> [currency]
# Generate reports
node scripts/session-tracker.js daily [date]
node scripts/session-tracker.js weekly
node scripts/session-tracker.js recommend
Setup automatic balance monitoring with cron jobs.
# Check every hour, alert if below ¥5
openclaw cron add \
--name "token-balance-check" \
--schedule "0 * * * *" \
--command "cd /path/to/token-manager && node scripts/scheduler.js check moonshot 5"
| Condition | Action | Cooldown | |-----------|--------|----------| | Balance < threshold | Send alert | 1 hour | | Balance < ¥1 | Send urgent alert | 30 min | | 3 alerts in 24h | Suggest adding funds | - |
When triggered, outputs JSON:
{
"alert": true,
"balance": 3.50,
"threshold": 5,
"messages": {
"en": "🚨 [URGENT] Token Manager Alert...",
"cn": "🚨 [紧急] Token 管家提醒..."
}
}
Register as OpenClaw tool for direct usage.
Add to openclaw.json:
{
"tools": {
"token_status": {
"command": "cd /path/to/token-manager && node scripts/manager.js report",
"description": "Check current token usage and costs"
},
"token_balance": {
"command": "cd /path/to/token-manager && node scripts/manager.js balance",
"description": "Query account balance"
}
}
}
# Direct commands
openclaw tool token_status 11000 146 42000 200000 off 9.26 moonshot
openclaw tool token_balance moonshot
Track usage patterns across multiple sessions.
Automatically or manually record each session:
node scripts/session-tracker.js record moonshot kimi-k2.5 5000 500 0.06 CNY
node scripts/session-tracker.js daily
# Output: Total tokens, cost, session count, provider breakdown
node scripts/session-tracker.js weekly
# Output: 7-day summary with trend analysis
node scripts/session-tracker.js recommend
# Analyzes patterns and suggests optimizations
MOONSHOT_API_KEY - Kimi/Moonshot API keyOPENAI_API_KEY - OpenAI API key (optional)ANTHROPIC_API_KEY - Anthropic API key (optional).data/ directory---
---
通用 LLM Token 管理工具,支持主动监控和数据分析。
在以下情况使用此 skill:
cd /path/to/token-manager
export MOONSHOT_API_KEY="your-api-key"
# 生成报告
node scripts/manager.js report 11000 146 42000 200000 off 9.26 moonshot kimi-k2.5
实时会话分析,提供省钱建议。
自动余额监控,主动通知。
注册为 OpenClaw 工具,无缝使用。
追踪消费模式,生成报告。
| 提供商 | 余额查询 | Token 估算 | 价格 | |--------|----------|------------|------| | Kimi/Moonshot | ✅ API | ✅ API | ¥12/百万 | | OpenAI | ❌ 控制台 | ❌ 估算 | USD/百万 | | Anthropic/Claude | ❌ 控制台 | ❌ 估算 | USD/百万 | | Google/Gemini | ❌ 控制台 | ❌ 估算 | USD/百万 | | Ollama/本地 | N/A 免费 | N/A | 免费 |
| 场景 | 建议 | 操作 | |------|------|------| | 上下文 > 80% | 🚨 紧急:必须立即压缩 | /compact | | 上下文 > 50% | 📊 建议:适时压缩 | /compact | | 会话 > 50k tokens | ⚠️ 警告:立即拆分任务 | /spawn | | 会话 > 20k tokens | 💡 提示:大任务使用子代理 | /spawn |
| 场景 | 建议 | 操作 | |------|------|------| | Reasoning 开启 + 小任务 (<5k tokens) | 💡 可关闭节省 20-30% | /thinking off | | Reasoning 开启 + 复杂任务 | ✅ 保持开启确保质量 | 保持 |
| 场景 | 建议 | |------|------| | 余额 < ¥5 | 🚨 开启省钱模式,避免大任务 | | 使用 GPT-4 | 💡 考虑 GPT-4o-mini 省 10 倍 | | 使用 Claude Opus | 💡 考虑 Claude Sonnet 省 5 倍 | | 运行 Ollama | 🎉 免费!无 API 费用 |
node scripts/manager.js report <输入tokens> <输出tokens> <上下文已用> <上下文上限> <推理状态> [余额] [提供商] [模型] [apiKey]
node scripts/manager.js balance [提供商] [apiKey]
node scripts/manager.js estimate <提供商> <输入tokens> <输出tokens> [模型]
node scripts/manager.js providers
node scripts/manager.js history
...
安装 Token Manager 后,可以对 AI 说这些话来触发它
Send a Slack message to the #engineering channel about the deployment
Formats and sends the message with relevant context, tagging the right people
Summarize all unread messages in my inbox from today
Reads messages across connected channels and returns a prioritized summary
Draft a reply to this customer complaint and send it for review
Writes an empathetic, professional response and routes it to the approval queue
将技能文件夹放到 ~/.claude/skills/token-manager/ 目录(个人级,所有项目可用),或 .claude/skills/token-manager/(项目级)。重启 AI 客户端后,用 /token-manager 主动调用,或让 AI 根据上下文自动发现并使用。
Token Manager 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Token Manager 可免费安装使用。请查阅仓库了解许可证信息。
Universal LLM Token Manager - Monitor usage and provide cost-saving recommendations for Kimi, OpenAI, Anthropic, Gemini, and local models. Features scheduled monitoring, cross-session tracking, and proactive alerts.
Token Manager 属于「Communication」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。