OpenClaw cost observability CLI tool. Parses session transcripts and produces granular cost reports.
costctl analyzes OpenClaw session JSONL files to provide insights into LLM usage costs across agents, session types, cron jobs, and models.
cd ~/clawd/costctl
go build -o costctlOr install directly:
go install github.com/misty-step/costctl@latestcostctl agents# Today's costs across all agents
costctl report --period today
# Yesterday's costs
costctl report --period yesterday
# Last 7 days
costctl report --period week
# Last 30 days
costctl report --period month
# All time
costctl report --period all
# Filter by specific agent
costctl report --period today --agent urza
# Show cron cost ranking
costctl report --crons
# Show model cost comparison
costctl report --models
# Full report with all dimensions
costctl report --full
# JSON output for Cortex dashboard
costctl report --full --format json
# Custom anomaly threshold (default $0.50)
costctl report --crons --threshold 1.00
# Custom agents directory
costctl report --agents-dir /custom/path/to/agents- By Agent - amos, kaylee, pepper, abra, urza, pluto, mishra, cato, venser
- By Session Type - interactive, cron, subagent
- By Cron Job - daily-kickoff, code-reviewer, etc.
- By Model - claude-opus-4-6, moonshotai/kimi-k2.5, etc.
- By Time Period - hourly, daily, weekly buckets
- Trending - cost per day, anomaly detection
costctl automatically detects:
- Expensive Crons - Cron jobs exceeding the configured threshold (default $0.50)
- High Token Counts - Sessions with unusually high token counts (>100k)
- Opus Overkill - Opus model usage where cheaper models would suffice (<5k tokens)
Human-readable tables optimized for Discord/terminal display.
Structured output for Cortex dashboard integration.
- Session transcripts:
~/.openclaw/agents/{agent}/sessions/*.jsonl - Session index:
~/.openclaw/agents/{agent}/sessions/sessions.json
Each message contains:
usage.cost.total- Total cost in dollarsmodel- Model identifierusage.input/output- Token counts
agent:{name}:cron:{id}:run:{sid}→ cron jobagent:{name}:subagent:{sid}→ sub-agentagent:{name}→ interactive
go build -o costctlgo test ./...go run . report --period today --fullcostctl/
├── main.go # CLI entry point
├── go.mod # Go module
├── parser/ # Session file parsing
│ ├── parser.go
│ └── parser_test.go
├── reporter/ # Report generation
│ ├── reporter.go
│ └── reporter_test.go
├── formats/ # Output formatting
│ └── formats.go
└── README.md
MIT - Misty Step LLC