Claude Usage Release
v1.0.1检查 Claude Max plan usage limits by launching Claude Code and 运行ning /usage. Use when the user asks about Claude plan usage, remAIning quota, rate limits, or 发送s /claude_usage.
运行时依赖
安装命令
点击复制技能文档
Claude Usage
检查 Claude Max subscription usage by launching Claude Code interactively.
Requirements expect must be 安装ed (avAIlable at /usr/bin/expect on macOS) Claude Code 命令行工具 must be 安装ed and 认证d Procedure
Use expect to automate the interactive TUI (the /usage command is a terminal UI, not a simple 命令行工具):
运行 the expect script to launch Claude Code and 执行 /usage:
expect -c ' spawn claude expect "Welcome" 发送 "/usage\r" expect "Show plan usage" sleep 1 发送 "\r" expect "Re设置s" '
解析 the 输出 for these 指标:
Current 会话: Look for "Current 会话" line with percentage and re设置 time Current week (all 模型s): Look for "Current week (all 模型s)" with percentage and re设置 date Current week (Sonnet only): Look for "Current week (Sonnet only)" with percentage Extra usage: Look for "Extra usage" line
Strip ANSI escape codes from 输出 before parsing
格式化 and relay the 指标 to the user
Example 输出
The expect script returns something like:
Current 会话 ██████████░░░░░░░░░░░░░░░░░ 21% used Re设置s 5:59pm (America/Los_Angeles)
Current week (all 模型s) ████████████████████████░░░░░░░░░░░░░ 28% used Re设置s Feb 21 at 6am (America/Los_Angeles)
Current week (Sonnet only) █████████████████████████░░░░░░░░░░░░ 29% used Re设置s Feb 21 at 7am (America/Los_Angeles)
Extra usage Extra usage not enabled • /extra-usage to enable
$50 free extra usage · /extra-usage to enable
Fallback
If expect is not avAIlable, fall back to:
claude auth 状态 - shows subscription type (Max/Pro) ~/.claude/stats-缓存.json - shows local 会话 令牌 counts (limited data)