TiaoFeng

Tokrs — Development skill for Claude Code

Development community

A command-line interface (CLI) for analyzing token usage in local logs, supporting Claude, Codex, OpenCode, Kimi Code CLI, Deepseek Harness and Pi.

How to install Tokrs

This entry records only its repository, not the path inside it, so there is no exact command to give. Open TiaoFeng/tokrs and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Tokrs does

A command-line interface (CLI) for analyzing token usage in local logs, supporting Claude, Codex, OpenCode, Kimi Code CLI, Deepseek Harness and Pi. Built with Rust, it is fast and lightweight.

Alternatives in Development

  • IPolloWork — Enterprise-grade, local-first Agent Workbench for people and agent teams 4.9k ★
  • Petdex — A public gallery of animated pets for Codex, Claude Code, DeepSeek Harness, Hermes, OpenCode, Gemini CLI, and 4k ★
  • /token Scan — Fast rug pull detection for meme coins and token contracts 1.7k ★

README

tokrs

**简体中文** | [English](README.en.md)

[![Latest Release](https://img.shields.io/github/v/release/TiaoFeng/tokrs)](https://github.com/TiaoFeng/tokrs/releases/latest) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![Rust](https://img.shields.io/badge/language-Rust-orange.svg)](https://www.rust-lang.org/)

使用 Rust 编写的本地 Token 用量统计 CLI。读取 Claude Code、Codex、OpenCode、Gemini CLI、Grok Build、Pi、Kimi Code、Deepseek Harness 在本地留下的日志/数据库文件,统计各 app、各模型、各日期的 Token 消耗与成本。无守护进程、无网络请求、对数据源只读。

本工具仅在运行时扫描日志/数据库,不保存日志或持久化记录。因此统计的数据仅代表当下本地日志/数据库中的token总量。结果会因删除了一些对话而小于cc-switch

特性

  • 支持 8 种 agent:Claude / Codex / OpenCode / Gemini / Grok / Pi / Kimi / Deepseek Harness
  • 按 app、模型、日期三种维度分组统计
  • 支持按起止日期(--since / --until)筛选
  • 成本估算优先级:
    • 定价表 force 覆盖 > 上游自报成本 > 定价表估价 > unpriced(计数提示,不计为 0)
  • 定价表 pricing.json 支持每模型时间版本价、长上下文加价、峰时加价
  • 统计时自动为定价表中缺失的模型追加空模板,不覆盖已有条目
  • 支持多线程:可选--threads N 指定每 app 并行线程数(缺省 = min(CPU 核数, 16, 文件数);--threads 1 串行)
  • 支持 --json 格式输出

安装

下载预编译的最新版本: [![Latest Release](https://img.shields.io/github/v/release/TiaoFeng/tokrs)](https://github.com/TiaoFeng/tokrs/releases/latest)

或从源码构建(见下方「从源代码构建」章节)。

快速开始(示例)

$ tokrs

--------------------------------------------------------------------------------------------------
 Key        Requests   Input        Output      Cache Read    Cache Write   Total         Cost    
==================================================================================================
 Today      128        18,432       96,510      1,204,881     88,000        1,407,823     $4.21   
--------------------------------------------------------------------------------------------------
 claude     3,412      1,204,553    2,891,004   88,312,440    6,501,220     98,909,217    $156.20 
--------------------------------------------------------------------------------------------------
 codex      1,208      601,220      1,100,322   40,122,884    0             41,824,426    $61.03  
------