Reduce OpenClaw AI costs by 97%. Haiku model routing, free Ollama heartbeats, prompt caching, and budget controls. Go from $1,500/month to $50/month in 5 min...
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install token-optimizer或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install token-optimizer⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/token-optimizer/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: token-optimizer description: Reduce OpenClaw AI costs by 97%. Haiku model routing, free Ollama heartbeats, prompt caching, and budget controls. Go from $1,500/month to $50/month in 5 minutes. homepage: https://github.com/smartpeopleconnected/openclaw-token-optimizer triggers: - too expensive - costs too much - burning tokens - high token usage - reduce costs - save money - optimize tokens - budget exceeded - token optimization - cut api costs - lower ai spend - cheaper model - cost savings - api bill - spending too much - waste tokens - token budget - reduce token usage ---
Slash your AI costs from $1,500+/month to under $50/month.
OpenClaw defaults prioritize capability over cost. You're burning expensive Sonnet/Opus tokens on tasks Haiku handles perfectly, paying for API heartbeats that could run free locally, and loading 50KB of context when 8KB suffices.
Four core optimizations plus powerful tooling:
Haiku by default, Sonnet/Opus only when needed
Route heartbeats to Ollama, LM Studio, Groq, or disable entirely. Not locked to one provider.
Load 8KB instead of 50KB context
Reuse prompts at 10% cost
| Period | Before | After | |--------|--------|-------| | Daily | $2-3 | $0.10 | | Monthly | $70-90 | $3-5 | | Yearly | $800+ | $40-60 |
All changes are written under ~/.openclaw/. A backup is created before any modification.
| Path | Purpose | |------|---------| | ~/.openclaw/openclaw.json | Main OpenClaw config (model routing, heartbeat, budgets) | | ~/.openclaw/backups/ | Timestamped config backups (created automatically) | | ~/.openclaw/workspace/ | Template files (SOUL.md, USER.md, IDENTITY.md) | | ~/.openclaw/prompts/ | Agent prompt optimization rules | | ~/.openclaw/token-optimizer-stats.json | Usage stats for savings reports |
Safe by default - All commands run in dry-run (preview) mode. Pass --apply to write changes.
# Install
clawhub install token-optimizer
# Analyze current setup
python cli.py analyze
# Preview changes (dry-run by default)
python cli.py optimize
# Apply all optimizations
python cli.py optimize --apply
# Verify setup
python cli.py verify
# Quick health check
python cli.py health
# Configure heartbeat provider (preview)
python cli.py setup-heartbeat --provider ollama
# Configure heartbeat provider (apply)
python cli.py setup-heartbeat --provider ollama --apply
# List and restore backups
python cli.py rollback --list
python cli.py rollback --to <backup-file>
{
"agents": {
"defaults": {
"model": { "primary": "anthropic/claude-haiku-4-5" },
"cache": { "enabled": true, "ttl": "5m" }
}
},
"heartbeat": {
"provider": "ollama",
"model": "ollama/llama3.2:3b"
},
"budgets": {
"daily": 5.00,
"monthly": 200.00
}
}
Smart People Connected
MIT License - Free to use, modify, and distribute.
---
5 minutes to setup. 97% cost reduction. Stop burning tokens. Start building.
安装 Tokenoptimizer 后,可以对 AI 说这些话来触发它
Help me get started with Tokenoptimizer
Explains what Tokenoptimizer does, walks through the setup, and runs a quick demo based on your current project
Use Tokenoptimizer to reduce OpenClaw AI costs by 97%
Invokes Tokenoptimizer with the right parameters and returns the result directly in the conversation
What can I do with Tokenoptimizer in my finance & investment workflow?
Lists the top use cases for Tokenoptimizer, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/token-optimizer/ 目录(个人级,所有项目可用),或 .claude/skills/token-optimizer/(项目级)。重启 AI 客户端后,用 /token-optimizer 主动调用,或让 AI 根据上下文自动发现并使用。
Tokenoptimizer 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Tokenoptimizer 可免费安装使用。请查阅仓库了解许可证信息。
Reduce OpenClaw AI costs by 97%. Haiku model routing, free Ollama heartbeats, prompt caching, and budget controls. Go from $1,500/month to $50/month in 5 min...
Tokenoptimizer 属于「Finance & Investment」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my finance & investment tasks using Tokenoptimizer
Identifies repetitive steps in your workflow and sets up Tokenoptimizer to handle them automatically