A production-grade budget monitoring framework that safeguards against catastrophic API spending through tiered automated responses.
The fastest way to install a skill directly from the registry.
npx clawhub@latest install cost-control
Copy the skill folder to one of these locations
~/.openclaw/skills/ <project>/skills/ Priority: Workspace > Local > Bundled
Copy this prompt to OpenClaw to install it automatically.
Help me install cost-control using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).
Get the raw skill files in a ZIP archive.
Cost Control 3-Tier API Spend Protection is a specialized utility designed to act as a financial firewall for developers utilizing high-cost AI models and cloud infrastructure. By integrating this into your Openclaw Skills workflow, you can programmatically prevent the financial fallout associated with infinite loops, prompt injection, or misconfigured scaling. The system provides a multi-layered defense strategy that transitions from simple warnings to hard process termination when budget thresholds are exceeded.
Originally battle-tested in high-frequency trading environments, this skill has been generalized to support any API that charges per token, request, or compute unit. It provides developers with the peace of mind needed to deploy autonomous agents, knowing that their exposure is capped by rigid, state-persistent logic that survives application restarts.
pip install cost-control-system
Initialize the tracker within your application logic:
from cost_control import CostTracker
tracker = CostTracker(
cost_caution_15min=3.00, # Warning at $3/15min
cost_emergency_15min=5.00, # Emergency at $5/15min
cost_daily_cap=25.00 # Hard cap at $25/day
)
Wrap your API calls with checking logic:
allowed, reason = tracker.is_call_allowed()
if allowed:
response = call_expensive_api()
tracker.record_call(response.input_tokens, response.output_tokens)
The system utilizes a local state directory to ensure budget tracking persists across application crashes or restarts.
| Data Component | Format | Function |
|---|---|---|
| cost_log.jsonl | JSONL | Maintains a rotating log of the last 10,000 API transactions. |
| cost_emergency.flag | File | A physical flag that, when present, prevents the application from initiating new requests. |
| state/ | Directory | Stores rolling window metrics (5min, 15min, 1hr) and daily UTC totals. |
Loading
A high-speed, authentication-free AI portrait generation skill for creating diverse human characters and professional headshots in under 10 seconds.

A dedicated AI agent skill for fetching real-time weather data and multi-day forecasts via the UAPI weather interface.

A dedicated AI agent skill for converting between human-readable dates and Unix timestamps using the UAPI interface.

A collection of ready-to-use HEARTBEAT.md templates designed to automate routine monitoring tasks for AI agents.

A specialized text-to-speech skill for generating professional AI voiceovers, narration, and batch audio prompts using the OpenAI Audio API.

An expert AI optimization skill focused on maximizing completion rates for lead capture, contact, and checkout forms.








































