← Back to archive

Repo of the Day

kixel-ai/token-max

Published: Dec 3, 2026

Open repository ↗

Replays your Claude Code and Codex transcripts against API prices and recommends cheaper agent settings

Summary

token-max is a Rust command-line tool that replays recorded Claude Code and Codex sessions against public API prices to estimate how alternative agent settings would change costs. It turns that analysis into a reviewable checklist and can apply approved changes to configuration files.

What it is useful for

The tool is useful for engineers who want to understand API spending on coding-agent sessions rather than guessing at settings. It reads token counts, timestamps, and request IDs from transcripts while retaining neither prompts nor replies, then reconstructs cache behavior and replays sessions under alternative configurations.

token-max doctor checks several recurring cost sources, including:

  • Prompt-cache lifetimes for main agents and subagents
  • Auto-compaction, turn-end compaction, and idle compaction
  • Context sent by tools, skills, MCP servers, CLAUDE.md, and AGENTS.md
  • Model effort, fast mode, auto memory, background features, and keepalive pings
  • The cost of different subagent types and models

The README’s maintainer example reports approximately $70,508 in API-level spending across 12,176 sessions, with about $5,653 in potential monthly savings from default settings. Those figures are specific to that history and include extrapolated amounts, so engineers should run the tool against their own transcripts rather than assume the same result.

It is also useful when standard configuration advice cannot be priced from recorded requests. Those items are moved into token-max vibes, where they are presented as advice without a cost verdict.

How engineers can use it

With Node installed, run the audit from your home directory:

npx @kixel/crabx token-max doctor

Running from the home directory matters because npx inside a repository checkout may execute packages from that checkout instead.

For a standalone installation, the README documents:

curl -LsSf https://max.kixel.me/install.sh | sh

Engineers can also build from source with cargo install --locked token-max.

Useful report variants include:

token-max doctor --since 2026-11-01
token-max doctor --details
token-max doctor --ssh devbox
token-max vibes

These restrict the date range, show the evidence behind each recommendation, or audit the local machine and another host separately. doctor presents each proposed edit and requires confirmation before changing anything. It also creates a .token-max.bak backup unless the file is already protected by git.

The main limitation is pricing coverage: token-max uses a built-in snapshot of public API prices, and requests it cannot price remain unknown rather than being treated as free. Its results therefore depend on the completeness of the recorded transcripts and the availability of matching price data.