skills$openclaw/openclaw-cost-tracker
vincentqiu653

by vincentqiu

openclaw-cost-tracker – OpenClaw Skill

openclaw-cost-tracker is an OpenClaw Skills integration for ai ml workflows. Track OpenClaw usage costs and provide detailed reports by date and model. Supports daily, weekly, and monthly report formats for Discord and other messaging channels.

653 stars4.7k forksSecurity L1
Updated Feb 7, 2026Created Feb 7, 2026ai ml

Skill Snapshot

nameopenclaw-cost-tracker
descriptionTrack OpenClaw usage costs and provide detailed reports by date and model. Supports daily, weekly, and monthly report formats for Discord and other messaging channels. OpenClaw Skills integration.
ownervincentqiu
repositoryvincentqiu/cost-report
languageMarkdown
licenseMIT
topics
securityL1
installopenclaw add @vincentqiu/cost-report
last updatedFeb 7, 2026

Maintainer

vincentqiu

vincentqiu

Maintains openclaw-cost-tracker in the OpenClaw Skills directory.

View GitHub profile
File Explorer
12 files
.
config
cron-examples.json
1.3 KB
references
JSONL_FORMAT.md
2.5 KB
scripts
cost_report.sh
14.9 KB
report_discord.sh
835 B
_meta.json
645 B
cli.js
1.4 KB
package.json
718 B
README.md
2.1 KB
SKILL.md
2.1 KB
SKILL.md

name: openclaw-cost-tracker description: Track OpenClaw usage costs and provide detailed reports by date and model. Supports daily, weekly, and monthly report formats for Discord and other messaging channels. metadata: { "openclaw": { "emoji": "💰", "os": ["darwin", "linux"], "requires": { "bins": ["jq"] }, "install": [ { "id": "brew", "kind": "brew", "formula": "jq", "bins": ["jq"], "label": "Install jq (JSON parser)", }, ], }, }

OpenClaw Cost Tracker

Overview

Precisely track OpenClaw usage costs with detailed reports by date and model type. This skill uses the jq tool to directly parse JSON data from OpenClaw session logs, extracting accurate cost information.

Supports multiple report formats:

  • Daily Reports (today/yesterday costs)
  • Weekly Reports (current week total/comparison with previous week)
  • Monthly Reports (current month total/month-over-month growth)

Quick Start

# Today's cost report
bash {baseDir}/scripts/cost_report.sh --today

# Yesterday's cost report
bash {baseDir}/scripts/cost_report.sh --yesterday

# Weekly cost report
bash {baseDir}/scripts/cost_report.sh --week

# Date range report
bash {baseDir}/scripts/cost_report.sh --from 2026-01-01 --to 2026-01-31

Cost Calculation Method

This script directly extracts cost data from OpenClaw session log files (~/.openclaw/agents/*/sessions/*.jsonl):

  1. Uses jq to parse JSON data, locating the message.usage.cost.total field
  2. Calculates totals grouped by date and model
  3. Ensures each API call's cost is counted only once

Discord Output Format

💰 OpenClaw Cost Report (2026-02-04)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Today's Total Cost: $XX.XX (🟢 -XX% vs yesterday)

📊 Model Details:
• claude-opus-4-5: $XX.XX (XX%)
• gpt-4o: $X.XX (X%)
• ...

📈 Weekly Total: $XXX.XX

Installation Requirements

  • jq: JSON parsing tool (brew install jq or apt install jq)
  • Access to OpenClaw log files
README.md

OpenClaw Cost Tracker

Accurately track OpenClaw usage costs with detailed reports by date and model.

Features

  • ✅ Precisely parse API call costs from OpenClaw session logs
  • ✅ Group costs by model type
  • ✅ Support daily, weekly, and monthly reports
  • ✅ Display cost changes (increase/decrease percentage)
  • ✅ Compatible with macOS and Linux
  • ✅ Beautiful Discord output format
  • ✅ Can be set up as automated cron tasks

Installation

  1. Make sure you have the required dependencies:

    # macOS
    brew install jq
    
    # Ubuntu/Debian
    apt install jq bc
    
  2. Set script execution permissions:

    chmod +x scripts/cost_report.sh
    

Usage

# Today's cost report
npm start

# Or run the script directly
./scripts/cost_report.sh --today

# Yesterday's cost report
./scripts/cost_report.sh --yesterday

# Weekly cost report
./scripts/cost_report.sh --week

# Date range report
./scripts/cost_report.sh --from 2026-01-01 --to 2026-01-31

# Generate Discord format report
./scripts/cost_report.sh --today --format discord

# Generate JSON format report
./scripts/cost_report.sh --today --format json

Automated Reports (Cron)

See the config/cron-examples.json file to learn how to set up automated report tasks. Use OpenClaw's cron functionality to easily set up daily/weekly cost reports.

Calculation Method

This tool extracts accurate API call cost data directly from OpenClaw session log files, ensuring precise and reliable report results:

  1. Scan all session JSONL files for records on the target date
  2. Use jq to parse the message.usage.cost.total field in each record
  3. Group by model and calculate totals
  4. Avoid data duplication or loss issues caused by session compaction

Notes

  • Ensure you have read permissions for the OpenClaw sessions directory
  • Processing large session files may take longer
  • If costs are 0, it may be because the API provider did not provide cost data

Technical Details

  • Uses jq to parse JSON data
  • Compatible with macOS and Linux date handling
  • Supports cost calculations grouped by model
  • Chinese-style color indicators for changes (🔴up / 🟢down)

Permissions & Security

Security level L1: Low-risk skills with minimal permissions. Review inputs and outputs before running in production.

Requirements

- jq: JSON parsing tool (`brew install jq` or `apt install jq`) - Access to OpenClaw log files

FAQ

How do I install openclaw-cost-tracker?

Run openclaw add @vincentqiu/cost-report in your terminal. This installs openclaw-cost-tracker into your OpenClaw Skills catalog.

Does this skill run locally or in the cloud?

OpenClaw Skills execute locally by default. Review the SKILL.md and permissions before running any skill.

Where can I verify the source code?

The source repository is available at https://github.com/openclaw/skills/tree/main/skills/vincentqiu/cost-report. Review commits and README documentation before installing.