← 返回 Skills 市场
719
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install ai-usage
功能描述
Check AI token usage, quotas, and costs across Anthropic and other providers using Anthropic OAuth API and OpenClaw session logs.
使用说明 (SKILL.md)
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 (
claudeCLI in PATH) — for Anthropic quota - 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:
GET https://api.anthropic.com/api/oauth/usageusing Claude Code's OAuth token from~/.claude/.credentials.json(requiresuser:profilescope) - Token auto-refresh: If the token is expired, the script automatically refreshes it by invoking
claude --print -p "ok"(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. - Session stats: Parses
~/.openclaw/agents/main/sessions/*.jsonlfor per-provider/model token and cost data
Environment Variables
| Variable | Default | Description |
|---|---|---|
OPENCLAW_SESSIONS_DIR |
~/.openclaw/agents/main/sessions |
OpenClaw session log directory |
CLAUDE_CREDENTIALS_PATH |
~/.claude/.credentials.json |
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
--jsonfor programmatic consumption (cron jobs, dashboards, alerts) - Works with any Anthropic subscription tier (Pro, Max, Team, etc.)
安全使用建议
This skill appears to do what it says: it reads OpenClaw session logs and your local Claude credentials to call Anthropic's OAuth usage endpoint. Before installing, review the included script yourself (it is present and readable) and confirm you trust the skill source. Note that it will read ~/.claude/.credentials.json (or the path set by CLAUDE_CREDENTIALS_PATH) and may invoke the local 'claude' CLI to refresh tokens; these actions are required to obtain accurate quota data but expose local credentials to the skill code. If you are uncomfortable, run the script manually in a restricted environment or inspect/modify it to remove any behavior you don't want (for example, printing or transmitting tokens). Also consider that the registry metadata omits the optional env var overrides documented in SKILL.md — expect to set those if your paths differ.
功能分析
Type: OpenClaw Skill
Name: ai-usage
Version: 1.0.0
The skill is designed to check AI usage across Anthropic and other providers. It legitimately accesses `~/.claude/.credentials.json` to retrieve OAuth tokens for Anthropic API calls and executes the `claude` CLI tool to refresh these tokens. It also parses local OpenClaw session logs for usage statistics. All file access, external command execution, and network requests are directly aligned with its stated purpose and target official endpoints or local files. There is no evidence of data exfiltration, arbitrary command injection, persistence mechanisms, or prompt injection attempts against the agent.
能力评估
Purpose & Capability
The skill claims to report Anthropic quotas and OpenClaw-derived token/cost stats and its code reads ~/.openclaw session logs and the Claude credentials file and calls the Anthropic OAuth usage endpoint — these capabilities align with the stated purpose.
Instruction Scope
SKILL.md and the script instruct the agent to read OpenClaw session JSONL files and the Claude credentials file and to invoke the local 'claude' CLI to trigger an OAuth refresh. This is within the expected scope for retrieving usage/quota, but it does mean the skill reads a local credentials file and executes a local CLI.
Install Mechanism
No remote install/downloads or package installs are specified. The skill is instruction-only with an included Python script (no external network fetches for code), which minimizes installation risk.
Credentials
The script accesses the Claude credentials file and the OpenClaw sessions directory (both justified by the stated purpose). Minor metadata mismatch: registry lists no required env vars/primary credential, but SKILL.md documents optional overrides (OPENCLAW_SESSIONS_DIR and CLAUDE_CREDENTIALS_PATH).
Persistence & Privilege
The skill is not marked always:true, requests no elevated platform privileges, does not modify other skills, and only reads local logs/credentials and invokes a local CLI — no persistent/privileged behavior detected.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install ai-usage - 安装完成后,直接呼叫该 Skill 的名称或使用
/ai-usage触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: Anthropic quota via OAuth with auto token refresh, OpenClaw session log stats, pretty gauges + JSON output
元数据
常见问题
AI Usage 是什么?
Check AI token usage, quotas, and costs across Anthropic and other providers using Anthropic OAuth API and OpenClaw session logs. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 719 次。
如何安装 AI Usage?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install ai-usage」即可一键安装,无需额外配置。
AI Usage 是免费的吗?
是的,AI Usage 完全免费(开源免费),可自由下载、安装和使用。
AI Usage 支持哪些平台?
AI Usage 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 AI Usage?
由 bshandley(@bshandley)开发并维护,当前版本 v1.0.0。
推荐 Skills