Claude Code status line

Token Tracker

Claude Code & Codex 本地 token 追踪 — 状态栏(Codex 业界首创伪 statusline)、GitHub 风格热力图、多模型成本分析。 | Local token tracker for Claude Code & Codex — status line (industry-first Codex faux statusline), GitHub-style heatmap, multi-model cost analysis

535 stars 60 forksStatus lines Source

Install

From source
git clone https://github.com/stormzhang/token-tracker.git

From the README

Token Tracker (tt)

本地 AI Agent Token 消耗追踪/分析工具,支持 Claude Code、Codex 和 Kimi Code。

自定义 StatusLine 状态栏 + CLI Dashboard,实时查看 token 用量、等效成本、限额状态。

English

功能亮点

- 多 Agent 统一追踪 — Claude Code + Codex + Kimi Code 统一读取,多 Agent 按来源分组
- 状态栏集成 -- Claude Code 用官方 StatusLine 接口;Codex 用 Stop hook 在回答后追加两行纯文本用量状态;Kimi Code 用官方 status_line 接口
- 实时侧边栏 — tt sidebar 窄窗格常驻面板:全部活跃会话一屏总览(状态灯 + 最近提示词 + 「下一步」建议),点击会话直达对应 iTerm2 / tmux 窗格
- 当前会话自动分屏 — Codex 中显式执行 $tt-sidebar,在原会话右侧自动打开 1/3 宽度的独立提示词侧边栏
- 限额监控 — 实时 5h / 7d 配额百分比 + 重置倒计时
- 多维成本分析 — 会话 / 日 / 周 / 月多维报表,等效成本统计
- 定价识别 -- LiteLLM 在线定价 + 内置官方价双层兜底,覆盖 GPT-6.1 Sol / GPT-6、Claude Opus 5.5 / Sonnet 5.5 / Haiku 5.5 / Fable 5.1 / Mythos 5.1、Gemini 3.8 Flash、Grok 4.7 及国产主流(Kimi / GLM / Qwen / 豆包 / DeepSeek / MiniMax / MiMo);兼容 LiteLLM 阶梯表,按单次请求计算长上下文价与 DeepSeek 峰谷价(周末及已收录的中国节假日全天谷价),Codex 缓存读写分别计价;未知模型优先套用已知系列价,仍无法识别时提示缺价
- 会话洞察 — 项目、模型、时长、消息数一览
- 多主题统一配色 -- 6 套主题(Catppuccin 全家 + Nord + Dracula),CLI 报表与 Claude Code、Kimi Code 状态栏同源,tt theme 一键切换;Codex Hook 状态保持纯文本
- 零配置 — 自动检测已安装的 Agent,直接读取本地数据
- 隐私安全 — 数据纯本地存储,不采集、不上传

StatusLine 状态栏

tt setup 自动为 Claude Code、Codex 和 Kimi Code 配置状态栏,脚本更新时自动升级。

Claude Code(官方接口)

基于 Claude Code 官方自定义 StatusLine 接口,数据完全来自本地 Claude,无任何推测。
状态栏接管是可选的:已有自定义 statusLine 时默认保留你的配置(向导里也可随时选 No),报表命令完全不受影响。注意:不接管时 tt status 的 CC 订阅额度段将没有数据来源(CC 配额只经状态栏脚本落盘)。

四行布局字段详解

终端宽度不足时会自动降级:先隐藏重置倒计时,再将进度条简化为百分比数字。API 模式无订阅配额,第 2 行只显示 Ctx。

Codex(伪 statusline)

Codex 官方暂不支持自定义 StatusLine。Token Tracker 通过 Stop hook 在每次回答完成后追加两行纯文本用量状态。Codex 0.156.0 起会过滤 Hook 文本中的 ANSI 控制字符,因此不再向 Hook 输出颜色序列。

上图是 Codex 0.156.0 之前的历史截图;当前版本显示相同字段和进度条,但不着色。

两行布局:

- L1 项目 | Total:  | Model:  -- 第三方 API provider(如 DeepSeek)无订阅配额,L1 加显示会话 Cost(按逐请求时间与上下文档位套用内置官方价估算)
- L2 Limit: 5h  % (reset ) | 7d  % (reset ) |  Ctx  % —— 配额按当前会话 / 同…
Read the full README on GitHub

How status lines work

  • A status line is a command Claude Code runs to draw the bar under the prompt. It gets the session as JSON on stdin (model, folder, cost, context) and prints one or more lines.
  • Point the statusLine setting in ~/.claude/settings.json at it: { "statusLine": { "type": "command", "command": "<the command from the README>" } }.
  • Or run /statusline inside Claude Code and describe what you want.
Claude Code docs

Details

Language
Python
License
MIT
Last updated
10 October 2026
Topics
ai-agentanthropic-claudeclaude-codeclicodexcost-analysisdeveloper-toolsopenai-codexpythonstatuslineterminal-uitoken-tracker

FAQ

What is Token Tracker?

Claude Code & Codex 本地 token 追踪 — 状态栏(Codex 业界首创伪 statusline)、GitHub 风格热力图、多模型成本分析。 | Local token tracker for Claude Code & Codex — status line (industry-first Codex faux statusline), GitHub-style heatmap, multi-model cost analysis It is a status line for Claude Code, from stormzhang/token-tracker on GitHub.

How do I install Token Tracker?

Clone stormzhang/token-tracker from GitHub and follow the setup steps in its README.

Is Token Tracker popular?

stormzhang/token-tracker has 535 GitHub stars and 60 forks. It was last updated on 10 October 2026.

More status lines

Browse the most popular Claude Code mods, all status lines, or the skills and MCP server directories.