Token Optimizer for Openclaw

A powerful cost-reduction tool for Openclaw Skills that optimizes token usage through intelligent model routing and local heartbeat providers.

smartpeopleconnected
v1.0.18
Feb 21, 2026
0
0
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install tokenoptimizer

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install tokenoptimizer using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Token Optimizer?

The Token Optimizer is a specialized utility designed to significantly lower the operational costs of AI agents. By default, many configurations prioritize performance over economy, leading to unnecessary spending on high-tier models like Sonnet or Opus for mundane tasks.

This addition to your library of Openclaw Skills bridges the gap between efficiency and capability by implementing Haiku model routing, local Ollama heartbeats, and aggressive prompt caching. It transforms expensive workflows into sustainable, budget-friendly operations without sacrificing the reliability of your AI agents, allowing you to scale your automation without the financial burden of premium API costs.

Token Optimizer Use Cases

  • High API bills resulting from frequent model heartbeats.
  • Unnecessary usage of high-cost models for simple or repetitive agent tasks.
  • Exceeding daily or monthly token budgets during heavy development cycles.
  • Managing multiple Openclaw Skills across different providers like Groq or Ollama.
  • Needing to preview and rollback configuration changes safely to maintain system stability.

How Token Optimizer Works

  1. The tool analyzes your current Openclaw Skills configuration to identify cost-heavy patterns and inefficient model usage.
  2. It generates a detailed diff preview of optimized settings, including model routing to Claude Haiku and local heartbeat redirection.
  3. Users apply the optimizations, which automatically triggers a timestamped backup of the existing configuration for safety.
  4. The system implements prompt caching and session management to drastically reduce context window overhead and token drain.
  5. Integrated health checks and verification reports allow you to monitor active optimizations and track savings over time.

Token Optimizer Setup

To get started with optimizing your Openclaw Skills, follow these steps:

# Install the skill via the hub
clawhub install token-optimizer

# Analyze your current token usage and costs
python cli.py analyze

# Preview optimizations (dry-run mode)
python cli.py optimize

# Apply cost-saving configurations to your system
python cli.py optimize --apply

# Set up a free local heartbeat provider to eliminate heartbeat costs
python cli.py setup-heartbeat --provider ollama --apply

# Verify the health of your optimized setup
python cli.py health

Token Optimizer Data Schema & Taxonomy

The Token Optimizer organizes its data and configuration within the standard user directory for Openclaw Skills:

Path Description
~/.openclaw/openclaw.json The primary configuration file managing model routing, heartbeats, and budget controls.
~/.openclaw/backups/ Storage for timestamped backups to allow for instant configuration rollbacks.
~/.openclaw/workspace/ Template files used for SOUL.md, USER.md, and IDENTITY.md.
~/.openclaw/prompts/ Optimized rules and templates for reducing agent prompt context.
~/.openclaw/token-optimizer-stats.json Log of usage statistics and realized savings reports.

Token Optimizer Advanced Features

  • Multi-provider heartbeat support including Ollama, LM Studio, and Groq to enable 100% savings on background pings.
  • Instant configuration rollback system to restore any previous setup from the backup directory.
  • Automated health check command for rapid system status diagnostics and connectivity testing.
  • Diff preview mode to inspect every technical change before it is committed to the filesystem.
  • CI/CD friendly output using the --no-color flag for integration into automated DevOps pipelines.
  • Granular budget controls to enforce hard limits on daily and monthly spending across all Openclaw Skills.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*