openclaw-cost-trackerTrack OpenClaw token usage and API costs by parsing session JSONL files. Use when user asks about token spend, API costs, model usage breakdown, daily cost t...
Install via ClawdBot CLI:
clawdbot install pfrederiksen/openclaw-cost-trackerParse OpenClaw session files to compute per-model token usage, costs, and daily spend trends. Works with any OpenClaw installation — no API keys or external services needed.
# All-time cost report
python3 scripts/cost_tracker.py
# Last 7 days
python3 scripts/cost_tracker.py --days 7
# Today only
python3 scripts/cost_tracker.py --days 1
# Since a specific date
python3 scripts/cost_tracker.py --since 2026-02-01
# JSON output for dashboards/integrations
python3 scripts/cost_tracker.py --days 30 --format json
# Custom agents directory
python3 scripts/cost_tracker.py --agents-dir /path/to/agents
Per-model breakdown:
Daily spend: Bar chart of cost per day (text) or structured array (JSON).
Grand totals: Combined cost, tokens, and requests across all models.
~/.openclaw/agents)message.usage and message.model from each entry{
"models": [
{
"model": "claude-opus-4-6",
"totalTokens": 220800000,
"inputTokens": 3200,
"outputTokens": 390800,
"cacheReadTokens": 149400000,
"cacheWriteTokens": 1200000,
"totalCost": 528.55,
"requestCount": 2088
}
],
"daily": [
{ "date": "2026-02-20", "cost": 37.14, "byModel": { "opus-4-6": 35.0, "sonnet-4": 2.14 } }
],
"grandTotal": { "totalCost": 580.11, "totalTokens": 269800000, "totalRequests": 3122 },
"meta": { "agentsDir": "...", "filesScanned": 65, "entriesParsed": 3122, "range": "7d" }
}
Feed JSON output into dashboards, alerting, or budgeting tools. The daily array is ready for charting. Set up a cron to track spend over time:
# Daily cost snapshot to file
0 0 * * * python3 /path/to/cost_tracker.py --days 1 --format json >> ~/cost-log.jsonl
~/.openclaw/agents/Generated Mar 1, 2026
A freelance developer uses multiple AI models like Claude and GPT for client projects and needs to track token usage to bill accurately and stay within budget. This skill parses local session files to provide per-model breakdowns and daily trends, helping them allocate costs and optimize model selection without API keys.
A small business integrates AI agents for customer support or content generation and wants to monitor monthly API costs to control expenses. The skill analyzes session data to show spending patterns, enabling budget adjustments and forecasting based on daily cost charts and model-specific usage.
A research team at an academic institution uses OpenClaw for experiments with different AI models and needs to analyze token consumption for grant reporting or efficiency studies. This tool aggregates request counts and token splits by model, supporting data-driven decisions on resource allocation.
A DevOps engineer manages AI-powered applications and needs to integrate cost tracking into monitoring dashboards for alerting on budget overruns. The skill's JSON output feeds into tools like Grafana, providing real-time insights into daily spend and model usage without external dependencies.
Offer a basic version of this cost tracker for free to attract users, then charge for advanced features like predictive budgeting, multi-user dashboards, or integration with cloud services. Revenue comes from subscription tiers targeting teams and enterprises needing detailed cost insights.
Provide consulting services to help businesses set up and customize the cost tracker for their specific OpenClaw workflows, including cron job automation and dashboard integration. Revenue is generated through one-time setup fees or ongoing support contracts.
Distribute the skill as open source to build a community, then monetize by offering premium support, custom development, or enterprise features like audit logs and compliance reporting. Revenue streams include support packages and tailored solutions for large organizations.
💬 Integration Tip
Set up a cron job to run the script daily with JSON output, then pipe the data into a visualization tool like a simple web dashboard or spreadsheet for easy monitoring and trend analysis.
Transform AI agents from task-followers into proactive partners that anticipate needs and continuously improve. Now with WAL Protocol, Working Buffer, Autonomous Crons, and battle-tested patterns. Part of the Hal Stack 🦞
Use the ClawdHub CLI to search, install, update, and publish agent skills from clawdhub.com. Use when you need to fetch new skills on the fly, sync installed skills to latest or a specific version, or publish new/updated skill folders with the npm-installed clawdhub CLI.
Clawdbot documentation expert with decision tree navigation, search scripts, doc fetching, version tracking, and config snippets for all Clawdbot features
Interact with Moltbook social network for AI agents. Post, reply, browse, and analyze engagement. Use when the user wants to engage with Moltbook, check their feed, reply to posts, or track their activity on the agent social network.
OpenClaw CLI wrapper — gateway, channels, models, agents, nodes, browser, memory, security, automation.
MoltGuard — runtime security plugin for OpenClaw agents by OpenGuardrails. Helps users install, register, activate, and check the status of MoltGuard. Use wh...