ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified developer tools Safety 5/5

token-optimizer

Reduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/asif2bd/openclaw-token-optimizer
Or

What This Skill Does

The token-optimizer for OpenClaw is an essential suite of tools designed to dramatically reduce API costs and token consumption within your AI agent workspace. By addressing both the initialization phase (lazy loading) and runtime operations (model routing and context pruning), this toolkit empowers users to optimize their deployments for scale. The core of this tool focuses on three areas: reducing context window bloat, enforcing cost-efficient model routing, and tracking total usage through a transparent logging system.

Installation

To integrate this optimization suite into your OpenClaw environment, use the command-line interface provided by clawhub: clawhub install openclaw/skills/skills/asif2bd/openclaw-token-optimizer Once installed, you can immediately begin optimizing your AGENTS.md file by running python3 scripts/context_optimizer.py generate-agents to create a lean, optimized version of your current workspace configuration. For heartbeat interval adjustments, copy the provided template to your workspace folder: cp assets/HEARTBEAT.template.md ~/.openclaw/workspace/HEARTBEAT.md.

Use Cases

This skill is ideal for developers managing agents at scale where API rate limits are frequently hit. It is particularly effective for users who have accumulated large, monolithic documentation folders, leading to excessive context loading. Whether you are running agents across different providers or trying to enforce cost-effective model switching (e.g., swapping Opus for Sonnet/Haiku for simple chat tasks), this tool provides the necessary logic to keep token spend under control. It is also perfect for budget-conscious users who need a real-time audit of how many tokens their current task execution consumes.

Example Prompts

  1. "Check my current token budget to see if I am approaching my monthly limit."
  2. "Recommend the minimum files required for this specific task to reduce context bloat."
  3. "Route the next task to a cost-effective model since this is a simple query."

Tips & Limitations

To achieve the maximum possible savings (up to 93% in some scenarios), you must implement the Lazy Skill Loading pattern described in the documentation. Keep in mind that while the 4 primary scripts are local-only and secure, optional multi-provider features referenced in external files like PROVIDERS.md do require network access and API key configuration. Always review your AGENTS.md.optimized files before replacing your existing configurations to ensure no critical instructions are lost during the pruning process.

Metadata

Author@asif2bd
Stars4473
Views1
Updated2026-05-01
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-asif2bd-openclaw-token-optimizer": {
      "enabled": true,
      "auto_update": true
    }
  }
}

Tags(AI)

#optimization#cost-reduction#token-management#llm-tools
Safety Score: 5/5

Flags: file-read, file-write

Related Skills

wordpress-publisher

Publish content directly to WordPress sites via REST API with full Gutenberg block support. Create and publish posts/pages, auto-load and select categories from website, generate SEO-optimized tags, preview articles before publishing, and generate Gutenberg blocks for tables, images, lists, and rich formatting. Use when user wants to publish to WordPress, post to blog, create WordPress article, update WordPress post, or convert markdown to Gutenberg blocks.

asif2bd 4473

Claude Code CLI for OpenClaw

Install, authenticate, and use Claude Code CLI as a native coding tool for any OpenClaw agent system.

asif2bd 4473

openclaw-skill-lazy-loader

Dramatically reduce per-session token usage by loading skills and context files only when needed — not at session start. Includes the SKILLS catalog pattern, AGENTS.md lazy loading strategy, and a Python helper that recommends exactly which files to load for any given task. Compatible with all OpenClaw agents. Works alongside Token Optimizer.

asif2bd 4473

xcloud-docker-deploy

Deploy any project to xCloud hosting — auto-detects stack (WordPress, Laravel, PHP, Node.js, Next.js, NestJS, Python, Go, Rust), routes to native or Docker deployment, generates production-ready Dockerfile, docker-compose.yml, GitHub Actions CI/CD, and .env.example. Works from zero Docker setup.

asif2bd 4473

voiceclaw

Local voice I/O for OpenClaw agents. Transcribe inbound audio/voice messages using local Whisper (whisper.cpp) and generate voice replies using local Piper TTS. Requires whisper, piper, and ffmpeg pre-installed on the system. All inference runs on-device — no network calls, no cloud APIs, no API keys. Use when an agent receives a voice/audio message and should respond in both voice and text, or when any text response should be synthesized and sent as audio. Triggers on: voice messages, audio attachments, respond in voice, send as audio, speak this, voiceclaw.

asif2bd 4473