跳到正文
TakoAPI
返回技能列表

token-optimizer

由 smartpeopleconnected 提供

Coding Agents & IDEs
5.5k下载量由 clawskills.sh 提供
21星标
0浏览量
0 个赞登录后即可为这个技能点赞
—暂无评分
你的评分

简介

Reduce OpenClaw AI costs by 97%.

描述

该技能的功能

Reduces OpenClaw AI API costs by routing most requests to Claude Haiku, offloading heartbeats to local or alternative providers, enabling prompt caching, and trimming loaded context size. All changes preview before writing, and backups are created automatically before any modification.

Combines model routing, multi-provider heartbeat offloading, prompt caching, and config rollback into a single CLI with dry-run preview, rather than requiring manual edits across multiple config files.

何时使用

  • Switching routine coding tasks from Sonnet to Haiku to cut token spend
  • Routing OpenClaw heartbeats to a local Ollama instance instead of paid API
  • Previewing config diffs before applying changes in a CI pipeline
  • Setting daily and monthly spend caps to prevent runaway API bills
  • Rolling back to a previous config after an optimization produces unexpected behavior

示例工作流

输入

User asks: reduce my OpenClaw API costs

智能体
  1. 1

    Run python cli.py analyze to inspect current model routing and heartbeat configuration

  2. 2

    Run python cli.py optimize to generate a diff preview of proposed changes

  3. 3

    Review the diff showing Haiku as default model, caching enabled, and budget limits added

  4. 4

    Run python cli.py optimize --apply to write changes to ~/.openclaw/

  5. 5

    Run python cli.py verify to confirm the new configuration is active

输出

OpenClaw configured with Haiku as default model, prompt caching enabled, and daily/monthly budget limits set, with a timestamped backup of the previous config saved to ~/.openclaw/backups/

安装

clawhub install smartpeopleconnected/token-optimizer

运行 CLI 命令,或把这段提示词粘贴到 Claude Code、Cursor、Codex 或你在用的任意编程智能体里。

链接