d-date

Retok — AI skill for Claude Code

AI community

Token-efficiency analyzer for AI coding agents (Claude Code, OpenAI Codex CLI): cost estimates, cache analysis, and savings advice.

How to install Retok

This entry records only its repository, not the path inside it, so there is no exact command to give. Open d-date/retok and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Retok does

Token-efficiency analyzer for AI coding agents (Claude Code, OpenAI Codex CLI): cost estimates, cache analysis, and savings advice. Zero dependencies.

Alternatives in AI

  • Codeburn — Free, local tool to track AI coding token usage and cost across 37 tools and agents (Claude Code, Cursor, Code 9.7k ★
  • TokenTracker — Local-first AI token usage & cost tracker for 31 coding tools incl 1.4k ★
  • Clawcodex — Token efficient Claude Code full Python rebuild 875 ★

README

retok(return-of-token)

![retok — token-efficient AI coding](docs/ogp.png)

**English** | [日本語](README.ja.md)

A CLI tool that analyzes your AI coding agent usage logs — **Claude Code** and **OpenAI Codex CLI** — to measure **token efficiency**, estimate cost, and print actionable recommendations.

Runs on Python 3 with the standard library only — no dependencies.

══════════════════════════════════════════════════════════════════════════
  retok — Token Efficiency Report (last 30 days / 472 files)
══════════════════════════════════════════════════════════════════════════

■ Overview
  Estimated cost            $2,119.66
  Claude Code / Codex       $2,091.00 / $28.66
  Cache hit rate            89.4%
  Cost per prompt           $1.593
  ...

■ Recommendations

  ! Re-caching after cache TTL expiry: ~135.0M tokens ($873.49)
    Returning to a session left idle beyond the cache TTL (usually 1
    hour) re-caches the entire context at twice the input rate. ...

Installation

Requires Python 3.7+. No dependencies.

git clone https://github.com/d-date/retok.git
cd retok
./retok

To run it from anywhere, symlink it into your `PATH` (the symlink is resolved, so translations in `locales/` keep working):

ln -s "$(pwd)/retok" ~/.local/bin/retok   # or /usr/local/bin/retok
retok

Alternatively, grab just the script — everything works, but the report falls back to English because `locales/` is not present:

curl -fsSLo ~/.local/bin/retok https://raw.githubusercontent.com/d-date/retok/main/retok
chmod +x ~/.local/bin/retok

Usage

./retok                    # report for the last 30 days
./retok --days 7           # change the window
./retok --project myapp    # filter by project name (substring)
./retok --provider codex   # only one provider (claude | codex)
./retok --lang en          # report language (default: $LANG)
./retok --json             # JSON output for other tools
./retok --top 20           # rows in ranking tables