360 Secure SkillHub
360 安全技能中心

toll

这是一个包装 toll 命令行工具的 Skill:读取本地 Claude Code 与 Codex CLI 会话日志,按全部时间、今日、最近 N 天、按天、按工具等维度汇总会话数、输入/缓存/输出 token、缓存命中率与估算美元成本,支持文本、JSON、CSV 输出及价格列表查询。若未安装 toll,会提示用户先安装。

fullstop000
fullstop000
热度 79.73
最近更新 2026-05-11 17:31:05
分类:数据依赖:代码执行 / 读写文件应用场景:报告撰写 / 数据处理 / 财务

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add toll
Metadata
name
toll
description
Track and display token usage statistics and estimated USD costs from Claude Code and Codex CLI sessions
version
1.0.5
homepage
https://github.com/Fullstop000/toll
user-invocable
true
metadata
{"openclaw":{"requires":{"bins":["toll"]}}}

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 Intent Command
All-time summary (default) toll
Today's usage only toll --today
Last N days toll --days <N>
Daily breakdown toll --by-day
Claude Code only toll --claude
Codex CLI only toll --codex
Full token counts toll --detail
JSON output toll --json
CSV output toll --csv
List model prices toll --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).