Install
openclaw skills install anthropic-usageQuery Anthropic Admin API for token usage reports (daily, weekly, monthly) with model breakdown. Requires an Anthropic Organization account. Configure your A...
openclaw skills install anthropic-usageYou are helping the user query their Anthropic token usage via the Admin API.
Check whether the API key is available:
[[ -n "${ANTHROPIC_ADMIN_API_KEY:-}" ]] && echo "KEY_EXISTS" || echo "KEY_MISSING"
KEY_MISSING: stop and guide the user through setup. Do NOT proceed until the variable is set.KEY_EXISTS: proceed.Tell the user they have two options:
Option 1 (recommended) — OpenClaw UI: Open the OpenClaw UI, go to Skills → anthropic-usage, enter the Admin API key in the API key field, and click Save key.
Option 2 — Edit ~/.openclaw/openclaw.json directly (for CLI users):
Add the key under the skill entry:
{
"skills": {
"entries": {
"anthropic-usage": {
"enabled": true,
"apiKey": "sk-ant-admin-..."
}
}
}
}
The gateway picks up the change automatically — no restart needed.
They can get an Admin API key from the Anthropic Console under Settings → API Keys → Admin keys. Their account must be on an Organization plan to access usage reports.
Once the key exists, run scripts/usage.sh with the appropriate flags based on what the user asked for:
| User intent | Command |
|---|---|
| Today's usage | bash scripts/usage.sh --daily |
| This week | bash scripts/usage.sh --weekly |
| This month | bash scripts/usage.sh --monthly |
| Breakdown by model | bash scripts/usage.sh --breakdown |
| Weekly + model breakdown | bash scripts/usage.sh --weekly --breakdown |
| Monthly + model breakdown | bash scripts/usage.sh --monthly --breakdown |
Run the command from the skill's root directory (where scripts/ lives), or use the full path to scripts/usage.sh.
After the script runs:
--breakdown was used, render the per-model table in a readable way.web_fetch tool to fetch https://www.anthropic.com/pricing and extract the current rates for each model that appeared in the results (input, cache write, cache read, and output token rates). Calculate the estimated cost per model and the total. Present this as a cost summary after the token table. If pricing for a model is not found on the page, note it as unknown and skip it in the total. This fetch is intentional and scoped to anthropic.com.Here's your Anthropic usage for the past 7 days:
📥 Input tokens: 12,450,000
📤 Output tokens: 1,830,000
🔢 Total tokens: 14,280,000
Model breakdown:
| Model | Input tokens | Output tokens |
|---------------------------|-------------|---------------|
| claude-opus-4-6 | 8,200,000 | 1,100,000 |
| claude-sonnet-4-6 | 3,900,000 | 680,000 |
| claude-haiku-4-5-20251001 | 350,000 | 50,000 |
💰 Estimated cost (prices fetched live from anthropic.com/pricing):
| Model | Estimated cost |
|---------------------------|----------------|
| claude-opus-4-6 | $152.40 |
| claude-sonnet-4-6 | $18.72 |
| claude-haiku-4-5-20251001 | $0.53 |
| **Total** | **$171.65** |
Keep the tone helpful and concise.