Skills ai-usage
install
source · Clone the upstream repo
git clone https://github.com/openclaw/skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/bshandley/ai-usage" ~/.claude/skills/openclaw-skills-ai-usage && rm -rf "$T"
OpenClaw · Install into ~/.openclaw/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/skills/bshandley/ai-usage" ~/.openclaw/skills/openclaw-skills-ai-usage && rm -rf "$T"
manifest:
skills/bshandley/ai-usage/SKILL.mdsource content
AI Usage Check
Quick Start
python3 scripts/usage_check.py # Pretty report with gauges python3 scripts/usage_check.py --json # JSON output for scripting
Requirements
- Python 3.10+ (no pip dependencies — stdlib only)
- Claude Code installed and authenticated (
CLI in PATH) — for Anthropic quotaclaude - OpenClaw installed — for session log token/cost stats
What It Shows
Anthropic (real quota from OAuth API):
- Weekly utilization % with reset countdown
- 5-hour rolling window %
- Model-specific weekly (Sonnet, Opus) when available
- Extra usage spend vs monthly limit
Other Providers (from OpenClaw session logs):
- Token counts and call counts per model
- Auto-detects any provider OpenClaw routes through (Ollama, OpenAI, etc.)
OpenClaw Anthropic breakdown:
- Per-model token counts and equivalent API cost
How It Works
- Anthropic quota:
using Claude Code's OAuth token fromGET https://api.anthropic.com/api/oauth/usage
(requires~/.claude/.credentials.json
scope)user:profile - Token auto-refresh: If the token is expired, the script automatically refreshes it by invoking
(Claude Code refreshes its own OAuth token on any invocation), then re-reads the updated credentials file. If Claude Code isn't installed, Anthropic quota is skipped gracefully.claude --print -p "ok" - Session stats: Parses
for per-provider/model token and cost data~/.openclaw/agents/main/sessions/*.jsonl
Environment Variables
| Variable | Default | Description |
|---|---|---|
| | OpenClaw session log directory |
| | Claude Code credentials file |
Tips
- Run via Haiku or a lightweight model for heartbeat/background checks — the script just needs to execute, no reasoning required
- Use
for programmatic consumption (cron jobs, dashboards, alerts)--json - Works with any Anthropic subscription tier (Pro, Max, Team, etc.)