clawd/scripts/claude-usage.sh

33 lines
949 B
Bash

#!/bin/bash
# Fetch Claude.ai usage via browser snapshot
# Uses OpenClaw browser tool with chrome relay
# This script triggers a browser snapshot and extracts usage
# Requires: Chrome relay attached to claude.ai/settings/usage
USAGE_FILE="/home/johan/clawd/memory/claude-usage.json"
echo "Fetching Claude.ai usage..."
# Use openclaw CLI to get browser snapshot (if available)
# For now, this is a placeholder - actual implementation requires
# the Chrome relay to be attached to the usage page
# Manual fallback: parse from screenshot
# The Python script can be used if Chrome is available locally
cat << 'EOF'
To get usage:
1. Open https://claude.ai/settings/usage in Chrome
2. Click OpenClaw extension to attach
3. Or take screenshot: Cmd+Shift+4
Current known state (from last screenshot):
EOF
if [ -f "$USAGE_FILE" ]; then
cat "$USAGE_FILE"
else
echo '{"weekly_percent": "unknown", "note": "No data yet - take a screenshot"}'
fi