想知道 Claude Code 額度被哪個專案吃掉,就寫了個小工具
撞到 Claude Code 5 小時或每週上限的時候,我最想知道的是哪個專案用掉的,但 /usage 答不出來。它只給帳號層級的百分比,再加幾個像「>150k context」、「4+ parallel sessions」的標籤,沒有拆到專案,那些百分比也沒辦法自己驗算。 Claude Code 本來就會把每則訊息的 token 用量寫進本機的 session transcript( ~/.claude/projects/*/*.jsonl )。所以我寫了一個 skill 叫 quota-audit,讀這些檔案,按專案、按 skill 整理用量,也列出真正撞到上限的時間點和當下被擋的 repo。它只讀檔,不會寫入任何東西,資料也不會送出去。 報表長怎樣 開頭先放幾行算好的結論,接著每個視窗(5h、24h、7d)一列總覽,最後才是最長那個視窗的明細。節錄一段範例: KEY…
To find out which project consumed the Claude Code quota, a reporter created a small tool called "quota-audit". This tool reads the session transcripts stored in the ~/.claude/projects/*/*.jsonl files, organizes the usage by project and skill, and displays the time point and repository where the limit was reached. The tool only reads the files and does not send any data.
The report starts with a few conclusions, then shows the overview for each time window (5h, 24h, and 7d), and finally details the longest window. For example, in a 7-day window, Claude Code estimated a cost of $147.31, with 65% of it allocated to the project "my-app" ($95.20). The top skill was "ai-work" at 54% of the cost, and 11 sessions exceeded the 150k context limit, totaling $88.40 (60% of the window cost).
Additionally, there were 3 rate-limit hits in the 7-day period, with 14 all-time, most often blocking the "my-app" project.
To install the tool, use the command "/plugin marketplace add rosehsu47/claude-code-quota-audit /plugin install quota-audit@rosehsu47" in an interactive Claude Code session, or "claude plugin marketplace add rosehsu47/claude-code-quota-audit claude plugin install quota-audit@rosehsu47" on the command line. After installation, simply ask "How is the quota used?" or "Where are the tokens being spent" and the tool will trigger.
The language of the report will automatically adjust based on the shell's locale (Simplified Chinese or English), and can be set to a specific language using the environment variable QUOTA_AUDIT_LANG. The tool cannot provide real-time billing information or track usage on other devices or Claude.ai. Its source code is available at github.com/rosehsu47/claude-code-quota-audit.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.