Skip to content
This repository was archived by the owner on Jul 30, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .github/assets/client-cursor.jpg
Binary file not shown.
Binary file removed .github/assets/client-trae.png
Binary file not shown.
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,5 @@ For ordinary validation, prefer source-build checks:
```bash
bun install
bun run build:core
bun run cli -- --no-spinner --light
bun run cli -- models --no-spinner
```
53 changes: 1 addition & 52 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ codspeed-criterion-compat = "4.7.0"
tempfile = "3"
serial_test = "3"

# Trae iCubeAuthInfo decryption: AES-128-CBC + base64
aes = "0.8"
cbc = { version = "0.1", features = ["std"] }
base64 = "0.22"

# Clipboard
arboard = "3"

Expand Down
28 changes: 12 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Run the local wrapper:
bun run cli

# Script-friendly report
bun run cli -- --no-spinner --light
bun run cli -- models --no-spinner

# Inspect detected clients and scan locations
bun run cli -- clients
Expand All @@ -90,23 +90,23 @@ npm install -g @juya-ai/tokscale
# TUI
tokscale
tokscale tui
tokscale models
tokscale monthly
tokscale hourly
tokscale tui --tab models

# Scriptable reports
tokscale --no-spinner --light
# Deterministic table and JSON reports
tokscale models --no-spinner
tokscale monthly --no-spinner
tokscale hourly --no-spinner
tokscale models --no-spinner --json
tokscale graph --no-spinner --output graph.json

# Filters
tokscale --client opencode,claude --week
tokscale tui --client opencode,claude --week
tokscale models --since 2026-01-01 --until 2026-01-31
tokscale models --group-by client,provider,model --json

# Pricing catalog lookup
tokscale pricing claude-sonnet-4-5 --no-spinner
tokscale pricing list-overrides --json
tokscale pricing lookup claude-sonnet-4-5 --no-spinner
tokscale pricing overrides --json
Comment thread
makoMakoGo marked this conversation as resolved.
```

When running from source, replace `tokscale` with `bun run cli --`.
Expand All @@ -119,22 +119,18 @@ The canonical client identity list lives in

Current catalog entries include:

OpenCode, Claude Code, Codex CLI, Cursor, Gemini CLI, Amp, Droid, OpenClaw,
OpenCode, Claude Code, Codex CLI, Gemini CLI, Amp, Droid, OpenClaw,
Pi, OMP, Kimi, Qwen CLI, Roo Code, KiloCode, Mux, Kilo CLI,
Hermes Agent, Copilot, Goose, Codebuff, CodeBuddy, Antigravity, Zed Agent,
ZCode, Kiro, Junie, Trae, Warp, Cline, Command Code, and Grok Build.
ZCode, Kiro, Junie, Warp, Cline, Command Code, and Grok Build.

Some catalog entries have explicit boundaries:

- `grok` and local `warp.sqlite` expose token totals without bucket splits, so
Tokscale applies the fixed total-only bucket allocation from ADR 0017.
- `commandcode` is transcript-estimated usage, not authoritative vendor token
accounting.
- `cursor` reads a local API cache. Logged-in local reports and the TUI can
refresh a stale cache automatically when no `--home` override is used, Cursor
is in scope, and the cache is older than five minutes; `tokscale cursor sync`
forces a refresh.
- `antigravity` and `trae` use local caches refreshed by explicit sync commands.
- `antigravity` uses a local cache refreshed by an explicit sync command.

## Data and pricing semantics

Expand Down
23 changes: 11 additions & 12 deletions README.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ bun run build:core
bun run cli

# 适合脚本的报表
bun run cli -- --no-spinner --light
bun run cli -- models --no-spinner

# 查看检测到的客户端和扫描位置
bun run cli -- clients
Expand All @@ -71,23 +71,23 @@ bun run cli -- clients
# TUI
tokscale
tokscale tui
tokscale models
tokscale monthly
tokscale hourly
tokscale tui --tab models

# 脚本化报表
tokscale --no-spinner --light
# 报表
tokscale models --no-spinner
tokscale models --no-spinner --json
tokscale monthly --no-spinner
tokscale hourly --no-spinner
tokscale graph --no-spinner --output graph.json

# 过滤
tokscale --client opencode,claude --week
tokscale tui --client opencode,claude --week
tokscale models --since 2026-01-01 --until 2026-01-31
tokscale models --group-by client,provider,model --json

# 查询价格目录
tokscale pricing claude-sonnet-4-5 --no-spinner
tokscale pricing list-overrides --json
tokscale pricing lookup claude-sonnet-4-5 --no-spinner
tokscale pricing overrides --json
```

从源码运行时,把 `tokscale` 替换成 `bun run cli --`。
Expand All @@ -99,14 +99,13 @@ tokscale pricing list-overrides --json

当前 catalog 包括:

OpenCode、Claude Code、Codex CLI、Cursor、Gemini CLI、Amp、Droid、OpenClaw、Pi、OMP、Kimi、Qwen CLI、Roo Code、KiloCode、Mux、Kilo CLI、Hermes Agent、Copilot、Goose、Codebuff、Antigravity、Zed Agent、ZCode、Kiro、Junie、Trae、Warp、Cline、Command Code 和 Grok Build。
OpenCode、Claude Code、Codex CLI、Gemini CLI、Amp、Droid、OpenClaw、Pi、OMP、Kimi、Qwen CLI、Roo Code、KiloCode、Mux、Kilo CLI、Hermes Agent、Copilot、Goose、Codebuff、Antigravity、Zed Agent、ZCode、Kiro、Junie、Warp、Cline、Command Code 和 Grok Build。

部分 catalog 条目有明确边界:

- `grok` 和本地 `warp.sqlite` 只提供没有 bucket 拆分的 token 总数,因此 Tokscale 使用 ADR 0017 定义的固定 bucket 分配。
- `commandcode` 是基于 transcript 的估算用量,不是供应商权威 token 记账。
- `cursor` 读取本地 API 缓存。已登录时,如果没有使用 `--home`,且 Cursor 在客户端范围内,并且缓存超过五分钟,普通本地报表和 TUI 可以自动刷新过期缓存;`tokscale cursor sync` 用于强制刷新。
- `antigravity` 和 `trae` 使用显式 sync 命令刷新的本地缓存。
- `antigravity` 使用显式 sync 命令刷新的本地缓存。

## 数据和定价语义

Expand Down
6 changes: 1 addition & 5 deletions crates/tokscale-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ratatui = { workspace = true }
crossterm = { workspace = true }
tokio = { workspace = true }
anyhow = { workspace = true }
thiserror = { workspace = true }
comfy-table = { workspace = true }
colored = { workspace = true }
indicatif = { workspace = true }
Expand All @@ -43,11 +44,6 @@ sha2 = "0.10"
csv = "1.3"
unicode-width = "0.2"

# Trae iCubeAuthInfo decryption (Electron globalStorage)
aes = { workspace = true }
cbc = { workspace = true }
base64 = { workspace = true }

[target.'cfg(unix)'.dependencies]
signal-hook = { workspace = true }
libc = { workspace = true }
Expand Down
Loading
Loading