{"id":51236111,"url":"https://github.com/sayginsaman/ccbar","last_synced_at":"2026-06-28T20:32:08.861Z","repository":{"id":367209466,"uuid":"1279686978","full_name":"sayginsaman/ccbar","owner":"sayginsaman","description":"A fast, single-line status bar for Claude Code. Last-prompt tokens, API-equivalent cost, and session/weekly/per-model usage limits at a glance.","archived":false,"fork":false,"pushed_at":"2026-06-25T02:22:53.000Z","size":198,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-25T03:20:03.801Z","etag":null,"topics":["ai-agents","claude","claude-code","go","infobar","statusbar","vibe-coding"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sayginsaman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-24T23:37:00.000Z","updated_at":"2026-06-25T02:27:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sayginsaman/ccbar","commit_stats":null,"previous_names":["sayginsaman/ccbar"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sayginsaman/ccbar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayginsaman%2Fccbar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayginsaman%2Fccbar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayginsaman%2Fccbar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayginsaman%2Fccbar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sayginsaman","download_url":"https://codeload.github.com/sayginsaman/ccbar/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayginsaman%2Fccbar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34903523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agents","claude","claude-code","go","infobar","statusbar","vibe-coding"],"created_at":"2026-06-28T20:32:06.789Z","updated_at":"2026-06-28T20:32:08.854Z","avatar_url":"https://github.com/sayginsaman.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ccbar (Claude Code info bar)\n\nA small, fast, **single-line** status bar that lives just below the Claude Code\ninput box. It shows, at a glance:\n\n![ccbar status bar in Claude Code — model, last-prompt tokens, last and session cost, and session/weekly/per-model usage limits](docs/screenshot.png)\n\nReading the bar left to right — each segment from the screenshot above:\n\n```\nOpus 4.8 (1M context) · 429.4k tokens · $0.26 last prompt · $63.64 session · session limit 1% · weekly limit 23% · Sonnet weekly 0%\n```\n\n| Segment                  | What it means |\n| ------------------------ | ------------- |\n| `Opus 4.8 (1M context)`  | Active model and its context-window size (from Claude Code's model name) |\n| `429.4k tokens`          | **Tokens used in the last prompt** — input + output + cache read/write |\n| `$0.26 last prompt`      | **API-equivalent cost of the last prompt** — what it would have cost on an API key |\n| `$63.64 session`         | **API-equivalent cost of the whole session** so far |\n| `session limit 1%`       | **Current session usage** — your rolling 5-hour limit |\n| `weekly limit 23%`       | **Weekly usage** — the 7-day, all-models limit |\n| `Sonnet weekly 0%`       | **Per-model weekly usage** (\"all models limits\") — one row per model bucket the API reports (here, only Sonnet is active) |\n\nValues are shown in **green**; a limit percentage turns **amber at ≥70%** and\n**red at ≥90%** so pressure is easy to spot. On a narrow terminal the\nlowest-priority segments are dropped so the bar **never wraps**. Prefer terse\nlabels (`5h`, `wk`, `tok`)? Set `\"compact_labels\": true`.\n\nBuilt in Go with **zero dependencies** — a single native binary, cold-start in\nmilliseconds, no interpreter, no transcript parsing on the render path.\n\n---\n\n## Requirements\n\n- **Go** ≥ 1.21 (to build).\n- **Claude Code** — field shapes verified on **2.1.190**. The limit segments need a\n  recent 2.1.x that emits `rate_limits` in the statusLine payload (introduced\n  around 2.1.80); on older builds those segments simply don't render.\n- A **Pro/Max** subscription for the limit segments (they come from your plan's\n  rate limits; an API-key-only setup will simply omit them).\n\n## Install\n\nEvery method ends with `ccbar install`, which registers the binary in\n`~/.claude/settings.json` (preserving your other settings, with a backup). The bar\nappears on your next interaction — no restart needed.\n\n**curl | sh** (macOS/Linux, no Go required — downloads a prebuilt binary):\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/sayginsaman/ccbar/main/install.sh | sh\n```\n\n**Homebrew** (macOS/Linux):\n\n```bash\nbrew install sayginsaman/tap/ccbar\nccbar install\n```\n\n**go install** (any platform with Go):\n\n```bash\ngo install github.com/sayginsaman/ccbar@latest\nccbar install\n```\n\n**From source** (clone, then):\n\n```bash\nmake install        # go build + ccbar install\n```\n\nVerify and inspect the live data anytime:\n\n```bash\nccbar --doctor\n```\n\n\u003e Releasing: publish a GitHub release + Homebrew tap so the prebuilt curl/brew\n\u003e installs work — see [RELEASING.md](RELEASING.md). Until then, the installer\n\u003e automatically falls back to building from source (needs Go + git).\n\nThe status line refreshes on events; `ccbar install --refresh-interval N` (default\n30s) also re-renders while the session is idle (e.g. waiting on background agents).\nThe usage endpoint is still only polled once per cache TTL.\n\n## Where the data comes from\n\nFour of the five metrics need **no network call and no credentials** — Claude Code\nalready passes them to the statusLine program on stdin:\n\n- last-prompt tokens ← `context_window.current_usage`\n- session cost ← `cost.total_cost_usd` (Claude Code's own estimate)\n- last-prompt cost ← computed from `current_usage` × an embedded price table\n- session (5h) \u0026 weekly (7d) limits ← `rate_limits.{five_hour,seven_day}`\n\nThe only exception is **per-model weekly limits** (\"all models limits\"), which are\nnot in the stdin payload. ccbar reads them from the same authenticated endpoint the\n`/usage` command uses (`GET /api/oauth/usage`), and handles it conservatively:\n\n- **Read-only on credentials.** It reads your existing Claude Code OAuth token from\n  `~/.claude/.credentials.json`. It never writes, refreshes, or logs the token.\n- **Never blocks the bar.** The render path only reads a local cache\n  (`~/.claude/ccbar/usage-cache.json`, ~60s TTL). When the cache is stale it kicks\n  off a **detached background refresh** and renders immediately from what it has.\n- **Degrades gracefully.** No token / offline / expired / schema change → the\n  per-model segments simply don't appear; everything else keeps working.\n- **Fully optional.** Set `\"usage_endpoint\": false` in the config for a pure-stdin\n  bar (session + weekly limits only, no per-model, no network).\n\nThe cache stores only percentages and reset times — never the token.\n\n## Configuration\n\n`~/.claude/ccbar/config.json` (all fields optional; defaults shown):\n\n```json\n{\n  \"style\": \"text\",\n  \"color\": true,\n  \"ascii\": false,\n  \"compact_labels\": false,\n  \"warn_threshold\": 70,\n  \"crit_threshold\": 90,\n  \"segments\": {\n    \"model\": true,\n    \"tokens\": true,\n    \"cost_last\": true,\n    \"cost_session\": true,\n    \"five_hour\": true,\n    \"seven_day\": true,\n    \"per_model\": [\"Opus\", \"Sonnet\"],\n    \"context\": false\n  },\n  \"hide_zero_per_model\": false,\n  \"usage_endpoint\": true,\n  \"keychain\": false,\n  \"cache_ttl_seconds\": 60,\n  \"plan\": \"auto\",\n  \"show_plan\": false,\n  \"show_resets_when_hot\": false\n}\n```\n\n- `ascii` — use `|` separators and ASCII markers instead of `·`/`↻`.\n- `compact_labels` — terse labels (`5h`, `wk`, `tok`, bare `$0.25`) instead of the\n  default full phrases (`session limit`, `weekly limit`, `tokens`, `… last prompt`).\n- `per_model` — which per-model weekly limits to show, in order (by display name).\n- `hide_zero_per_model` — omit per-model weekly limits that are sitting at 0%.\n- `keychain` — if the credentials-file token is expired, fall back to the macOS\n  Keychain (may prompt once). Off by default; the file token is normally kept fresh\n  by Claude Code itself.\n- `plan` — `\"auto\"` detects the tier from `~/.claude.json`; or set an explicit\n  label like `\"Max 20x\"`. Shown only when `show_plan` is true.\n- `show_resets_when_hot` — append a reset countdown (e.g. `↻2h`) to a limit once it\n  crosses the warn threshold.\n\nPrices can be overridden without recompiling via `~/.claude/ccbar/pricing.json`\n(same shape as the built-in table, USD per million tokens).\n\n## Troubleshooting\n\n- **Limits missing?** They appear only after the first API response of a session,\n  and only on Pro/Max accounts. Run `--doctor` to see the live values.\n- **Per-model shows fewer than expected?** A bucket that is `null` on your account\n  (e.g. no separate Opus weekly cap active) is hidden by design.\n- **Bar is blank?** Run `~/.claude/ccbar/ccbar --doctor`. Note that an empty\n  payload (`echo '{}' | ccbar`) omits all stdin-derived segments but may still show\n  cached per-model limits; for a truly empty render use a clean home, e.g.\n  `echo '{}' | HOME=$(mktemp -d) ~/.claude/ccbar/ccbar`. A non-zero exit or empty\n  stdout blanks the status line by design.\n- **Privacy of `--doctor`:** its output includes your plan tier and the token\n  expiry time (never the token itself). Redact those before pasting into a bug report.\n- **Colors look wrong / want none?** Set `NO_COLOR=1` or `\"color\": false`.\n\n## Commands\n\n```\nccbar                 render the bar (reads stdin) — Claude Code calls this\nccbar install         register as the status line (edits settings.json, with backup)\nccbar uninstall       remove from settings.json (--purge also deletes the data dir)\nccbar --doctor        diagnostics + a read-only test of the usage endpoint\nccbar --demo          print a sample bar\nccbar --init-config   write a default config file\nccbar --version\n```\n\n## Uninstall\n\n```bash\nccbar uninstall          # remove the statusLine entry (keeps files)\nccbar uninstall --purge  # also delete ~/.claude/ccbar\nbrew uninstall ccbar     # if installed via Homebrew\n```\n\n## How it works\n\n```\nClaude Code ──stdin JSON──▶ ccbar (render, \u003c5ms)\n                              │  reads usage-cache.json (per-model limits)\n                              │  if stale: spawn detached ─▶ ccbar --refresh-usage\n                              ▼                                   │\n                         single status line              GET /api/oauth/usage\n                                                          writes usage-cache.json\n```\n\nThe render path is pure and synchronous; all network I/O happens in a detached\nbackground process so the bar is never slow or stale-blocking.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayginsaman%2Fccbar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsayginsaman%2Fccbar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayginsaman%2Fccbar/lists"}