ClaudeMods
☰
KO
● 0 명 접속 중 · 조회 0 회
후원프로젝트 제출
GitHub 저장소 · 작성자 muratkaragozgil

usage-bar

프롬프트 위에 한 줄 사용량 상태 표시줄을 보여 주며 5시간, 주간, 모델별 플랜 할당량과 재설정 카운트다운, 현재 세션의 token 및 비용을 포함합니다.

muratkaragozgil@muratkaragozgil

muratkaragozgil/claude-code-usage-bar

원본 게시물 이미지1
번역 완료

이 mod 소개

이 Claude Code mod는 프롬프트 위에 한 줄 상태 표시줄을 그립니다. 5시간 플랜 할당량, 전체 모델 주간 할당량, 모델별 주간 할당량(예: Fable)과 재설정 카운트다운을 보여 주고, 현재 세션의 입력, 출력, 프롬프트 캐시 token과 비용도 표시합니다. 공간이 부족하면 덜 중요한 필드를 순서대로 버리지만 막대 그래프와 백분율은 항상 남깁니다. claude plugin marketplace 및 claude plugin install로 설치하며 Claude Code 2.1.287 이상이 필요하고 /usage-bar로 표시를 전환합니다. mod는 session.start, session.measure, turn.complete, session.end, command.run, ui.render 등의 훅을 사용하며 Claude Code 자격 증명으로 Anthropic 사용량 엔드포인트에서 플랜 할당량을 가져옵니다. 읽은 데이터는 모두 로컬 메모리에만 남습니다.

설치

먼저 작성자의 README에서 marketplace와 플러그인 이름을 확인하세요. 저장소 구조에 따라 명령어가 달라질 수 있습니다.

claude plugin marketplace add muratkaragozgil/claude-code-usage-bar
claude plugin install usage-bar
원문 / README

Usage Bar for Claude Code

A one-line usage bar above the Claude Code prompt. It keeps your plan limits in view (the 5-hour window, the weekly window, and per-model weekly limits such as Fable), each with its reset countdown, next to the tokens and cost of the current session.

The usage bar above the Claude Code prompt, dark theme

What it shows

| Item | Meaning | | --- | --- | | 5h ▬ 26% · 2h 16m | 5-hour plan limit: share used, time until it resets | | 7d ▬ 28% · 4d 2h | Weekly limit across all models | | Fable ▬ 12% · 4d 2h | A per-model weekly limit, shown when your plan has one | | ↑ 1.2k | Input tokens this session (the part not served from the prompt cache) | | ↓ 26.1k | Output tokens this session | | ⟲ 5.00M | Prompt-cache tokens this session (read + written) | | $ 4.87 | Session cost at API prices, the same figure /cost shows |

The bar stays on a single line at any width. When space runs out it drops the least useful parts first: the per-model countdown, the weekly countdown, cache, input and output tokens, the 5-hour countdown, then cost. The bars and percentages always stay.

Install

You need Claude Code 2.1.287 or newer; mods are on by default from that version.

Run these two commands in a terminal:

claude plugin marketplace add MuratKaragozgil/claude-code-usage-bar
claude plugin install usage-bar@claude-code-usage-bar

Then start a new Claude Code session. The bar appears above the prompt, in the terminal and in the Code tab of the Claude desktop app.

You can also install from inside a terminal Claude Code session:

/plugin marketplace add MuratKaragozgil/claude-code-usage-bar
/plugin install usage-bar@claude-code-usage-bar
/reload-plugins

Use

There is nothing to configure. Type /usage-bar to hide the bar, and again to bring it back.

The plan limits need a claude.ai login (Pro, Max, Team or Enterprise). Signed in with an API key, the bar shows tokens and cost only.

Update or remove

claude plugin marketplace update claude-code-usage-bar
claude plugin update usage-bar@claude-code-usage-bar
claude plugin uninstall usage-bar@claude-code-usage-bar
claude plugin marketplace remove claude-code-usage-bar

How it works

The plugin is a Claude Code mod: one readable TypeScript module of function hooks, hooks/register.tsx.

Each hook, and what it does with what it sees:

| Hook | What it does | | --- | --- | | session.start | Reads the session's usage figures from Claude Code and registers the /usage-bar command. Starts a timer that moves the countdowns every 30 seconds and refreshes the plan limits every five minutes, the first time right after the session starts. Passes the event on unchanged. | | session.measure | Copies the 5-hour and weekly percentages, their reset times and the session cost into the bar. Passes the event on unchanged. | | turn.complete | Adds the turn's token counts to the session totals, subagent turns included. It reads only the counts, never the text of the turn. Passes the event on unchanged. | | session.end | On /clear, sets the token totals back to zero. Passes the event on unchanged. | | command.run | Matches only /usage-bar, which it answers by hiding or showing the bar. It never sees, runs or changes any other command. | | ui.render | Matches only the AbovePrompt site, where it draws the bar: SVG bars on the desktop, text bars in the terminal. It leaves the rest of the screen to Claude Code. |

What it fetches, sends and runs

  • Fetches: GET https://api.anthropic.com/api/oauth/usage, Anthropic's endpoint behind the desktop app's usage card and /usage. It returns the plan's usage limits, including the per-model weekly ones that the API's rate-limit headers don't carry.
    • When: when a session starts, every five minutes, and when a limit moves, at most once a minute.
    • Credential: the request carries Claude Code's own credential through $.session.authorize(). That call returns an opaque handle, so your token never reaches the plugin.
  • Sends: only that request, which has no body. None of what the plugin reads (usage figures, token counts, cost) leaves your machine, and nothing goes to any other host.
  • Runs: nothing. No processes, shell commands, tools, agents or MCP calls. It installs no packages and writes no files.
  • Keeps: everything it reads stays in Claude Code's memory for the session and is discarded when the session ends.

The full privacy policy is in PRIVACY.md.

The endpoint is undocumented and may change. If it fails, the 5-hour and weekly bars keep working from the session's own data, and a single line in the transcript says why the per-model limits are missing.

Troubleshooting

  • The bar doesn't appear. Check claude --version (2.1.287 or newer) and that claude plugin list shows usage-bar@claude-code-usage-bar as enabled. Then start a new session; a running session doesn't pick up a new install. If you typed /usage-bar earlier, the bar is hidden, so type it again.
  • No 5h or 7d bars. You're signed in with an API key, where plan limits don't apply. Or the session hasn't had a reply yet and the usage endpoint was unreachable; the bars appear after the first reply.
  • No per-model bar (Fable). Your plan may have no per-model limit right now. Otherwise, look for a transcript line starting usage-bar: per-model limits unavailable:
    • answered 401: sign in again with /login.
    • answered 429: the plugin waits ten minutes and tries again.
    • signed in with an API key: per-model limits apply to claude.ai plans only.
  • Countdowns or token counts are missing. The window is too narrow, so the bar dropped them to stay on one line. Widen the window.

Support

Report bugs and ask questions in GitHub Issues. For security concerns, see SECURITY.md.

Development

git clone https://github.com/MuratKaragozgil/claude-code-usage-bar
cd claude-code-usage-bar
claude --plugin-dir .                       # load it from disk for one session
claude plugin validate --strict ./.claude-plugin/plugin.json
claude plugin test .

The tests mount the band on the terminal and desktop surfaces, with the usage endpoint answering and refusing, at a wide and a narrow width. tsconfig.json extends .claude-plugin/types/tsconfig.json, which Claude Code writes, along with the API's type declarations, the first time it loads the plugin from your folder.

.claude-plugin/plugin.json        the plugin manifest
.claude-plugin/marketplace.json   makes this repository a one-plugin marketplace
hooks/hooks.json                  points Claude Code at the module
hooks/register.tsx                the whole mod
types/index.d.ts                  the types of the values it keeps in $.state
tests/render.test.ts              claude plugin test suite

License

MIT. This is a community project, not affiliated with or endorsed by Anthropic.

동명의 다른 작품

비슷한 프로젝트