Reduce OpenClaw AI costs with model-aware optimization. Features dynamic compaction presets based on your model's context window, intelligent file compression, and robust model detection with fallback. Supports Claude, GPT-4, Gemini, DeepSeek, and more.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install token-saver或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install token-saver⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/token-saver/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: token-saver version: 3.0.0 description: "Reduce OpenClaw AI costs with model-aware optimization. Features dynamic compaction presets based on your model's context window, intelligent file compression, and robust model detection with fallback. Supports Claude, GPT-4, Gemini, DeepSeek, and more." ---
> 💡 Did you know? Every API call sends your workspace files (SOUL.md, USER.md, MEMORY.md, AGENTS.md, etc.) along with your message. These files count toward your context window, slowing responses and costing real money on every message.
Token Saver v3 is model-aware — it knows your model's context window and adapts recommendations accordingly. Using Gemini's 1M context? Presets scale up. On GPT-4o's 128K? Presets adjust down.
| Feature | v2 | v3 | |---------|----|----| | Compaction presets | Fixed (80K/120K/160K) | Dynamic (% of model's context) | | Model detection | Fragile, env-only | Robust fallback chain | | Context windows | Not tracked | Full registry (9 models) | | Model info | Hardcoded pricing | JSON registry, easy updates | | Already-optimized | Re-compressed | Smart bypass |
| Command | What it does | |---|---| | /optimize | Full dashboard — files, models, context usage % | | /optimize tokens | Compress workspace files (auto-backup) | | /optimize compaction | Chat compaction control (model-aware) | | /optimize compaction balanced | Apply balanced preset (60% of context) | | /optimize compaction 120 | Custom threshold (compact at 120K) | | /optimize models | Detailed model audit with registry | | /optimize revert | Restore backups, disable persistent mode |
Shows current model, context window, and usage percentage:
🤖 Model: Claude Opus 4.5 (200K context)
Detected: openclaw.json
📊 Context Usage: [████████░░░░░░░░░░░░] 42% (84K/200K)
Scans all .md files, shows token count and potential savings. Smart bypass skips already-optimized files.
File-aware compression:
Presets adapt to your model's context window:
| Preset | % of Context | Claude 200K | GPT-4o 128K | Gemini 1M | |--------|--------------|-------------|-------------|-----------| | Aggressive | 40% | 80K | 51K | 400K | | Balanced | 60% | 120K | 77K | 600K | | Conservative | 80% | 160K | 102K | 800K | | Off | 95% | 190K | 122K | 950K |
24+ models with context windows, pricing, and aliases:
Detection priority:
--model=...)SKILL_MODEL, OPENCLAW_MODEL)~/.openclaw/openclaw.json)Unknown model handling:
opus-6.5 won't fuzzy-match to opus-4.5scripts/models.jsonAdds writing guidance to AGENTS.md for continued token efficiency:
| File | Writing Style | |------|---------------| | SOUL.md | Evocative, personality-shaping | | AGENTS.md | Dense instructions, symbols OK | | USER.md | Key:value facts | | MEMORY.md | Ultra-dense data |
.backup extension/optimize revert restores everythingclawhub install token-saver --registry "https://www.clawhub.ai"
安装 Token Saver 后,可以对 AI 说这些话来触发它
Help me get started with Token Saver
Explains what Token Saver does, walks through the setup, and runs a quick demo based on your current project
Use Token Saver to reduce OpenClaw AI costs with model-aware optimization
Invokes Token Saver with the right parameters and returns the result directly in the conversation
What can I do with Token Saver in my documents & notes workflow?
Lists the top use cases for Token Saver, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/token-saver/ 目录(个人级,所有项目可用),或 .claude/skills/token-saver/(项目级)。重启 AI 客户端后,用 /token-saver 主动调用,或让 AI 根据上下文自动发现并使用。
Token Saver 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Token Saver 可免费安装使用。请查阅仓库了解许可证信息。
Reduce OpenClaw AI costs with model-aware optimization. Features dynamic compaction presets based on your model's context window, intelligent file compression, and robust model detection with fallback. Supports Claude, GPT-4, Gemini, DeepSeek, and more.
Token Saver 属于「Documents & Notes」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my documents & notes tasks using Token Saver
Identifies repetitive steps in your workflow and sets up Token Saver to handle them automatically