costlens

Calculate OpenClaw usage cost from offline event logs, apply budget thresholds, and export operator-facing reports.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "costlens" with this command: npx skills add mike007jd/costlens

CostLens

Turn JSON usage events into cost summaries, budget checks, and offline reports.

When to use

  • You already have token usage events and need a quick spend summary.
  • You want a simple budget gate in local automation or CI.
  • You need an exportable JSON report without relying on a hosted billing dashboard.

Commands

node {baseDir}/bin/costlens.js monitor --events ./events.json --budget 10.00 --threshold 80
node {baseDir}/bin/costlens.js budget check --events ./events.json --budget 5.00 --format json
node {baseDir}/bin/costlens.js report --events ./events.json --out ./reports/cost-report.json

Built-in default rates

ModelInput/1kOutput/1k
gpt-4.1$0.01$0.03
gpt-4o-mini$0.00015$0.0006
claude-3-5-sonnet$0.003$0.015
default$0.002$0.008

Events can override the defaults with inputCostPer1k and outputCostPer1k.

Event shape

[
  {
    "model": "gpt-4.1",
    "promptTokens": 1500,
    "completionTokens": 800,
    "timestamp": "2026-02-26T10:00:00Z"
  }
]

Output

  • Total calls, total tokens, and total cost
  • Per-model breakdowns for calls, tokens, and cost
  • Per-day spend trends
  • Budget usage percentage and alert level (ok, warning, or critical)

Boundaries

  • Pricing is based on built-in defaults plus per-event overrides. It is not a live pricing feed.
  • CostLens is optimized for offline JSON analysis, not streaming metering or invoice reconciliation.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

OpenClaw Cost Guard (Budgets + Token-Saving Playbook)

Track OpenClaw/Clawdbot token and cost usage from session JSONL logs (prefer real usage.cost when present), generate daily/weekly summaries and top expensive sessions, and run budget checks (exit code on breach). Use to monitor spend, enforce budgets via cron/alerts, and apply a token-saving playbook to reduce output/tool-call cost.

Registry SourceRecently Updated
2.8K4Profile unavailable
General

Vibe Billing Scan

Scan your OpenClaw logs to identify costly runs, sessions, retry storms, and looped tool calls driving your API bill higher, with no signup needed.

Registry SourceRecently Updated
1320Profile unavailable
General

Cost Guardian

Track, analyze, and optimize AI and infrastructure costs with budgeting, spend forecasts, token usage scans, and optimization suggestions.

Registry SourceRecently Updated
4630Profile unavailable
Automation

Tokenoptimizer

Reduce OpenClaw AI costs by 97%. Haiku model routing, free Ollama heartbeats, prompt caching, and budget controls. Go from $1,500/month to $50/month in 5 min...

Registry SourceRecently Updated
9.2K23Profile unavailable