Cost Tracker for Openclaw

A dedicated AI spending monitor for tracking, reporting, and optimizing OpenRouter costs through a powerful command-line interface.

aiwithabidi
v1.0.0
Feb 19, 2026
0
832
8

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install cost-tracker

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 cost-tracker 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 Cost Tracker?

Cost Tracker is a specialized utility designed to bring transparency to AI operational expenses. By integrating directly with OpenRouter APIs, this skill provides developers and businesses with a granular view of their spending patterns. It transforms raw API usage data into actionable insights, helping users understand exactly which models are driving costs and where optimizations can be made.

As part of the Openclaw Skills ecosystem, Cost Tracker ensures that your AI agents operate within financial guardrails. Whether you are a solo developer managing a hobby project or a team scaling enterprise workflows, this tool provides the necessary visibility to maintain budget control and efficiency across various LLM providers.

Cost Tracker Use Cases

  • Monitoring daily consumption of OpenRouter API credits to maintain budget awareness.
  • Identifying high-cost models that could be swapped for more efficient alternatives.
  • Preventing unexpected billing overages through proactive budget alerts and status checks.
  • Generating financial reports for internal auditing or client project billing.
  • Exporting historical spending data for long-term financial analysis in external tools like Excel or Google Sheets.

How Cost Tracker Works

  1. The skill connects to the OpenRouter API using your provided authentication key to retrieve the latest usage statistics.
  2. Data is persisted into a local SQLite database, allowing for long-term historical tracking and trend analysis.
  3. It aggregates usage data based on the requested period (daily, weekly, or monthly) to generate formatted console reports.
  4. Current consumption is compared against user-defined budget limits to trigger alerts at specific thresholds (e.g., 80%).
  5. The system analyzes per-model costs and suggests potential savings by recommending more cost-effective model alternatives based on your workload.

Cost Tracker Setup

To integrate Cost Tracker into your Openclaw Skills environment, ensure you have Python 3.10+ installed and a valid OpenRouter API key.

First, set your environment variable:

export OPENROUTER_API_KEY='your_api_key_here'

Run the initial fetch command to populate your database with current usage:

python3 scripts/cost_tracker.py fetch

Configure your monthly budget limit to begin tracking thresholds:

python3 scripts/cost_tracker.py budget --set 25.00

Cost Tracker Data Schema & Taxonomy

The skill utilizes a local SQLite database to ensure data persistence, privacy, and speed. Data can be exported into standard formats for external review.

Item Description
Database Path {baseDir}/data/cost_tracker.db
Storage Format SQLite
Export Formats JSON, CSV
Metadata Tracked Model ID, Token Usage, Cost (USD), Timestamp

Users can generate exports using the following command:

python3 scripts/cost_tracker.py export --format json

Cost Tracker Advanced Features

  • Proactive Budget Alerts: Automatically warns users when spending reaches an 80% threshold of the defined budget.
  • Savings Recommendation Engine: Identifies cheaper LLM alternatives that can handle similar workloads to reduce overhead.
  • Historical Trend Analysis: Leverages stored SQLite data to provide insights into spending growth over time.
  • Multi-Format Portability: Native support for JSON and CSV exports allows for integration with enterprise BI tools.
  • Granular Per-Model Breakdown: Provides specific cost analysis for every individual model used within the Openclaw Skills framework.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Requires
Github Stars: 0
forks: 0

Featured*