Retok — AI skill for Claude Code
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)

**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
Related Skills
Token Saver
Zero-cost token optimization engine for AI coding assistants (Claude Code, Cursor, Antigravity, Windsurf). Sav
Burn O Meter
See what your AI coding agents really cost — tokens, spend, cache efficiency and rate limits. Works with Claud
Tokenmonitor
See what your AI coding tools actually use and cost — token usage & estimated spend for Claude Code, Codex CLI
Core
Agentic AI monitoring and observability — OTEL traces and local log files from Copilot, Claude Code, Codex, an
Agentlens
Agentic AI monitoring and observability — OTEL traces and local log files from Copilot, Claude Code, Codex, an
Stele Context
Local context cache for LLM agents. 100% offline, zero dependencies.
Related Agents
Independent Reviewer
Product-technical alignment reviewer. Spawned in a tmux pane via OpenAI Codex CLI with zero inherited context.
Usage Reporter
Reads real Claude Code usage from ~/.claude/stats-cache.json. Reports daily/weekly token usage by model, cache
API Cost Scanner
Scans codebase for AI/API cost optimization opportunities including model usage, token estimates, caching stra