claude-gauge — плагин для Claude Code: лимиты и стоимость в статусной строке
Показывает в статусной строке Claude, сколько вы уже израсходовали от пятичасового лимита, сколько токенов ушло и во сколько обошлась сессия.
/plugin marketplace add anthropics/claude-plugins-community
/plugin install claude-gauge@claude-communityЧто делает claude-gauge
Плагин читает поле rate_limits, которое Claude передаёт скриптам статусной строки, и рисует по нему шкалу. Никаких прокси и лишних обратных вызовов к API: данные берутся из того же JSON, что платформа отдаёт сама. Токены сессии подтягиваются из локальных JSONL-транскриптов.
Шкала заполняется по мере расхода квоты и меняет цвет с зелёного на жёлтый, потом на красный. Пять вариантов отрисовки — bar, drain, dots, blocks, compact — и семь цветовых схем на 24-битном цвете, включая spectrum с попиксельным градиентом. Рядом выводятся процент пятичасового окна, число токенов, стоимость в долларах и длительность сессии; строки про стоимость и время можно отключить.
Настроить всё это можно командой /claude-gauge:config или правкой config.json — изменения подхватываются при следующем обновлении статусной строки, перезапуск не нужен. Нужен Node.js 18+ и Claude v2.1.80+, потому что поле rate_limits появилось именно там. Терминал должен поддерживать 24-битный цвет, иначе схемы вроде spectrum и ember потеряют смысл.
Какие задачи решает
- увидеть, сколько осталось от пятичасового лимита, не выходя из сессии
- оценить стоимость текущей сессии в долларах
- посчитать израсходованные токены без обращения к дашборду
- сменить вид шкалы на компактный, когда статусная строка забита
- пересчитать стоимость в местную валюту через
currency_rate
Примеры запросов агенту
- Настрой отображение claude-gauge: поставь
drainи схемуocean - Покажи в статусной строке стоимость и длительность сессии
- Переключи шкалу на
compact, места в строке мало
Как установить claude-gauge
Через маркетплейс плагинов
/plugin marketplace add anthropics/claude-plugins-community/plugin install claude-gauge@claude-communityПо шагам, с командами для каждой платформы: Плагины Claude Code: маркетплейсы, установка и как собрать свой
Вопросы о claude-gauge
Как установить claude-gauge в Claude Code?
Сначала добавьте маркетплейс: /plugin marketplace add anthropics/claude-plugins-community, затем установите плагин: /plugin install claude-gauge@claude-community. После этого перезапустите Claude.
Что делает claude-gauge?
Выводит в статусную строку шкалу расхода пятичасового лимита, число токенов сессии, её стоимость и длительность. Цвет шкалы меняется по мере приближения к лимиту.
Что нужно для работы claude-gauge?
Node.js 18+ и Claude v2.1.80+ — плагин опирается на поле rate_limits в JSON статусной строки. Терминал должен поддерживать 24-битный цвет.
Исходный текст
SKILL.md · MIT
<p align="center">
<img src="assets/session-demo.gif" alt="claude-gauge demo" width="580">
</p>
<h1 align="center">claude-gauge</h1>
<p align="center">
Rate limit awareness for Claude Code — without wasting a single token.
</p>
<p align="center">
<img src="https://img.shields.io/badge/Claude_Code-plugin-5A45FF?style=flat-square" alt="Claude Code Plugin">
<img src="https://img.shields.io/badge/node-18%2B-brightgreen?style=flat-square" alt="Node 18+">
<img src="https://img.shields.io/badge/zero-dependencies-blue?style=flat-square" alt="Zero Dependencies">
<img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="MIT License">
<a href="https://github.com/mil-orb/claude-gauge/actions/workflows/github-code-scanning/codeql"><img src="https://github.com/mil-orb/claude-gauge/actions/workflows/github-code-scanning/codeql/badge.svg" alt="CodeQL"></a>
</p>
---
You don't know you're approaching your rate limit until Claude stops responding. Checking with `/usage` breaks your flow. Alt-tabbing to the Anthropic dashboard breaks it even more.
**claude-gauge** puts a live session dashboard in your status line — rate limit utilization, token count, cost, and session duration, all in one glanceable bar. The bar fills as you consume quota — green when you're fine, red when you're running low. Always visible, zero interruption.
## How It Works
```
Claude Code → statusline.js → reads native rate_limits field
from Claude Code's statusline JSON
↓
Renders fuel bar + session metrics
```
Claude Code (v2.1.80+) natively provides rate limit data in the `rate_limits` field of the JSON passed to statusline scripts. claude-gauge reads this directly — no proxy, no extra API calls, no external dependencies.
## Install
**Step 1** — In Claude Code, run these two commands:
```
/plugin marketplace add mil-orb/claude-gauge
/plugin install claude-gauge
```
**Step 2** — Restart Claude Code.
That's it. The gauge appears in your status line immediately.
## What You See
<p align="center">
<img src="assets/screenshot.png" alt="claude-gauge in Claude Code" width="580">
</p>
```
████████▒░░░░░░░░░░░ ⚡32% · 47.9k · $1.84 · 3m
│ │ │ │ └─ session duration
│ │ │ └──────── session cost (USD)
│ │ └───────────────── session tokens (input + output)
│ └───────────────────────── 5h rate limit utilization
└─────────────────────────────────────────────── gauge bar (fills as quota is consumed)
```
- Bar **fills** from left as utilization climbs (use `drain` mode for a fuel gauge that empties)
- Color shifts green → yellow → red with your chosen color scheme
- `⚡32%` — your 5-hour rolling utilization percentage
- Session tokens are read from Claude Code's local JSONL transcript files
## Display Types
Five built-in visualizations:
<p align="center">
<img src="assets/display-modes.gif" alt="display modes" width="580">
</p>
| Type | Preview | Description |
|------|---------|-------------|
| `bar` | `██████████████░░░░░░` | Default — fills as quota is consumed |
| `drain` | `░░░░░░██████████████` | Fuel gauge — empties as quota is consumed |
| `dots` | `●●●●●●●●●●●●●○○○○○○` | Minimal circle pips |
| `blocks` | `⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀` | Dense braille blocks |
| `compact` | `● ⚡23%` | Text only, no bar |
## Color Schemes
Seven 24-bit true color schemes that escalate as utilization climbs:
<p align="center">
<img src="assets/color-schemes.gif" alt="color schemes" width="580">
</p>
| Scheme | Transition | Style |
|--------|-----------|-------|
| `gradient` | green → yellow → red | Uniform fill, single color |
| `ocean` | cyan → blue → purple | Uniform fill |
| `ember` | yellow → orange → deep red | Uniform fill |
| `frost` | white → light blue → deep blue | Uniform fill |
| `retro` | green / yellow / red | Hard CGA steps at 33%/66% |
| `spectrum` | green → yellow → red | **Per-character gradient** — each bar character is a different color |
| `mono` | white → gray → dark | Grayscale |
`spectrum` is the only per-character scheme — it paints a full rainbow gradient across the bar width regardless of fill level. All others apply one color uniformly based on utilization percentage.
## Configuration
Run `/claude-gauge:config` for an interactive setup, or edit `config.json` in the plugin directory directly. Changes take effect on the next status line refresh — no restart needed.
```jsonc
{
"display": "bar", // bar, drain, dots, blocks, compact
"color": "gradient", // gradient, ocean, ember, frost, retro, spectrum, mono
"bar_size": "medium", // small (10), medium (20), large (30), xlarge (40), or a number
"show_cost": true, // running session cost in USD
"show_duration": true, // elapsed session time
"show_lines": false, // lines added and removed
"currency_rate": null // local currency conversion (e.g. 0.79 for GBP, symbol auto-detected)
}
```
> **Tip:** Config path is `~/.claude/plugins/claude-gauge/config.json`
## Uninstall
**Step 1** — Run the uninstall script:
```bash
bash ~/.claude/plugins/cache/mil-orb/claude-gauge/*/scripts/uninstall.sh
```
**Step 2** — Remove the plugin from Claude Code:
```
/plugin uninstall claude-gauge
```
**Step 3** — Start a new Claude Code session.
<details>
<summary>What the uninstall script does</summary>
- **Restores your status line** — restores your previous statusline config from backup, or removes the `statusLine` block from `~/.claude/settings.json`
</details>
## Requirements
- Node.js 18+ (included with Claude Code)
- Claude Code v2.1.80+ (provides native `rate_limits` field)
- A terminal with 24-bit color support (most modern terminals)
- No additional dependencies
## License
MIT
© mil-orb · MIT · mil-orb/claude-gauge