Skip to content
hey-puPublic

About

Willow (柳) · Windows Token 统计工具,查看 AI 编程用量、Token 消耗与费用估算。Open-source Windows desktop token tracker for AI coding tools. Track local token usage, estimated costs, and sessions for Codex CLI, Claude Code, WorkBuddy, Qoder, and more. macOS builds from source.

Topics

Resources

Stars

35 stars

Watchers

0 watching

Forks

Repository files navigation

Willow

Willow · 柳

An open-source desktop dashboard for AI coding usage.

Track tokens, estimated costs, and sessions for OpenAI Codex CLI, Claude Code, Kimi CLI, and other coding agents. Willow reads usage logs on your device.

License: MIT Platform Tauri React

English · 简体中文

Download for Windows x64 · Build on macOS

What is Willow?

Willow brings local usage logs from multiple AI coding tools into one desktop app. Compare input, output, and cache tokens, see estimated costs by day or model, and look up individual sessions. Open the quick panel from the Windows system tray or the macOS menu bar.

Reports reflect the usage recorded on your device. Cost estimates use model prices. Check your provider's dashboard for official billing and subscription limits. Willow stores usage data locally in SQLite and can refresh its pricing data online.

Switch between Chinese and international token units. The same 150,000,000 tokens can display as 1.5亿 or 150M. Choose a format under Settings → Appearance → Token units.

Willow showing AI token usage, estimated costs, and model breakdowns using demo data

Features

  • Multi-agent: Claude Code, Codex CLI and Kimi CLI out of the box, with an adapter architecture ready for more
  • Cost estimates: long-context pricing (the whole request above 200K/272K/512K, as vendors bill it), 5m/1h cache-write pricing, cache-read discounts, fast/priority tier rates, dated list-price changes, DeepSeek off-peak rates — and stored estimates are recalculated when prices change
  • Windows desktop widget keeps today's tokens and estimated cost visible. Drag it toward a screen edge to snap into a compact circle, then drag from anywhere on the circle to reposition it. Supports Chinese 万/亿 and international K/M/B units, saved placement, and automatic hiding during fullscreen use.
  • Windows update reminders show new releases, changes, and a download link. Settings includes a manual update check and notes for the installed version.
  • macOS menu bar ticker shows today's cost or token count next to the clock
  • 5-hour billing blocks: each agent's usage grouped into hour-aligned 5-hour windows (Claude's and Codex's usage windows), with live burn rate
  • Trends & breakdowns: daily/weekly/monthly charts by agent, model, and token type
  • Local & private: usage logs are parsed and stored locally in SQLite; pricing is refreshed online
  • Light & dark themes, accent colors, and an English/中文 interface

Supported data sources

The following AI coding agents are supported, with some adapter logic ported from ccusage. Windows support also includes Qoder IDE, Qoder CN and WorkBuddy:

Agent Location Format
Claude Code $CLAUDE_CONFIG_DIR / ~/.config/claude/projects / ~/.claude/projects JSONL
Codex CLI (OpenAI) sessions/ and archived_sessions/ under $CODEX_HOME JSONL
Gemini CLI $GEMINI_DATA_DIR or ~/.gemini/tmp JSON / JSONL
OpenCode $OPENCODE_DATA_DIR or ~/.local/share/opencode SQLite + JSON
OpenClaw $OPENCLAW_DIR or ~/.openclaw JSONL
GitHub Copilot CLI ~/.copilot/otel/*.jsonl OTEL JSONL
Qwen Code projects/*/chats/ under $QWEN_DATA_DIR or ~/.qwen JSONL
Kimi CLI sessions/**/wire.jsonl under $KIMI_DATA_DIR or ~/.kimi JSONL
Amp threads/ under $AMP_DATA_DIR or ~/.local/share/amp JSON
Droid (Factory) $DROID_SESSIONS_DIR or ~/.factory/sessions JSON
Goose sessions.db in the Goose data dir or $GOOSE_PATH_ROOT SQLite
Kilo kilo.db under $KILO_DATA_DIR or ~/.local/share/kilo SQLite
Codebuff ~/.config/manicode*/projects or $CODEBUFF_DATA_DIR JSON
Hermes Agent state.db under $HERMES_HOME or ~/.hermes SQLite
pi-agent $PI_AGENT_DIR or ~/.pi/agent/sessions JSONL

Sources with no local data are detected automatically and simply stay empty. Adding another agent is one file in src-tauri/src/adapters/.

Install and build

Windows · Download

Download the latest Willow_*_x64-setup.exe from GitHub Releases. The Windows x64 installer is unsigned. To build it on Windows, run pnpm install --frozen-lockfile followed by pnpm tauri build --bundles nsis.

Right-click the Willow tray icon and enable Show Usage Widget to display today's usage. Click the widget to open the quick panel. Drag away from an edge for the expanded strip, or toward an edge to dock as a circle. Willow remembers the widget's position and visibility across restarts.

To upgrade from v0.4.0, quit Willow and run the new installer over your existing installation. Your usage history and preferences are retained. v0.5.0 can notify you about releases and open their download page. Starting with v0.5.1, Willow can download and install signed updates in-app. v0.5.0 users must manually install v0.5.1 once to enable the updater.

macOS · Build from source

Willow builds for both Apple Silicon and Intel. There is currently no macOS installer on GitHub Releases. On a Mac, install Node.js, pnpm, Rust, and the Tauri prerequisites, then run these commands from the project directory:

pnpm install --frozen-lockfile
pnpm tauri build --bundles dmg

GitHub Actions has built and verified the disk images for both architectures. Installation, menu bar behavior, and data migration still need testing on a Mac. A public macOS download is deferred until that testing and Apple signing and notarization are complete.

If you have data from an earlier compatible app, quit that app before launching Willow for the first time. Willow imports history, settings, and supported preferences, including subscriptions, when its data directory is empty.

Accuracy

Parsing and billing logic is ported from ccusage, an implementation validated against large amounts of real-world data:

  • Full message.usage token schema, including cache_creation ephemeral_5m/1h breakdowns
  • Deduplication by messageId + requestId, keeping the record with more tokens on conflict; Codex events re-emitted with unchanged totals count once
  • LiteLLM pricing (embedded offline snapshot + daily online refresh with a jsDelivr mirror for networks that can't reach GitHub) with model-name matching that prefers the vendor's own price over resellers; built-in official prices fill the gaps for brand-new models
  • Prices follow the date of each request (e.g. GPT-5.6's July/August price cuts), fast/priority usage uses the vendor's published priority rates, and long prompts bill the whole request at the long-context rate
  • Cost modes: auto (prefer logged costUSD) / calculate (always recompute) / display (logged costUSD only)
  • Settings → Pricing shows where prices come from and lists any model without a known price (counted as $0)
  • History is kept when an agent prunes its old logs (Claude Code deletes transcripts after 30 days by default)
  • Where Willow deliberately differs from ccusage: whole-request long-context pricing, the Codex duplicate-event fix, and fast-tier rates for newer models

Development

pnpm install
pnpm tauri dev      # development mode
pnpm tauri build    # package (macOS .app/.dmg, Windows .msi/.exe)

End-to-end backend test (scans real local data):

cd src-tauri && cargo test --test pipeline -- --nocapture

Architecture

src-tauri/src/
├── adapters/        # one adapter per agent data source
│   ├── claude.rs    # Claude Code JSONL parsing
│   ├── codex.rs     # Codex CLI parsing
│   ├── jsonl.rs     # streaming, resumable JSONL reader
│   └── kimi.rs      # Kimi CLI parsing
├── pricing.rs       # LiteLLM pricing, built-in/dated prices, model matching
├── cost.rs          # long-context-aware cost calculation
├── db.rs            # SQLite cache: skips unchanged files, reads only appended bytes, re-prices on price changes
├── aggregate.rs     # daily/sessions/models/projects/blocks aggregation
├── types.rs         # normalized UsageRecord
└── lib.rs           # Tauri commands

src/
├── pages/           # Overview / Trends / Sessions / Models / Blocks / Settings
├── components/      # shadcn-style UI + Recharts charts
└── lib/             # api.ts (typed invoke) / format.ts / i18n.tsx

Data flow: on launch (and every 60s) incrementally scan log directories → parse & normalize → dedupe into SQLite (priced via LiteLLM on insert) → frontend queries aggregates by time range / cost mode.

Credits

  • ccusage: Willow's parsing and billing logic is ported from this project
  • Tauri · LiteLLM (pricing data) · Recharts
  • Special thanks to the LinuxDO community for their recognition and support.

License

MIT. See third-party notices for ported code.

About

Willow (柳) · Windows Token 统计工具,查看 AI 编程用量、Token 消耗与费用估算。Open-source Windows desktop token tracker for AI coding tools. Track local token usage, estimated costs, and sessions for Codex CLI, Claude Code, WorkBuddy, Qoder, and more. macOS builds from source.

Topics

Resources

Stars

35 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages