clawdbot-cost-tracker

Track Clawdbot AI model usage and estimate costs. Use when reporting daily/weekly costs, analyzing token usage across sessions, or monitoring AI spending. Supports Claude (opus/sonnet), GPT, and Codex models.

533 stars

Best use case

clawdbot-cost-tracker is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Track Clawdbot AI model usage and estimate costs. Use when reporting daily/weekly costs, analyzing token usage across sessions, or monitoring AI spending. Supports Claude (opus/sonnet), GPT, and Codex models.

Teams using clawdbot-cost-tracker should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/clawdbot-cost-tracker/SKILL.md --create-dirs "https://raw.githubusercontent.com/sundial-org/awesome-openclaw-skills/main/skills/clawdbot-cost-tracker/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/clawdbot-cost-tracker/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How clawdbot-cost-tracker Compares

Feature / Agentclawdbot-cost-trackerStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Track Clawdbot AI model usage and estimate costs. Use when reporting daily/weekly costs, analyzing token usage across sessions, or monitoring AI spending. Supports Claude (opus/sonnet), GPT, and Codex models.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Clawdbot Cost Tracker

Track token usage and estimate API costs across all Clawdbot sessions.

## Quick Start

### Get Current Usage

```bash
# Use sessions_list to get token data
sessions_list --limit 20 --messageLimit 0
```

Extract `totalTokens` and `model` from each session.

### Calculate Cost

Model pricing (USD per million tokens):

| Model | Input | Output | Avg Ratio |
|-------|-------|--------|-----------|
| claude-opus-4-5 | $15 | $75 | 30/70 |
| claude-sonnet-4 | $3 | $15 | 30/70 |
| codex-mini-latest | $1 | $5 | 30/70 |
| gpt-4o | $2.5 | $10 | 30/70 |
| gpt-4o-mini | $0.15 | $0.6 | 30/70 |

Cost formula (assuming 30% input, 70% output):
```
cost = tokens * (0.3 * input_price + 0.7 * output_price) / 1,000,000
```

## Daily Tracking

### Save Usage Snapshot

Store daily snapshots in `memory/usage/YYYY-MM-DD.json`:

```json
{
  "date": "2026-01-29",
  "timestamp": "2026-01-29T08:20:00+08:00",
  "sessions": {
    "session_key": {
      "model": "claude-opus-4-5",
      "totalTokens": 123456,
      "channel": "discord"
    }
  },
  "summary": {
    "totalTokens": 250000,
    "byModel": {
      "claude-opus-4-5": 220000,
      "codex-mini-latest": 30000
    }
  }
}
```

### Calculate Daily Cost

Compare consecutive days to get daily usage:
```
daily_tokens = today.totalTokens - yesterday.totalTokens
daily_cost = estimate_cost(daily_tokens, model)
```

## Scripts

### `scripts/snapshot-usage.js`

Creates a usage snapshot from current session data.

```bash
node scripts/snapshot-usage.js [output-dir]
# Default output: memory/usage/YYYY-MM-DD.json
```

### `scripts/calculate-cost.js`

Calculates cost for a date range.

```bash
node scripts/calculate-cost.js [date]
# Default: today
# Output: JSON with token delta and estimated cost
```

## Integration with Daily Report

Add to HEARTBEAT.md:
1. Call `sessions_list` to get current tokens
2. Load previous day's snapshot from `memory/usage/`
3. Calculate delta and estimate cost
4. Include in daily report format:
   ```
   💰 **Clawdbot Cost** (yesterday)
   • Used: 45.2k tokens
   • Estimated: ~$1.23
   ```

## Color Conventions (Chinese Style)

For financial displays in Chinese context:
- 🔴 Red = Up/Increase
- 🟢 Green = Down/Decrease

Related Skills

habit-tracker

533
from sundial-org/awesome-openclaw-skills

Build habits with streaks, reminders, and progress visualization

flight-tracker

533
from sundial-org/awesome-openclaw-skills

Flight tracking and scheduling. Track live flights in real-time by region, callsign, or airport using OpenSky Network. Search flight schedules between airports. Use for queries like "What flights are over Switzerland?" or "When do flights from Hamburg arrive in Zurich?" or "Track flight SWR123".

flight-tracker-2

533
from sundial-org/awesome-openclaw-skills

Track flights in real-time with detailed status, gate info, delays, and live position. Use when user asks to track a flight, check flight status, look up flight information by flight number (e.g., "track AA100", "what's the status of United 2402", "check my flight BA123"), or wants to display flight data in a formatted view similar to Flighty app.

finance-tracker

533
from sundial-org/awesome-openclaw-skills

Track personal expenses with natural language. Log spending, view reports, search transactions. Works with any AI model.

expense-tracker-pro

533
from sundial-org/awesome-openclaw-skills

Track expenses via natural language, get spending summaries, set budgets

deepwork-tracker

533
from sundial-org/awesome-openclaw-skills

Track deep work sessions locally (start/stop/status) and generate a GitHub-contribution-graph style minutes-per-day heatmap for sharing (e.g., via Telegram). Use when the user says things like “start deep work”, “stop deep work”, “am I in a session?”, “show my deep work graph”, or asks to review deep work history.

crypto-tracker

533
from sundial-org/awesome-openclaw-skills

Track crypto prices, set alerts, and search coins via CoinGecko API.

clawdbot-workspace-template-review

533
from sundial-org/awesome-openclaw-skills

Compare a Clawdbot workspace against the official templates installed with Clawdbot (npm or source) and list missing sections to pull in, especially after upgrades.

clawdbot-skill-update

533
from sundial-org/awesome-openclaw-skills

Comprehensive backup, update, and restore workflow with dynamic workspace detection

clawdbot-self-security-audit

533
from sundial-org/awesome-openclaw-skills

Perform a comprehensive read-only security audit of Clawdbot's own configuration. This is a knowledge-based skill that teaches Clawdbot to identify hardening opportunities across the system. Use when user asks to "run security check", "audit clawdbot", "check security hardening", or "what vulnerabilities does my Clawdbot have". This skill uses Clawdbot's internal capabilities and file system access to inspect configuration, detect misconfigurations, and recommend remediations. It is designed to be extensible - new checks can be added by updating this skill's knowledge.

clawdbot-security

533
from sundial-org/awesome-openclaw-skills

Security audit and hardening for Clawdbot/Moltbot installations. Detects exposed gateways, fixes permissions, enables authentication, and guides firewall/Tailscale setup.

clawdbot-release-check

533
from sundial-org/awesome-openclaw-skills

Check for new clawdbot releases and notify once per new version.