AI Usage for Openclaw

A comprehensive monitoring tool to track AI quota, token consumption, and estimated costs across Anthropic and other providers.

bshandley
v1.0.0
Feb 15, 2026
0
1.7k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install ai-usage

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install ai-usage using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is AI Usage?

The AI Usage skill is a specialized utility designed for developers and power users to gain full visibility into their AI model consumption. By integrating directly with Anthropic's OAuth usage API and parsing local session logs, it provides a unified dashboard for tracking weekly utilization, rolling windows, and model-specific spending. This is an essential component of the Openclaw Skills ecosystem for anyone needing to manage API budgets or monitor agent performance.

This skill bridges the gap between different providers by aggregating data from both cloud-based APIs and local session logs generated by OpenClaw. It allows you to visualize usage through formatted reports with gauges or export raw data for programmatic monitoring, ensuring you never hit unexpected limits during critical development tasks.

AI Usage Use Cases

  • Monitoring weekly Anthropic utilization percentages and reset countdowns to manage subscription tiers.
  • Auditing token counts and API costs per model for budget management and optimization.
  • Tracking usage across multiple providers including OpenAI, Ollama, and Anthropic through a single interface.
  • Automating daily usage heartbeats to notify developers of high spending or quota exhaustion.

How AI Usage Works

  1. The skill queries the Anthropic OAuth usage API using existing credentials from Claude Code to fetch real-time quota data.
  2. If the OAuth token is expired, it automatically invokes the Claude CLI to refresh credentials and resume data collection.
  3. It scans the local OpenClaw session directory to parse JSONL log files for historical token and cost statistics.
  4. The script aggregates these two data sources to calculate total usage, per-model breakdowns, and estimated API costs.
  5. Results are rendered as a visual terminal report or output as structured JSON for external consumption.

AI Usage Setup

Ensure you have Python 3.10+ and Claude Code installed and authenticated. Then, execute the usage check script within your environment:

# Run a visual report with gauges
python3 scripts/usage_check.py

# Export usage data as JSON for scripting
python3 scripts/usage_check.py --json

You can customize the session log path by setting the OPENCLAW_SESSIONS_DIR environment variable if your logs are stored in a non-standard location.

AI Usage Data Schema & Taxonomy

The skill interacts with and organizes data using the following file structures:

Source Path Description
Credentials ~/.claude/.credentials.json Stores OAuth tokens for Anthropic API access.
Session Logs ~/.openclaw/agents/main/sessions/*.jsonl Contains per-session token counts, model names, and cost metadata.
JSON Output Stdout (--json flag) Provides keys for anthropic_quota, session_stats, and provider_breakdown.

AI Usage Advanced Features

  • Automatic OAuth token refresh logic that ensures uninterrupted monitoring without manual re-authentication.
  • JSON output mode designed for integration with cron jobs, custom dashboards, or Slack/Discord alerts.
  • Lightweight execution profile compatible with Haiku or other efficient models for background heartbeat checks.
  • Multi-provider auto-detection that captures usage from any model routed through Openclaw Skills.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*