piyorotw

Pw Claude Usage Widget — AI skill for Claude Code

AI community

Always-on-top Windows widget showing your Claude Code usage — 5h, weekly & per-model limits with reset timers.

How to install Pw Claude Usage Widget

This entry records only its repository, not the path inside it, so there is no exact command to give. Open piyorotw/pw-claude-usage-widget and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Pw Claude Usage Widget does

Always-on-top Windows widget showing your Claude Code usage — 5h, weekly & per-model limits with reset timers.

Alternatives in AI

  • Claude Usage Tracker — Native macOS menu bar app for tracking Claude AI usage limits in real-time 2.2k ★
  • Token Monitor — Local-first desktop widget for tracking token usage, costs, and limits across 32+ AI coding tools—including Cl 1.8k ★
  • ClaudeCodeStatusLine — Custom status line for Claude Code showing model, tokens, rate limits, and git info in real-time 333 ★

README

Claude Usage Widget (Windows)

by **[piyorotw](https://github.com/piyorotw)**

วิดเจ็ตเล็ก ๆ ลอยชิดเหนือ taskbar โชว์การใช้งาน **Claude Code** แบบเรียลไทม์ — โลโก้ + 3 แถว: **5h** (รอบ 5 ชม.), **Wk** (สัปดาห์ ทุกโมเดล), **Fb** (สัปดาห์ เฉพาะโมเดล) แต่ละแถวมีแถบ เปอร์เซ็นต์ (เขียว/เหลือง/แดง) + เวลานับถอยหลังรอบ reset. รองรับหลายจอ · ปรับขนาด/ตำแหน่งสดได้

![demo](demo.png)

แหล่งข้อมูล (เรียงตามความแม่นยำ)

  1. API (กดโลโก้) → GET https://api.anthropic.com/api/oauth/usage ด้วย access token ของ Claude Code (~/.claude/.credentials.json) แบบ read-only — ได้เลขจริง. ใช้ได้เมื่อ token ในไฟล์ยังสด คือช่วงที่ใช้ Claude Code ใน terminal อยู่ (use_api: false เพื่อปิด)
  2. status line → ~/.claude/last-statusline.json (Claude Code เขียนให้ตอน render status line ใน terminal) = เลขจริง 5h/Wk โดยไม่ต้องแตะ token เลย — แนะนำ ถ้าใช้ terminal
  3. ประมาณจาก token (~) → เมื่อ 1+2 ใช้ไม่ได้ (คร่าวๆ ไม่แม่น)

**`auto_refresh_token`** (default `false`) — ถ้าใช้ Claude Code **แบบ App เป็นหลัก** (ไม่ค่อย login terminal) token ในไฟล์จะเก่าเรื่อยๆ ตั้ง **`"auto_refresh_token": true`** ให้วิดเจ็ต **ต่ออายุ token เอง** (refresh + เขียนกลับ `.credentials.json`, เก็บ `.bak` ให้) → ใช้ได้ยาวโดย ไม่ต้อง login ซ้ำ. **เปิดเฉพาะตอนใช้ App** (App เก็บ token คนละที่กับ CLI จึงไม่กระทบกัน) — ต้อง `/login` ใน terminal ให้สำเร็จ **1 ครั้งแรก** เพื่อให้มี refresh token ที่ยังไม่หมดอายุ

ถ้า `false` = read-only ล้วน (ปลอดภัยสุด) — เลขจริงจะมาเฉพาะช่วง token ยังสด (เพิ่ง login/ใช้ CLI)

**`api_poll_minutes`** (default `10`, `0` = ปิด) — ดึงเลขจริงจาก API เองทุกกี่นาที เพื่อให้ 3 แถว **อัปเดตเองไม่ต้องกดโลโก้**. ใช้คู่กับ `auto_refresh_token: true` จะได้เลขสดตลอดแบบไม่ต้องแตะเลย (endpoint มี rate-limit — อย่าตั้งต่ำกว่า ~5 นาที)

token ถูกส่งไปที่ **api.anthropic.com เท่านั้น** ไม่ log/ไม่ส่งที่อื่น (เขียนกลับ `.credentials.json` เฉพาะตอนเปิด `auto_refresh_token`). ไอเดียจาก widget เพื่อน (macOS): github.com/PanithanNanti/claude-usage-