smartpeopleconnected

Tokenoptimizer

AI 智慧體v1.0.18
作者:smartpeopleconnected更新於 2026-05-11共 19 個版本 · 最新版本釋出於 2026-02-21token-optimizer@clawhub_smartpeopleconnected/token-optimizer
任務自動化工作流編排#Prompt

據 AlphaMoat 統計,截至 2026-10,Tokenoptimizer 累計下載 26,178 次、獲 34 個星標,按累計下載量在本次參與排名的 10,914 個 AI 技能中排名第 1,079 位,在「AI 智慧體」分類(1,632 個)中排名第 164 位。

列表預設按累計下載量排序,也可按星標排序;詳情頁排名按累計下載量計算。

累計下載
2.6萬
星標
34
全站下載量排名
#1,079
全站前 10% · 「AI 智慧體」前 11%
平台累計下載星標評論
ClawHub ↗1.3萬289
SkillHub ↗2.6萬34—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

做法包括按需切換輕量模型、控制上下文體量、加快取與預算約束,並提供變更前的 diff 預覽、配置備份回滾與一條健康檢查命令。源文自帶的降本比例屬於其主張,未在本輪材料中驗證。持久化的路由、提示詞與預算變更可能影響記憶和正確性;應用前檢查 diff,複雜、安全敏感或高風險任務應按需覆蓋低價模型/縮短上下文的預設設定。

資料釋出於 2026-10-29

可以用來做什麼

  • 把預設模型改成輕量檔、複雜任務再升級
  • 在改配置前先看差異並保留可回滾備份

什麼時候用

  • agent 呼叫成本偏高時
  • 想收緊上下文長度與預算時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

幫我把預設模型調成輕量檔,複雜任務再切回去
先給我看這次配置改動的差異,再決定要不要應用

月度資料趨勢

累計下載2.6萬
91931.8萬2.7萬2026-03 · 累計下載 1萬2026-05 · 累計下載 1.3萬2026-06 · 累計下載 1.4萬2026-07 · 累計下載 1.4萬2026-08 · 累計下載 1.5萬2026-09 · 累計下載 1.7萬2026-10 · 累計下載 2.6萬26-0326-0926-10
星標34
2229352026-03 · 星標 232026-05 · 星標 322026-06 · 星標 332026-07 · 星標 332026-08 · 星標 342026-09 · 星標 342026-10 · 星標 3426-0326-0926-10

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。 該技能有同名的其他版本,調整前的資料歸屬當前下載量最大的這一個。

月份累計下載環比星標
2026-102.6萬—34
2026-091.7萬—34
2026-081.5萬+2.3%34
2026-071.4萬+3.7%33
2026-061.4萬+4.6%33
2026-051.3萬—32
2026-031萬—23

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

4.0 KB · ClawHub v1.0.18
---
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
展開全部(共 159 行)
  - 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
---

# 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

| Period | Before | After |
|--------|--------|-------|
| 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.

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

## Quick Start

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

```json
{
  "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**
- GitHub: [@smartpeopleconnected](https://github.com/smartpeopleconnected)
- Email: [email protected]

## License

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

---

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

「AI 智慧體」分類下的熱門技能

資料月份:2026-10 · 下載/星標數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。