ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified developer tools Safety 5/5

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.

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/khaney64/session-cost
Or

What 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 --path flag.
  • Format Flexibility: For reporting or automated dashboards, use the --json flag to export data that can be ingested by third-party visualization tools.
  • Formatting: Use --table with --details to avoid cluttering your terminal when reviewing many sessions.
  • Limitation: The skill is currently read-only for logs generated by the main agent and cannot modify or delete session history. Ensure your user account has read permissions for the OpenClaw configuration directories.

Metadata

Author@khaney64
Stars1776
Views0
Updated2026-03-02
View Author Profile
AI Skill Finder

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 skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-khaney64-session-cost": {
      "enabled": true,
      "auto_update": true
    }
  }
}

Tags(AI)

#analytics#budgeting#logging#token-tracking#api-cost
Safety Score: 5/5

Flags: file-read