<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rosehsu</title>
    <description>The latest articles on DEV Community by Rosehsu (@rosehsu47).</description>
    <link>https://dev.to/rosehsu47</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4164438%2F93dac81e-31de-470c-8ce9-228fc4328a7f.jpg</url>
      <title>DEV Community: Rosehsu</title>
      <link>https://dev.to/rosehsu47</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rosehsu47"/>
    <language>en</language>
    <item>
      <title>想知道 Claude Code 額度被哪個專案吃掉，就寫了個小工具</title>
      <dc:creator>Rosehsu</dc:creator>
      <pubDate>Mon, 05 Oct 2026 17:10:38 +0000</pubDate>
      <link>https://dev.to/rosehsu47/xiang-zhi-dao-claude-code-e-du-bei-na-ge-zhuan-an-chi-diao-jiu-xie-liao-ge-xiao-gong-ju-2m0o</link>
      <guid>https://dev.to/rosehsu47/xiang-zhi-dao-claude-code-e-du-bei-na-ge-zhuan-an-chi-diao-jiu-xie-liao-ge-xiao-gong-ju-2m0o</guid>
      <description>&lt;p&gt;撞到 Claude Code 5 小時或每週上限的時候，我最想知道的是哪個專案用掉的，但 &lt;code&gt;/usage&lt;/code&gt; 答不出來。它只給帳號層級的百分比，再加幾個像「&amp;gt;150k context」、「4+ parallel sessions」的標籤，沒有拆到專案，那些百分比也沒辦法自己驗算。&lt;/p&gt;

&lt;p&gt;Claude Code 本來就會把每則訊息的 token 用量寫進本機的 session transcript（&lt;code&gt;~/.claude/projects/*/*.jsonl&lt;/code&gt;）。所以我寫了一個 skill 叫 quota-audit，讀這些檔案，按專案、按 skill 整理用量，也列出真正撞到上限的時間點和當下被擋的 repo。它只讀檔，不會寫入任何東西，資料也不會送出去。&lt;/p&gt;

&lt;h2&gt;
  
  
  報表長怎樣
&lt;/h2&gt;

&lt;p&gt;開頭先放幾行算好的結論，接著每個視窗（5h、24h、7d）一列總覽，最後才是最長那個視窗的明細。節錄一段範例：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;KEY FINDINGS (7d window)
  • Estimated cost $147.31, 65% of it in my-app ($95.20)
  • Top skill is ai-work at 54%
  • 11 sessions crossed 150k context, $88.40 combined (60% of window cost)
  • 3 rate-limit hits in 7d; 14 all-time, most often blocking my-app (9 times)

window     est. cost  sessions   &amp;gt;150k   hits   top project
5h            $12.40         5       2      0   my-app 81%
24h           $38.75        21       4      1   my-app 70%
7d           $147.31        99      11      3   my-app 65%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;skill 是逐則訊息歸因的，不是只看 session 用哪個指令開頭，所以具名 skill 跟一般互動的切分比較可信。超過 150k context 的 session 會直接列出名字，依花費由高到低排，這通常是最值得先處理的地方。撞限紀錄則依 repo 和時段彙總。&lt;/p&gt;

&lt;p&gt;另外還有一個異常偵測，抓那種瀏覽器分頁或腳本開著、每一兩分鐘打一次的輪詢迴圈。這類迴圈會讓 session 數暴增，卻沒有真的花到額度，先抓出來就不用追一個不存在的成本。想看每個視窗的明細和每一筆撞限紀錄，給 &lt;code&gt;render.py&lt;/code&gt; 加 &lt;code&gt;--full&lt;/code&gt; 就好。&lt;/p&gt;

&lt;h2&gt;
  
  
  怎麼裝
&lt;/h2&gt;

&lt;p&gt;目前版本是 v1.3.0。在互動式 Claude Code session 裡：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/plugin marketplace add rosehsu47/claude-code-quota-audit
/plugin install quota-audit@rosehsu47
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;或非互動式：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude plugin marketplace add rosehsu47/claude-code-quota-audit
claude plugin &lt;span class="nb"&gt;install &lt;/span&gt;quota-audit@rosehsu47
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;如果安裝結果顯示 &lt;code&gt;Run /reload-plugins to activate&lt;/code&gt;，就跑一下那個指令。裝好之後直接問「額度都被誰用掉」或「token 都花在哪」就會觸發，也可以打 &lt;code&gt;/quota-audit&lt;/code&gt; 明確呼叫。報表語言會依 shell 的 locale 自動選繁中或英文，想固定的話設 &lt;code&gt;QUOTA_AUDIT_LANG=zh&lt;/code&gt; 或 &lt;code&gt;QUOTA_AUDIT_LANG=en&lt;/code&gt;。&lt;/p&gt;

&lt;h2&gt;
  
  
  做不到的事
&lt;/h2&gt;

&lt;p&gt;美金數字是用工具內建的定價快照估出來的，不是帳單。專案之間的比例比較可信，總額建議拿即時的 &lt;code&gt;claude -p "/usage"&lt;/code&gt; 對照一下。每個專案各自的 subagent 花費目前拿不到。範圍也跟 &lt;code&gt;/usage&lt;/code&gt; 一樣，只看這台機器，不包含其他裝置或 claude.ai 上的用量。&lt;/p&gt;

&lt;p&gt;原始碼放在 &lt;a href="https://github.com/rosehsu47/claude-code-quota-audit" rel="noopener noreferrer"&gt;github.com/rosehsu47/claude-code-quota-audit&lt;/a&gt;，很想聽聽大家平常都怎麼追額度花到哪裡去。&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>ai</category>
      <category>productivity</category>
      <category>opensource</category>
    </item>
    <item>
      <title>I wanted to know which project was eating my Claude Code quota</title>
      <dc:creator>Rosehsu</dc:creator>
      <pubDate>Mon, 05 Oct 2026 17:10:37 +0000</pubDate>
      <link>https://dev.to/rosehsu47/i-wanted-to-know-which-project-was-eating-my-claude-code-quota-5e7k</link>
      <guid>https://dev.to/rosehsu47/i-wanted-to-know-which-project-was-eating-my-claude-code-quota-5e7k</guid>
      <description>&lt;p&gt;When I hit my Claude Code 5-hour or weekly limit, I want to know which project used it up. &lt;code&gt;/usage&lt;/code&gt; doesn't answer that. It gives account-wide percentages plus a few tags like "&amp;gt;150k context" or "4+ parallel sessions". Nothing is broken down per project, and I can't check those percentages against anything.&lt;/p&gt;

&lt;p&gt;Claude Code already writes per-message token usage into every local session transcript under &lt;code&gt;~/.claude/projects/*/*.jsonl&lt;/code&gt;. So I wrote a plugin, quota-audit, that reads those files and breaks the usage down per project and per skill. It also shows the exact times a rate limit was hit and which repo was blocked. Everything stays on your machine. It only reads those files and sends nothing anywhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the report looks like
&lt;/h2&gt;

&lt;p&gt;It opens with a few computed findings. After that comes one overview row per window (5h, 24h, 7d), then detail for the longest window. Here's a trimmed example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;KEY FINDINGS (7d window)
  • Estimated cost $147.31, 65% of it in my-app ($95.20)
  • Top skill is ai-work at 54%
  • 11 sessions crossed 150k context, $88.40 combined (60% of window cost)
  • 3 rate-limit hits in 7d; 14 all-time, most often blocking my-app (9 times)

window     est. cost  sessions   &amp;gt;150k   hits   top project
5h            $12.40         5       2      0   my-app 81%
24h           $38.75        21       4      1   my-app 70%
7d           $147.31        99      11      3   my-app 65%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Skills are attributed per message, not by whatever command a session started with, so the split between named skills and general interactive use holds up. Sessions that crossed 150k context are listed by name with the most expensive first, because that's usually the biggest lever. Rate-limit hits are grouped by repo and time of day.&lt;/p&gt;

&lt;p&gt;There's also a check for polling loops, like a browser tab or script left open and calling something every minute or two. Those inflate session counts without spending real quota. To see every window's detail and every individual hit, pass &lt;code&gt;--full&lt;/code&gt; to &lt;code&gt;render.py&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trying it
&lt;/h2&gt;

&lt;p&gt;The current version is v1.3.0. Inside an interactive Claude Code session:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/plugin marketplace add rosehsu47/claude-code-quota-audit
/plugin install quota-audit@rosehsu47
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or non-interactively:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude plugin marketplace add rosehsu47/claude-code-quota-audit
claude plugin &lt;span class="nb"&gt;install &lt;/span&gt;quota-audit@rosehsu47
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the install summary says &lt;code&gt;Run /reload-plugins to activate&lt;/code&gt;, run that. After that, ask something like "who's eating my quota" or "which repo is burning through my 5-hour limit". You can also call &lt;code&gt;/quota-audit&lt;/code&gt; directly. The report comes out in English or Traditional Chinese depending on your locale. Set &lt;code&gt;QUOTA_AUDIT_LANG=en&lt;/code&gt; or &lt;code&gt;QUOTA_AUDIT_LANG=zh&lt;/code&gt; to force one.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it can't do
&lt;/h2&gt;

&lt;p&gt;The dollar figures are estimates from a pricing snapshot bundled with the plugin. They are not your bill. I'd trust the ratios between projects more than the absolute total, and I'd check the total against a live &lt;code&gt;claude -p "/usage"&lt;/code&gt;. Per-project subagent cost isn't available. Like &lt;code&gt;/usage&lt;/code&gt;, it only sees the machine it runs on, not other devices or claude.ai.&lt;/p&gt;

&lt;p&gt;The code is at &lt;a href="https://github.com/rosehsu47/claude-code-quota-audit" rel="noopener noreferrer"&gt;github.com/rosehsu47/claude-code-quota-audit&lt;/a&gt;, and I'd like to hear how other people figure out where their quota goes.&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>ai</category>
      <category>productivity</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
