GitHub Gems

Reduce Claude Code Token Costs With optimAIzr CLI

optimAIzr, an open-source local CLI for Claude Code and Codex, finds wasted tokens, warns before costly cache expiry and fixes what it can.

Terminal window displaying a token usage report from a command-line tool
Photo: GitHub

A new open-source command-line tool called optimAIzr is aimed at a cost many developers only notice when the bill arrives: the tokens they spend while working with AI coding agents. The project, published on GitHub, runs entirely on the user's machine, reads usage data that Claude Code and Codex already leave in local logs, and points to where tokens are being wasted. Its README says the tool can also fix some of those problems with a single command.

Why long sessions get expensive

According to the project's README, the largest share of cost in a long Claude Code session is not the code Claude writes. It is the cost of Claude re-reading the entire conversation on every call. Each re-read is cheap per token, but it is paid again and again as the conversation grows.

The cost climbs further after a break. The README states that Claude Code keeps a conversation cached for an hour. If a developer returns after that window, the first message writes the whole conversation back into the cache, at up to twice the input price. For anyone running long, multi-hour sessions, those re-writes can add up quickly, and many users never see them broken out in their usage reports.

That gap between what people expect to pay and what they actually pay is the problem optimAIzr is designed to expose.

What the tool does

The tool is organised around three kinds of help. The first is timing. A command places a countdown under Claude Code's prompt that shows what coming back to the conversation will cost. The README describes it as available without the optional Claude Code mod, which was added in a later release.

The second is live warnings. Running optimaizr live beside an agent alerts the user when context jumps or passes 200K tokens, and five minutes before a cache expires. It also offers a fix that the user can accept by pressing Y.

The third is retrospective analysis. The optimaizr sessions command lists a user's most expensive conversations, identified by the titles Claude Code assigned to them. It then shows the context size at which re-reading begins to dominate the cost, explains what each cache write was for, and records every occasion when the user came back too late.

Each finding explains what happened, why it matters and how much it could save, with figures calculated in dollars from the user's own logs. The README is careful about how savings are presented. They are split into three categories: clear waste, likely savings and savings marked 'up to'. The categories are never added together, which avoids inflating the total.

How it handles data

Privacy is a central selling point. The README says the tool requires no account, performs no upload and collects no telemetry. It reads token counts from logs already on the machine, but not the user's prompts or Claude's answers.

To identify repeated work, the tool does read some tool-call inputs, such as a file path, a command, or the first 200 characters of any other input. The README says this material is held in memory only and is not stored.

The README lists only a small set of network calls. These are a verification step that goes to the user's own provider with the user's own key, an optional second-opinion feature called Jev, and a daily version check against npm. The version check can be disabled by setting the environment variable OPTIMAIZR_NO_UPDATE_CHECK to 1. Everything else is kept in a folder at ~/.optimaizr/, and the project's SECURITY.md file lists every file it reads and writes.

Support, requirements and release history

Claude Code and Codex are supported without extra setup. The tool detects a user's Claude plan, which the README lists as Pro, Max or Team, as well as a ChatGPT plan. Developers building their own applications can connect the tool with one line of code, either by wrapping an Anthropic client or an OpenAI client. CSV and JSON usage exports are also accepted. The tool requires Node 20.11 or later.

The project has moved quickly through a series of releases in October 2026:

  • 0.8 (October 2): a Claude Code mod that shows the cost of each answer and offers cheaper models mid-session.
  • 0.9 (October 6): automatic plan detection, savings labelled by confidence, and earlier compaction in one command.
  • 0.10 (October 7): a cache countdown under Claude Code's prompt that needs no mod, plus tools to spot heavy conversations from the start.
  • 0.11 (October 12): a results command that compares usage in the days after each change with the days before, and an apply command that lists possible changes.

The README says the tool was first presented on September 13, 2026, and became open source on September 30, 2026. A separate hosted product, optimAIzr Pro, is planned for optimaizr.com and is not part of this repository.

What readers should weigh before trying it

The tool addresses a real and growing concern for developers who rely on AI coding agents, where usage costs can be hard to trace. Its local-first design and transparent savings categories will appeal to users wary of sending prompts to third-party services.

However, the savings figures come from each user's own logs, so the results will vary with how a person works. The README does not provide independent benchmarks or user adoption numbers. Anyone considering the tool should read the documentation and SECURITY.md before installing it, and should check the savings it reports against their own invoices.

Source: GitHub

Comments (0)