← 返回
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...
降低97% OpenClaw AI成本。含Haiku模型路由、免费Ollama心跳、提示词缓存及预算控制。5分钟内将月费从1500美元降至50美元。
smartpeopleconnected
AI智能 clawhub v1.0.18 1 版本 96045 Key: 无需
★ 33
Stars
📥 13,352
下载
💾 3,808
安装
1
版本
#97-percent#budget#cache#cheap#clawdbot#cost#efficient#free#haiku#heartbeat#latest#model-routing#ollama#openclaw#optimization#reduce#savings#sonnet#token

概述

Token Optimizer for OpenClaw

Slash your AI costs from $1,500+/month to under $50/month.

The Problem

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.

The Solution

Four core optimizations plus powerful tooling:

Model Routing (92% savings)

Haiku by default, Sonnet/Opus only when needed

Multi-Provider Heartbeats (100% savings)

Route heartbeats to Ollama, LM Studio, Groq, or disable entirely. Not locked to one provider.

Session Management (80% savings)

Load 8KB instead of 50KB context

Caching (90% savings)

Reuse prompts at 10% cost

New in v1.0.8

  • Rollback - List and restore config backups instantly
  • Health Check - Quick system status in one command
  • Diff Preview - See exactly what changes before applying
  • --no-color - CI/pipeline friendly output

Cost Comparison

PeriodBeforeAfter
-----------------------
Daily$2-3$0.10
Monthly$70-90$3-5
Yearly$800+$40-60

What's Included

  • One-command optimizer with diff preview
  • Multi-provider heartbeat (Ollama, LM Studio, Groq)
  • Config rollback and health check commands
  • Ready-to-use config templates
  • SOUL.md & USER.md templates
  • Optimization rules for agent prompts
  • Verification and savings reports

What This Tool Modifies

All changes are written under ~/.openclaw/. A backup is created before any modification.

PathPurpose
---------------
~/.openclaw/openclaw.jsonMain 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.jsonUsage stats for savings reports

Safe by default - All commands run in dry-run (preview) mode. Pass --apply to write changes.

Quick Start

# 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>

Configuration Generated

{
  "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
  }
}

Links

  • GitHub: https://github.com/smartpeopleconnected/openclaw-token-optimizer
  • Issues: https://github.com/smartpeopleconnected/openclaw-token-optimizer/issues

Author

Smart People Connected

License

MIT License - Free to use, modify, and distribute.


5 minutes to setup. 97% cost reduction. Stop burning tokens. Start building.

版本历史

共 1 个版本

  • v1.0.18 当前
    2026-03-27 23:54 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

ontology

oswalpalash
类型化知识图谱,用于结构化智能体记忆与可组合技能。支持创建/查询实体(人员、项目、任务、事件、文档)及关联...
★ 709 📥 243,508
ai-intelligence

self-improving agent

pskoett
捕获经验教训、错误和纠正,以实现持续改进。使用时机:(1)命令或操作意外失败;(2)用户纠正……
★ 4,055 📥 795,652
ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,349 📥 317,674