← 返回
开发者工具 中文

toll

Track and display token usage statistics and estimated USD costs from Claude Code and Codex CLI sessions
追踪并显示 Claude Code 和 Codex CLI 会话的 Token 使用统计及预估 USD 成本。
fullstop000
开发者工具 clawhub v1.0.5 1 版本 100000 Key: 无需
★ 0
Stars
📥 477
下载
💾 11
安装
1
版本
#latest

概述

toll — Token Usage Tracker

toll is a CLI tool that aggregates token usage logs from Claude Code and Codex CLI and displays session counts, token totals, cache hit rates, and estimated USD costs.

Installation

If toll is not installed, install it first:

# Quick install (Linux/macOS)
curl -fsSL https://raw.githubusercontent.com/Fullstop000/toll/refs/heads/master/install.sh | sh

# Or via cargo
cargo install toll

Usage

When the user invokes /toll, run the appropriate toll command based on their intent:

User IntentCommand
------
All-time summary (default)toll
Today's usage onlytoll --today
Last N daystoll --days
Daily breakdowntoll --by-day
Claude Code onlytoll --claude
Codex CLI onlytoll --codex
Full token countstoll --detail
JSON outputtoll --json
CSV outputtoll --csv
List model pricestoll --list-prices

Flags can be combined, e.g. toll --by-day --days 7 --claude.

Behavior

  1. Check if toll is installed by running toll --version. If it fails, prompt the user to install it using the command above.
  2. Parse the user's request to determine which flags to pass.
  3. Run toll with the appropriate flags and present the output to the user.
  4. Explain the output if the user seems unfamiliar with the metrics:
    • Sessions: number of AI coding sessions tracked
    • Input: total input tokens sent to the model
    • Cached: tokens served from the prompt cache (cheaper)
    • Hit Rate: percentage of input tokens that were cached
    • Net Input: non-cached input tokens (full price)
    • Output: tokens generated by the model
    • Cost: estimated USD cost based on per-model pricing

Example Interactions

User: /toll

→ Run toll and show all-time summary

User: /toll today

→ Run toll --today

User: /toll last 7 days

→ Run toll --days 7

User: /toll daily breakdown this week

→ Run toll --by-day --days 7

User: /toll how much have I spent on Claude?

→ Run toll --claude and highlight the Cost column

User: /toll export csv

→ Run toll --csv and offer to save the output to a file

Notes

  • Cost estimates marked with * include models whose pricing is approximate or inferred by prefix matching.
  • Token counts use compact notation: 1.2m = 1,200,000 tokens, 45.6k = 45,600 tokens.
  • Logs are read from ~/.claude/projects/*/.jsonl (Claude Code) and ~/.codex/sessions/ (Codex CLI).

版本历史

共 1 个版本

  • v1.0.5 当前
    2026-03-30 03:20 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 668 📥 324,162
developer-tools

Agent Browser

matrixy
专为AI智能体优化的无头浏览器自动化CLI,支持无障碍树快照和基于引用的元素选择。
★ 427 📥 118,203
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 68 📥 180,181