Usage Report

v1.0.1

Generate cost and token usage reports from OpenClaw session logs. Use when asked about API costs, token usage, billing, spending, how much something cost, or...

0· 98·0 current·0 all-time
byBrice Thrower@directorvector
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description match the implementation: the script reads OpenClaw session JSONL files and aggregates usage/cost fields. Requested binaries (jq, bc) are reasonable and proportional.
Instruction Scope
Instructions and the script operate on ~/.openclaw/agents/main/sessions by default (or OPENCLAW_SESSIONS_DIR if set) and only parse per-turn usage fields; this is expected. Note: these session files can contain sensitive conversation content—review or run the script locally before exporting results. Also the script uses GNU date -d semantics (may need gdate on macOS).
Install Mechanism
No install spec — instruction-only with an included shell script. Nothing is downloaded or written to arbitrary locations during install.
Credentials
No credentials or secrets requested. One optional env var (OPENCLAW_SESSIONS_DIR) is justified for overriding the sessions directory.
Persistence & Privilege
always is false, the skill does not modify other skills or system configuration, and contains no persistent privileged behavior.
Assessment
This script appears to do what it says: aggregate local OpenClaw session usage and cost fields. Before installing or running it, review the script yourself (it will read your session JSONL files which may contain private conversation text). Ensure jq and bc are installed, and on macOS install coreutils (gdate) or adapt the date commands. Because the source is 'unknown' in the registry, prefer running the script locally with a test/open copy of your session files (or inspect it line-by-line) rather than running it as-is on sensitive data. It does not contact external endpoints or request credentials.

Like a lobster shell, security has layers — review code before you run it.

Runtime requirements

Binsjq, bc
Environment variables
OPENCLAW_SESSIONS_DIRoptionalOptional. Override path to OpenClaw session JSONL files. Defaults to ~/.openclaw/agents/main/sessions/
billingvk97ergkbzw1vxjbq2d6q7wemts84h1wrcostvk97ergkbzw1vxjbq2d6q7wemts84h1wrlatestvk97b5yswbpf2pwy6ek4m22m22584ks48tokensvk97ergkbzw1vxjbq2d6q7wemts84h1wrutilitiesvk97ergkbzw1vxjbq2d6q7wemts84h1wr
98downloads
0stars
2versions
Updated 1w ago
v1.0.1
MIT-0

Usage Report

Generate cost and token usage reports from OpenClaw session JSONL logs.

Quick usage

# Full text report (all sessions)
{baseDir}/scripts/usage-report.sh

# JSON output
{baseDir}/scripts/usage-report.sh json

# Filter to today only
{baseDir}/scripts/usage-report.sh text today

# Filter to specific date
{baseDir}/scripts/usage-report.sh text 2026-04-07

# JSON for a specific date
{baseDir}/scripts/usage-report.sh json today

Output fields

  • Turns: number of assistant responses (API calls)
  • Cost: sum of per-turn costs (input + output + cache read + cache write)
  • Output tokens: tokens generated by the model
  • Cache read/write: prompt caching token counts

Notes

  • Reads from ~/.openclaw/agents/main/sessions/*.jsonl by default
  • Override with OPENCLAW_SESSIONS_DIR env var
  • Costs are calculated by OpenClaw at request time using provider pricing
  • Skips .lock and .reset backup files
  • When presenting to user, round total cost to 2 decimal places

Comments

Loading comments...