Install
openclaw skills install @baijian/token-stats-skillopenclaw skills install @baijian/token-stats-skillUse the pinned token-stats v0.0.4 release, commit c6ea90565930, verified on 2026-10-02. The public repository distributes binaries and documentation, not the CLI implementation. This skill supplies readable recording and scheduling code; it is not a sandbox or an independent audit of that binary.
codex, claude, openclaw, hermes, opencode, deepseek, workbuddy, and workbuddy-ai. trae-cn reads synced account snapshots. all includes both local sources and any available Trae CN snapshots, so it is not necessarily machine-only usage.scripts/cli-release.json using python3 -I scripts/token_recorder.py verify --bin /absolute/path/to/token-stats. The recording wrapper repeats this check each run. Do not bypass a hash mismatch, disable security tools, or use an unpinned latest-release URL.usage, report range, and the recorder use local data; --refresh does not sync Trae. Only an explicitly authorized trae sync contacts https://api.trae.cn. Never add it to the offline recorder or scheduler. Read Trae CN before using its status/sync workflow.trae status is optional and reads existing login metadata; use it only for requested Trae setup. Keep it out of general diagnostics and scheduled tasks.version --output json. For coverage, use sources --data-dir PATH --output json with matching local home overrides. supported means a collector exists and detected means a path exists, not that token counts are complete.scripts/record-token-usage.sh with explicit TOKEN_STATS_BIN, AI_TOKEN_AGENT, and optionally AI_TOKEN_DAY/AI_TOKEN_DATA_DIR. It always refreshes offline. Full per-run snapshots are disabled unless AI_TOKEN_RUN_DIR is set.usage --refresh=false or report range. Today's plain usage refreshes automatically; historical days and range reports do not. A missing daily record is a data gap, not zero. Rebuild only requested dates with --refresh, including old all reports that predate new collectors or Trae synchronization.--replace; immediate execution requires --start-now. Do not create a scheduler merely to answer a one-off usage question.total.totalTokens directly. Use byAgent, byProvider (with nested models), byProviderModel, byModel, byDay, byRateLimit, and attribution as breakdowns, not additional totals. byModel is provider-independent, so one model reached through several providers is one bucket there and several under byProvider. State a source's attribution share before presenting its provider split as complete. Daily reports contain sessions; ranges contain days. Preserve meaningful warnings, skipped-line counts, missing coverage, and the distinction between local and account-wide data.Run from the skill directory after verifying the binary. Substitute the user's chosen dates and paths; do not infer permission from these examples.
# Current-day offline collection; default agent is codex, not all.
TOKEN_STATS_BIN="$HOME/.local/bin/token-stats" AI_TOKEN_AGENT=codex \
./scripts/record-token-usage.sh
# Stored history only, even for today.
token-stats usage --agent codex --day YYYY-MM-DD --refresh=false --output json
token-stats report range --agent codex --from YYYY-MM-DD --to YYYY-MM-DD --output json
# Read-only scheduler preview: no plist, service, or output-directory changes.
./scripts/install-launchd-token-recorder.sh --agent codex --interval 1800 \
--bin "$HOME/.local/bin/token-stats" --timezone Asia/Shanghai
After authorization, repeat the same installer arguments with --confirm. See the security reference for replacement, permission migration, snapshots, status, stopping, and uninstalling. The installer uses a private versioned copy of the recorder, an absolute interpreter/binary path, and sanitized status output; editing this checkout does not silently alter an already installed runtime.
~/.local/data/cycling-health-cli/token-usage/<agent>/<YYYY-MM-DD>.json unless overridden. These contain potentially sensitive paths and usage history, despite excluding raw chat text.all with individual namespaces or add repeated cumulative snapshots. Cache/reasoning counters may overlap with input/output; do not add them to totalTokens again.scripts/cli-release.json: reviewed archive and executable SHA-256 values for all five release platforms.