# token-max

> A Rust CLI that replays Claude Code and Codex transcripts at API prices and recommends cheaper agent settings.

token-max is an open-source Rust command-line tool by kixelated that replays a host's Claude Code and Codex transcripts at public API prices and recommends cheaper settings. Transcripts and settings stay read-only, and no prompt, reply, summary, tool argument or tool output text is kept in the result. Its figures are API-price equivalents, not a subscription bill.

## What It Is

A local cost-analysis CLI for people running coding agents. It discovers Claude Code, Codex and T3 Code histories, prices each request using the models.dev catalog, and reports which settings and features to change, keep, or treat as lacking evidence. It never edits settings; it prints a snippet for `settings.json` or `config.toml` to merge by hand.

## What It Checks

The checks cover:
- Claude cache TTL.
- Compaction window.
- Native Claude idle compaction and T3 idle compaction.
- Fast mode versus standard speed.
- Background generation features such as prompt suggestions and recaps.
- Bash timeout cap.
- Keepalive pings.

It also prices per-request context pieces such as tools, MCP servers and skills, and recommends turning one off when its cost per use exceeds a configurable threshold (default $1). Instruction-file size notes compare CLAUDE.md and AGENTS.md against guidance limits.

## Running It and Reading Output

Install with cargo from GitHub, then run `token-max` with options such as `--since`, `--offline`, `--details`, `--json` or `--json-full`. Reports show dollar amounts per 30 days. Exit code 0 means no applicable change, 1 means a recommended change, and 2 means failure. `--ssh HOST` audits other Linux or macOS machines that have the same version installed, with each host reported separately.

## Evidence and Limits

The tool states that comparisons use only requests priced under both options, leave out requests with missing usage, and do not model lost detail or changed work. Independent check savings must not be summed.

## Features
- Replays Claude Code and Codex transcripts at public API prices
- Recommends cache TTL and compaction-window settings
- Idle compaction analysis for Claude and T3
- Per-tool, MCP server and skill context cost reporting
- Fast mode, background generation and Bash timeout cap checks
- Keepalive ping pricing
- Audit remote hosts over SSH
- Text, --json and --json-full output
- Read-only; no prompt or reply text retained
- Offline mode with cached models.dev prices

## Integrations
Claude Code, Codex, T3 Code, models.dev, OpenSSH

## Platforms
WINDOWS, MACOS, LINUX, API, CLI

## Pricing
Open Source

## Links
- Website: https://github.com/kixelated/token-max
- Documentation: https://github.com/kixelated/token-max/blob/main/docs/semantics.md
- Repository: https://github.com/kixelated/token-max
- EveryDev.ai: https://www.everydev.ai/tools/token-max
