메뉴
HN
Hacker News 49일 전

macOS 메뉴 바에서 클로드 코드 사용량 확인 위젯

IMP
6/10
핵심 요약

macOS 메뉴 바에서 Claude Code의 5시간 단위 및 주간 사용량을 실시간으로 모니터링할 수 있는 오픈소스 위젯이 공개되었습니다. SwiftBar를 기반으로 작동하며, macOS 키체인에 저장된 OAuth 토큰을 읽어와 내부 API를 통해 사용량을 안전하게 조회합니다. 다중 계정을 손쉽게 관리할 수 있어 개발자들의 쿼터 제한 관리에 매우 유용합니다.

번역된 본문

claude-quota: Claude Code 사용량을 위한 메뉴 바 게이지 — 계정당 하나의 게이지가 표시됩니다. (어두운 메뉴 바에 맞춰 흰색 외곽선으로 그려짐)

각 게이지는 하나의 계정에 대한 5시간 윈도우 사용량을 보여주며, 녹색 / 주황색(≥70%) / 빨간색(≥90%)으로 색상이 변경됩니다. 5시간 윈도우 사용량이 꽉 차면, 게이지는 퍼센트 대신 초기화까지의 카운트다운(예: 4:28)을 보여줍니다. 주간 한도에 도달하면 게이지가 검은색으로 바뀌며 주간 초기화까지의 카운트다운(예: 2D)을 표시합니다. 이 주간 한도가 더 강력한 상한선으로, 5시간 윈도우 상태와 관계없이 적용됩니다.

드롭다운 메뉴에는 모든 계정의 상세 정보가 인라인으로 표시됩니다: 5시간 및 주간 윈도우, 플랜에서 제공하는 경우 모델별 윈도우, 추가 사용 크레딧, 그리고 초기화 시간 등이 포함됩니다. 5분마다 자동 새로고침되며(SwiftBar 파일명 규칙), 수동 '지금 새로고침' 항목도 있습니다.

빠른 설치: curl -fsSL https://raw.githubusercontent.com/grzegorz-raczek-unit8/claude-quota/main/install.sh | bash macOS와 Homebrew가 필요합니다. 첫 새로고침 시 macOS에서 키체인(Keychain) 권한 대화상자가 나타나면 '항상 허용'을 클릭하세요.

작동 원리: 이 플러그인은 macOS 키체인에서 Claude Code OAuth 토큰을 읽어옵니다(읽기 전용 — 토큰을 새로고치거나 다시 쓰지 않으므로 로그아웃시키지 않습니다). 그런 다음 Claude Code의 /usage 화면에서 사용하는 것과 동일한 사용량 엔드포인트(endpoint)에 쿼리를 보냅니다. 비밀번호, 스크래핑, 타사 서비스는 사용하지 않습니다.

참고: 해당 엔드포인트는 Claude Code 내부용이며 문서화되지 않았으므로, 향후 Claude Code 업데이트 시 약간의 수정이 필요할 수 있습니다.

저장소에서 설치: git clone https://github.com/grzegorz-raczek-unit8/claude-quota.git cd claude-quota ./install.sh

두 설치 방법 모두 SwiftBar가 설치되어 있지 않은 경우 Homebrew를 통해 자동으로 설치합니다.

계정에 ⚠ 경고가 표시되면 토큰이 장기 미사용으로 만료된 것입니다. 해당 claude CLI를 한 번 실행하면 다음 주기에서 위젯이 복구됩니다.

계정 관리: 기본적으로 플러그인은 계정을 자동으로 감지합니다: Claude Code 키체인 항목이 있는 모든 ~/.claude / ~/.claude-* 설정 디렉토리가 게이지를 가지며, 디렉토리 접미사로 라벨이 지정됩니다(예: ~/.claude-work → W). 단일 자동 감지 계정은 글자 라벨 없이 게이지만 표시됩니다.

계정을 고정하거나 이름을 변경하려면(예: 여러 CLAUDE_CONFIG_DIR을 사용하는 경우), ~/.config/claude-quota/accounts 파일을 만들어 한 줄에 하나의 [경로] [라벨]을 입력하세요(라벨은 단일 단어): ~/.claude-work Work ~/.claude-priv Priv

계정의 메뉴 바 게이지를 숨기려면(드롭다운 상세 정보는 유지됨), 드롭다운에서 해당 계정 행의 '메뉴 바에서 숨기기'를 사용하거나 ~/.config/claude-quota/hidden 파일을 편집하세요(한 줄에 하나의 라벨).

CLAUDE_CONFIG_DIR을 통한 다중 계정 설정은 셸 rc 파일에 다음과 같이 추가할 수 있습니다: claude () { CLAUDE_CONFIG_DIR="$HOME/.claude-work" command claude "$@" ; } claude-priv () { CLAUDE_CONFIG_DIR="$HOME/.claude-priv" command claude "$@" ; }

삭제: SwiftBar 플러그인 폴더(기본값: ~/.swiftbar)에서 claude-quota.5m.py를 삭제하세요.

원문 보기
원문 보기 (영어)
claude-quota Menu bar gauges for your Claude Code quota — one bar per account, like this: (drawn for dark menu bars — white outlines) Each bar shows the 5-hour-window utilization for one account, colored green / orange (≥70%) / red (≥90%). When the 5-hour window is fully used, the bar shows a countdown until reset ( 4:28 ) instead of the percentage. When the weekly limit is hit, the bar turns black with a countdown to the weekly reset ( 2D ) — that's the harder cap, whatever the 5-hour window says. The dropdown lists full detail for every account inline: 5-hour and weekly windows, per-model windows where your plan reports them, extra-usage credits, and reset times. Refreshes every 5 minutes (SwiftBar filename convention) plus a manual "Refresh now" entry. Quick install curl -fsSL https://raw.githubusercontent.com/grzegorz-raczek-unit8/claude-quota/main/install.sh | bash Requires macOS and Homebrew . When macOS shows a Keychain permission dialog on the first refresh, click Always Allow . How it works The plugin reads your Claude Code OAuth token from the macOS Keychain ( read-only — it never refreshes or rewrites tokens, so it can't log you out) and queries the same usage endpoint that Claude Code's /usage screen uses. No passwords, no scraping, no third-party services. Note: that endpoint is internal to Claude Code and undocumented, so a future Claude Code change may require a small fix here. Install from a checkout git clone https://github.com/grzegorz-raczek-unit8/claude-quota.git cd claude-quota ./install.sh Either install path sets up SwiftBar via Homebrew if you don't have it. If an account shows ⚠, its token went stale from disuse — run that claude CLI once and the widget recovers on the next cycle. Accounts By default the plugin auto-discovers accounts: every ~/.claude / ~/.claude-* config directory that has a Claude Code Keychain entry gets a bar, labeled by the directory suffix ( ~/.claude-work → W ). A single auto-discovered account shows no letter label — just the bar. To pin or rename accounts (e.g. you use multiple CLAUDE_CONFIG_DIR s), create ~/.config/claude-quota/accounts with one path [label] per line (single-word labels): ~/.claude-work Work ~/.claude-priv Priv To hide an account's menu bar gauge (its dropdown detail stays), use Hide from menu bar under that account's row in the dropdown — or edit ~/.config/claude-quota/hidden (one label per line). Multiple accounts via CLAUDE_CONFIG_DIR look like this in your shell rc: claude () { CLAUDE_CONFIG_DIR= " $HOME /.claude-work " command claude " $@ " ; } claude-priv () { CLAUDE_CONFIG_DIR= " $HOME /.claude-priv " command claude " $@ " ; } Uninstall Delete claude-quota.5m.py from your SwiftBar plugin folder ( ~/.swiftbar by default).
관련 소식