session-usage
Installation
SKILL.md
Read
{ { security find-generic-password -s "Claude Code-credentials" -w 2>/dev/null \
|| cat ~/.claude/.credentials.json; } \
| jq -r '.claudeAiOauth.accessToken' \
| { read -r T; https --ignore-stdin --check-status --timeout=10 --print=b \
GET api.anthropic.com/api/oauth/usage \
"Authorization: Bearer $T" "anthropic-beta: oauth-2025-04-20"; } 2>/dev/null \
| jq -c '[.limits[] | select(.percent != null)
| {w: (.scope.model.display_name // .kind), pct: .percent, resets: .resets_at}]'; } \
|| echo "usage unknown"
Run it verbatim: the token stays unprinted, --ignore-stdin keeps httpie off the credential pipe, --check-status makes an HTTP error exit non-zero.
w is session (5h), weekly_all, or a model name (that model's own weekly). resets: null means the window is not open. On usage unknown, carry on unmeasured — the endpoint is undocumented and never blocks work.