session-cost
Analyze OpenClaw session logs to report token usage, costs, and performance metrics grouped by model. Use when the user asks about API spending, token usage, session costs, or wants a usage summary.
Why use this skill?
Analyze your OpenClaw token usage, monitor API spending, and track performance metrics by model. Install session-cost to optimize your AI budget today.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/khaney64/session-costWhat This Skill Does
The session-cost skill is a powerful diagnostic tool designed for OpenClaw users who need to track their AI expenditure, monitor model performance, and analyze usage patterns. By parsing the .jsonl session log files generated by the OpenClaw agent, this skill calculates exact token consumption for both input and output across various providers like Anthropic, OpenAI, and Ollama. It provides granular visibility into cached tokens, associated costs, and session frequency, enabling developers and power users to maintain tight control over their API budgets.
Installation
To integrate this utility into your OpenClaw environment, run the following command in your terminal:
clawhub install openclaw/skills/skills/khaney64/session-cost
Use Cases
This skill is indispensable for:
- Budget Management: Calculating exact daily, weekly, or monthly spend on AI models to prevent cost overruns.
- Performance Tuning: Identifying which models consume the most tokens or incur the highest costs during specific workflows.
- Auditing: Reviewing usage history to troubleshoot unexpected spikes in API billing or to verify the efficacy of prompt caching strategies.
- Optimization: Determining if moving to a cheaper model or optimizing prompt structure would yield significant savings.
Example Prompts
- "How much have I spent on Anthropic models in the last 7 days?"
- "Can you generate a summary of all my session costs and show the breakdown for the main agent?"
- "What is the token usage and cost for my recent coding sessions, specifically for the last 24 hours?"
Tips & Limitations
- Default Path: By default, the skill scans
~/.openclaw/agents/main/sessions/. If you are using custom agent paths, ensure you use the--pathflag. - Format Flexibility: For reporting or automated dashboards, use the
--jsonflag to export data that can be ingested by third-party visualization tools. - Formatting: Use
--tablewith--detailsto avoid cluttering your terminal when reviewing many sessions. - Limitation: The skill is currently read-only for logs generated by the
mainagent and cannot modify or delete session history. Ensure your user account has read permissions for the OpenClaw configuration directories.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-khaney64-session-cost": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-read
Related Skills
leak-check
Scan session logs for leaked credentials. Checks JSONL session files against known credential patterns and reports which AI provider received the data.
discogs-sync
Add and remove albums from a Discogs wantlist or collection by artist and album name, master ID, or release ID. Search marketplace pricing for vinyl, CD, and other formats. List wantlist and collection contents. Use when the user asks to add or remove a record from their Discogs wantlist or collection, check what's on their wantlist, look up marketplace prices, or find what a record is selling for. Also supports bulk operations via CSV/JSON file input.
minimax-usage
Check MiniMax coding plan usage/credits remaining. Requires MINIMAX_API_KEY environment variable.
baseball
Fetch MLB game schedules, live game status, box scores, player search, and season statistics via the MLB Stats API. Use when the user asks about baseball games, scores, who is playing today, game results, live updates, pitching matchups, MLB schedule information, player lookups, or player stats.
quodd
Fetch real-time stock quotes via Quodd API. Get current prices, daily high/low, and after-hours data for US equities. Use when the user asks for stock prices, quotes, market data, or ticker information.