YuLaiZ

Token Usage — Data skill for Claude Code

Data community

Local LLM token usage analytics for Claude, Codex, OpenCode, ZCode, WorkBuddy, and Zhipu-AutoClaw — build your own multi-dimensional reports without SQL; CLI and daemon for macOS and Windows.

How to install Token Usage

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

What Token Usage does

Local LLM token usage analytics for Claude, Codex, OpenCode, ZCode, WorkBuddy, and Zhipu-AutoClaw — build your own multi-dimensional reports without SQL; CLI and daemon for macOS and Windows. — 本地 LLM token 用量分析工具,支持 Claude、Codex、OpenCode、ZCode、WorkBuddy、Zhipu-AutoClaw——无需 SQL 打造自定义多维报表;提供 CLI 与守护进程,支持 macOS 与 Windows。

Alternatives in Data

  • Opencode Mem — OpenCode plugin that gives coding agents persistent memory using local vector database 1.5k ★
  • Agentlytics — Comprehensive analytics dashboard for AI coding agents — Cursor, Windsurf, Claude Code, VS Code Copilot, Zed 473 ★
  • Research System — You are a Database Research Agent specialized in analyzing MySQL database schemas and generating comprehensive 64 ★

README

token-usage

[简体中文](README.zh-CN.md) | English

A local LLM usage analytics tool for collecting, analyzing, and querying token usage across AI clients — and for turning that data into your own multi-dimensional usage reports, no SQL required.

Features

  • Message/API-request-level accounting: each actual model invocation is stored independently instead of aggregating tokens by session.
  • Accurate attribution across dates and models: messages that span dates, sessions that use multiple models, and forks/branches are neither missed nor double-counted.
  • Preserves actual rewind consumption: completed calls before a rewind and new calls after it are kept separately rather than deduplicated.
  • Codex rollout replay deduplication: replayed complete token snapshots caused by rate-limit bucket changes are not counted twice, while legitimate resets and multi-turn calls are retained.
  • Multiple data sources: Claude Code/Desktop, OpenCode, Codex, WorkBuddy, ZCode, and Zhipu-AutoClaw.
  • CC Switch router attribution: backfills the actual provider/model from CC-Switch proxy logs (currently effective only for the Claude family).
  • Build your own usage reports — no SQL required: combine client, model, provider, and project into named multi-dimensional views; compose built-in and custom views into reusable, ordered report groups; set a personal default and run it by name. The guided configuration TUI and query list make those views discoverable and easy to maintain.
  • Two run modes: one-off CLI commands and a real-time monitoring daemon with nginx-style background startup.
  • Autostart: macOS launchd and the Windows Registry, configurable through the config TUI or config set.
  • Opt-in configuration: every client is disabled by default; enable only the ones you use, while data-source paths fall back to ready-to-use defaults.
  • Single-binary distribution: built with Go and pure-Go SQLite (no CGO), with macOS and Windows supp