Jovan1666/commandcode-usage 预览 preview

Jovan1666/commandcode-usage

Plugin插件 ⭐ 2 MIT Usage & Cost用量与计费

Command Code plan usage for seven coding agents: one core, seven adapters. Runs locally, so checking your quota costs no quota.

Project Overview项目介绍

Command Code Usage is a cross-agent quota-monitoring tool whose sole implementation lives in core/cc-usage.mjs; the repository ships seven thin adapter directories so the same logic can be loaded into seven different coding CLIs and harnesses. It reads a Command Code API key from environment variables, ~/.commandcode/auth.json, or the host agent's own settings file, then renders a one-line status bar showing the five-hour, weekly, and monthly rolling windows with percent-used bars, reset times, remaining dollar balance, and traffic-light colors that turn from green under sixty percent to amber by eighty-five percent and red above ninety. The MIT-licensed project supports Claude Code, Codex CLI, Grok Build, opencode, pi, DeepSeek Harness, and ZCode, and is installed via per-agent commands such as /plugin marketplace add Jovan1666/commandcode-usage for Claude Code, grok plugin marketplace add … for Grok Build, pi install ./commandcode-usage/plugins/pi, and dsh plugin --profile web add ./commandcode-usage/plugins/dsh (requiring dsh ^0.1.5-rc.1). Most adapters are copies of the core script kept in sync by scripts/sync-core.mjs, but the DeepSeek Harness adapter deliberately keeps its own data layer because its host/client halves and one-hundred-forty-one offline checks are built against a separate contract; that detail is documented in plugins/dsh/README.md.

The typical workflow is to glance at the editor's status line, sidebar, or terminal panel between turns and see at a glance how much of the current billing window is gone, with no model round-trip and therefore no quota cost. The script decides per turn whether the active session is actually routed through Command Code by reading router mappings such as cc-switch-style ANTHROPIC_DEFAULT_OPUS_MODEL pairs, and simply hides itself when the user has switched to a different model so the quota bar does not become permanent noise. When precise numbers are wanted, /quota is invoked as a prompt and therefore costs a model turn; alternative surfaces include the terminal panel, the HTML panel, --compact, --md, and --json outputs, and per-agent toggle commands like pi's /ccq-bar on|off|toggle|refresh|status, while opencode exposes only its sidebar. Plans with no rolling windows, such as Provider or Enterprise, display only the balance, and the Go plan without API access renders nothing; the target audience is developers who juggle multiple coding agents and want to avoid burning turns just to inspect their usage.

Dependencies are intentionally light: Node eighteen or newer is the only runtime requirement beyond a Command Code paid plan that actually grants API access. Claude Code and Grok require a one-time setup script because their plugin manifests cannot declare a status line, so the script writes the setting on the user's behalf, refuses to overwrite an existing status line unless --force is passed, and restores the original on --remove. Windows users should install Git Bash because Claude Code falls back to PowerShell otherwise, and PowerShell repaints run roughly three times slower than Git Bash. The repository ships a node scripts/check.mjs that runs the same suites as CI, including the DeepSeek Harness one-hundred-forty-one checks, and an editor should change only core/cc-usage.mjs and then run the sync script, since the per-adapter files are generated copies. When credentials cannot be located the status line silently omits itself instead of printing an error into the editor, with the documented exception of the DeepSeek Harness adapter that retains its independent data layer.

Command Code Usage 是一个跨代理的命令行用量配额查看工具,核心脚本为 core/cc-usage.mjs,在不消耗模型额度的情况下,从本地环境自动读取 Command Code(Claude Code 背后计费体系)的 API 密钥,展示 5 小时、周、月三个滚动窗口的已用百分比、进度条、剩余额度及重置时间,并按 60% 绿、85% 琥珀、90% 红渲染颜色。项目以 MIT 协议发布,通过每代理一个适配器目录的形式分发:Claude Code 用 /plugin marketplace add 加载后需运行 setup 脚本写入 settings.json 状态行;Codex CLI、Grok Build、opencode、pi、ZCode 各有独立的安装命令;DeepSeek Harness 用 dsh plugin --profile web add ./commandcode-usage/plugins/dsh 加载,需要 dsh ^0.1.5-rc.1。

典型工作流是用户在已打开的编码代理中直接观察侧边栏、状态栏或终端面板里的配额进度条;脚本每轮根据路由器映射判断当前会话是否真正路由到 Command Code,否则隐藏自身避免噪音。需要详细数字时可调用 /quota(会消耗一轮)或终端面板、HTML 面板、--compact、--md、--json 等输出形式(不显示状态栏)。burn-rate 投影只在显式面板中打印,避免状态栏中"总是告警"导致失去意义。适合关心月度配额、需要在多个代理间切换、又不想为查看用量消耗额度的开发者使用。

依赖方面,脚本需 Node 18+,并依赖一个具备 API 访问权限的 Command Code 付费套餐(Go 档无 API,将不渲染)。Windows 上 Claude Code 在未装 Git Bash 时会通过 PowerShell 调用状态行命令,单次重绘成本显著上升,建议安装 Git Bash 以降低约三倍开销。安装时若已配置过其他代理的状态行,setup 脚本默认拒绝覆盖,需传 --force;卸载可用 --remove。pi 用 /ccq-bar 子命令控制显隐,opencode 无命令完全依赖侧边栏。plugins/dsh 子目录因宿主/客户端半部与 141 项离线校验独立构建,保留自有数据层而非共用 core,修改需跑 node scripts/sync-core.mjs 同步,并先装 React。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 2 warnings2 项注意
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
  • No DSH plugin manifest detected - it may only carry the dsh-plugin topic, so the install method must be confirmed on the spot未检测到 DSH 插件清单:可能只是打了 dsh-plugin 话题,安装方式要现场确认
  • Not DSH-native: a multi-platform tool that may require Node / Electron or another runtime first非 DSH 原生,是多平台兼容工具:可能要先装 Node / Electron 等运行时
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:Jovan1666/commandcode-usage

把 Jovan1666/commandcode-usage 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

Command Code Usage

See how much of your Command Code plan is left — 5-hour, weekly and monthly windows with reset times — inside the coding agent you already have open.

Runs on your machine. No model round-trip, so checking your quota costs no quota.

The status line, at normal usage and when a window is nearly spent

CC GOAT │ 5h █▎░░░░░░░░ 12% 4h27m后重置 │ 周 █▏░░░░░░░░ 11% 09-27重置 │ 月 ▋░░░░░░░░░ 6% $66.03 10-20重置

简体中文 · What was verified

Check


Install

Each agent has its own way of loading plugins, so pick yours. Six of the seven end up running the same core script (core/cc-usage.mjs); the DeepSeek Harness adapter keeps its own data layer, for the reason given under Layout.

Agent How Persistent?
Claude Code /plugin marketplace add Jovan1666/commandcode-usage then /plugin install commandcode-usage@commandcode-usage, then node ~/.claude/plugins/marketplaces/commandcode-usage/plugins/claude-code/scripts/setup.mjs ✅ status line
Codex CLI plugin marketplace (.agents/plugins/marketplace.json) — the bundled hook runs each turn; Codex will ask you to trust it ⚠️ per-turn line
Grok Build grok plugin marketplace add Jovan1666/commandcode-usage, then run plugins/grok/scripts/setup.mjs ✅ status line
opencode run plugins/opencode/scripts/setup.mjs ✅ sidebar
pi pi install ./commandcode-usage/plugins/pi, or copy index.ts into ~/.pi/agent/extensions/ ✅ above the input
DeepSeek Harness clone this repo, then dsh plugin --profile web add ./commandcode-usage/plugins/dsh (needs dsh ^0.1.5-rc.1) ✅ sidebar
ZCode /plugin marketplace add Jovan1666/commandcode-usage then /plugin install command-code-usage (its marketplace and plugin name differ) ⚠️ command only

Nothing here asks for your API key up front. The script finds it — see Credentials.

The DeepSeek Harness card has its own three-state screenshot in plugins/dsh/assets/screenshot.png — collapsed badge, light expanded, and dark expanded. The other five platforms all render the same one line shown above, so they get text rather than a picture.

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-gemini-pool 下一个 Next dsh-cron-job →