AI Tools

Claude Code and Codex Tools: Cut Costs, Mix Models, Monitor

AI coding agents bring three practical problems: bills that are hard to trace, juggling several models, and sessions that stall while you are away from the terminal. A few open-source tools target...

AI coding agents bring three practical problems: bills that are hard to trace, juggling several models, and sessions that stall while you are away from the terminal. A few open-source tools target each one. This guide explains how prompt caching drives cost, then covers what each tool does, how to install it, and where its limits are.

Quick answer: use optimAIzr to see where tokens go and when your cache is about to expire, Codex on Crack to mix models inside Codex, and Coucou to approve agent requests without returning to the terminal. Parsimony helps when you are choosing a model. Start with the cache section below, because it explains most surprise bills.

Checked against the source on November 5, 2026. The optimAIzr repository page lists release 0.13 dated Oct 30, 2026 under an MIT licence, and the Claude Code prompt caching documentation confirms the one-hour versus five-minute TTL rules described below.

  • optimAIzr: MIT licence; needs Node 20.11 or later; covers Claude Code, Codex and opencode 1.x.
  • Codex on Crack: MIT licence; needs Node.js 24.15 or later; the README calls it a preview release.
  • Coucou: code is MIT; macOS 15+, Windows 10/11, Linux x86_64; latest listed builds are macOS 0.5.8 (Oct 31, 2026) and Windows/Linux 0.5.9 (Nov 3, 2026).
  • Parsimony: MIT licence; Python 3.12 or newer for the Python analyzer, which the README says has no dependencies.

How prompt caching decides your bill

Every message in Claude Code re-sends the whole conversation. Anthropic's Claude Code documentation says the API avoids reprocessing the unchanged start of the request (the "prefix") by serving it from a cache, and bills that re-read at a lower rate. Cached prefixes expire after a period of inactivity, and each request that hits the cache resets the timer.

The official API pricing multipliers, relative to the base input price:

Operation Multiplier
5-minute cache write 1.25x
1-hour cache write 2x
Cache read 0.1x by default (0.05x for Opus 5.5 and Sonnet 5.5)

So the claim in optimAIzr's README that re-caching after a break costs "up to twice the input price" matches the 1-hour write rate. Two details matter that the README summary leaves out:

  • The hour is not universal. Claude Code's docs say that unless you choose otherwise, it requests the one-hour TTL only on a Claude subscription within your plan's included usage. With an API key, a cloud provider, or usage credits, the main conversation gets the five-minute TTL by default. Correction to our earlier wording: Claude Code does not always keep a conversation cached for an hour.
  • You can choose. Set promptCacheTtl to 1h (or the CLAUDE_CODE_PROMPT_CACHE_TTL environment variable; requires Claude Code v2.1.242 or later). FORCE_PROMPT_CACHING_5M=1 forces five minutes.

To confirm what your sessions use, run claude -p "hello" --output-format json and read usage.cache_creation: one-hour writes appear under ephemeral_1h_input_tokens, five-minute writes under ephemeral_5m_input_tokens.

Worked example: what one expired cache costs

This is an illustration, not a bill. Assumptions: API list prices for Claude Sonnet 5.5 from Anthropic's pricing table ($2 base input, $2.50 five-minute write, $4 one-hour write, $0.10 cache read, per million tokens); a conversation that stays at 150,000 tokens (0.15 million); new messages and output ignored. Subscribers are not billed these dollars; the same tokens count against plan limits.

What happens when you return Arithmetic Cost
Cache still warm (read) 0.15 x $0.10 $0.015
Expired, five-minute TTL (rewrite) 0.15 x $2.50 $0.375
Expired, one-hour TTL (rewrite) 0.15 x $4.00 $0.60
No caching at all 0.15 x $2.00 $0.30

One cold return costs 25 times a warm one on the five-minute TTL and 40 times on the one-hour TTL. With Opus 5.5 ($4 base, $5 and $8 writes, $0.20 read) the same figures are $0.03 warm, $0.75 and $1.20 cold.

Now a day with six breaks of 10 to 30 minutes, same assumptions:

  • Five-minute TTL: first write $0.375, then six cold returns at $0.375 each, total $2.63.
  • One-hour TTL: first write $0.60, then six warm returns at $0.015, total $0.69.

The one-hour write costs $0.225 more up front ($0.60 minus $0.375). Avoiding a single rebuild saves $0.36 ($0.375 minus $0.015), so it pays off after one avoided expiry. If your breaks run past an hour, both settings rebuild and the one-hour write just costs more. Real sessions vary: context grows and compaction changes the prefix.

1. Understand token costs: optimAIzr

optimAIzr is a local command-line tool for Claude Code, Codex and opencode 1.x (the README now lists opencode, which our earlier article did not).

Set up (Node 20.11 or later):

npx optimaizr
optimaizr statusline on    # cache countdown under Claude Code's prompt
optimaizr guard on         # hold an expensive message once
optimaizr live             # watch open conversations
optimaizr sessions         # where long conversations get expensive
optimaizr why              # spend by model, project, kind of work
optimaizr apply context-compaction   # compacts at 200K; Claude Code and Codex only
optimaizr results          # did the fix work?

Undo with optimaizr undo <rule>. The README lists release 0.13 (30 October 2026) with a VS Code extension, and /plugin marketplace add blendbunjaku/optimaizr for Claude Code. For your own apps, wrap a client with optimaizr.wrap(new Anthropic()).

Privacy. No account, no upload, no telemetry. It reads token counts from ~/.claude, ~/.codex and the opencode database, stores its data in ~/.optimaizr/, and does not read prompts or answers by default. The daily npm version check can be disabled with OPTIMAIZR_NO_UPDATE_CHECK=1. The README points to SECURITY.md for the file list.

Limits. Dollar figures come from the author's own usage and are self-reported. Compare its output with your invoice, and remember the subscription caveat above. MIT licence.

Suits: anyone running long Claude Code sessions with an API key or usage credits.

2. Mix models inside Codex: Codex on Crack

Codex on Crack, formerly Astra Flash Orchestrator, lets a lead model in Codex plan a task, hand building to another model and review the result.

Set up (from a checkout of the repository in a stable folder):

codex plugin marketplace add "$PWD"
codex plugin add codex-on-crack@codex-on-crack
codex plugin add codex-on-crack-panel@codex-on-crack   # optional panel

It needs Node.js 24.15 or later, a Codex client with plugin support and your own model access. Claude mode needs the official Claude Code CLI signed in through your subscription. Start a fresh conversation and try the README's prompts, such as "Have Opus plan this and Flash implement it. Bring the result back for review."

The skills are crack-plan (plan and choose models), crack-setup (configure workers, with preview and undo) and crack (execute and review). Setup does not run paid model requests; builds use whatever access you authorise.

Limits. It is a preview release. The Claude adapter targets claude-opus-5-5 only. Instructions and file scopes are not an OS sandbox. The repository gives no exact figures for its earlier usage result and says it is not a general promise of savings. MIT licence, not affiliated with OpenAI, Anthropic or DeepSeek.

Suits: Codex users who already have access to more than one model and want a written plan and a review step.

3. Approve requests away from the terminal: Coucou

Coucou shows agent sessions in the Mac notch, or a bar at the top of the screen on Windows and Linux.

Set up. macOS 15 or later:

brew tap louis-cfm/coucou https://github.com/Louis-CFM/coucou
brew install --cask coucou

Windows 10 or 11 uses an .msi or setup .exe; the installer is not code-signed, so SmartScreen warns first. Linux x86_64 ships as AppImage, .deb and .rpm. Then open Settings, choose the agent and click "Install hooks". For Claude Code it backs up ~/.claude/settings.json, shows a diff and then merges its hooks. If Coucou is not running, the hook exits at once so Claude Code is never blocked.

What it covers. Claude Code gets Allow, Deny or Always; Codex gets Allow and Deny; Cursor, Gemini CLI and others are listed. Phones: the iPhone app (iOS 18 or later) is in a free TestFlight beta capped at 10,000 testers and asks for Face ID on Allow. Correction: the README now offers a signed Android APK (the latest release on GitHub was 0.4.0 when we checked on 5 November 2026; Android 11 or later) that pairs over the same Wi-Fi with the Windows or Linux app, not the Mac app.

Limits and licence. Some features exist only in the GitHub build, not the sandboxed App Store build. Code is MIT; the name, Mochi character and sounds are the creator's copyright. It states no telemetry and no account.

Suits: people running several agents who step away often.

4. Compare models by code added: Parsimony

Parsimony counts syntax units (statements, calls, comparisons, names, literals) that a patch adds, subtracts those it removes, and ranks models by mean net units on tasks they solved, lowest first. Nothing is executed and pass or fail comes from published benchmark results.

You can reproduce it (Python 3.12 or later):

git clone --depth 1 https://github.com/La5u/Parsimony && cd Parsimony
scripts/check.sh

The GitHub README lists data from DeepSWE, SWE-bench Verified (35 models, 500 tasks) and other sets, in several languages; the site text we fetched still says Python only, so check the current scope. Its own caveats: smaller is not automatically better, models that write more code tend to solve more (Spearman 0.33 to 0.60 on boards of 26 or more models), and the agent as well as the model affects size. MIT licence.

Suits: teams choosing a default model.

A daily workflow

  1. Start of day: pick model and effort first. Claude Code's docs say each model has its own cache, so switching mid-task makes the next request read everything uncached.
  2. Check your TTL once: use the claude -p command above, and set promptCacheTtl to 1h if you use an API key and often pause.
  3. While working: run optimaizr statusline on. In Claude Code, /usage shows a "Prompt cache" line with warm or cold status (v2.1.251 or later).
  4. Before a break over five minutes: use /compact at a natural stopping point while the cache is warm, since the docs say a warm compaction costs a fraction of a cold one. Use /clear between unrelated tasks, after /rename so you can /resume.
  5. Away from the desk: let Coucou carry approvals to your phone.
  6. End of week: optimaizr sessions, then optimaizr results after any change.

Which tool for which problem

Problem Tool Requires
Surprise token bills optimAIzr Node 20.11+
Planner and builder on different models Codex on Crack Node.js 24.15+, Codex with plugins
Sessions stall waiting for approval Coucou macOS 15+, Windows 10/11 or Linux x86_64
Choosing a model Parsimony A browser, or Python 3.12+ to reproduce

Who should skip it

  • opencode 2.0 users. The optimAIzr README says history from opencode 2.0 is not read yet, and its context-compaction rule changes Claude Code and Codex only.
  • Anyone who wants a hosted dashboard. The optimAIzr page marks its hosted dashboard (optimAIzr Pro) as coming soon, so it is not available; its VS Code status bar and alerts watch Claude Code only.
  • Anyone who needs a sandbox or a general model on Codex on Crack. Its README says instructions and file scopes are not an OS sandbox, and the Claude adapter targets only claude-opus-5-5.
  • Windows users who cannot accept an unsigned installer. Coucou's README says the Windows installer is not code-signed yet, and that Flow dictation and the Notetaker are Mac-only for now.
  • Anyone who wants Parsimony to judge code quality. The README says units measure size, not readability or design, and that models which write more code also tend to solve more tasks.

Alternatives worth a look

  • ccusage analyzes token usage and costs from local data. Its page lists Claude Code and Codex among many supported agent CLIs and an MIT licence; it reports usage rather than offering a cache countdown or guard.
  • Claude Code's built-in /usage command adds a Prompt cache line with hit ratio, miss count and warm or cold status (Claude Code v2.1.251 or later), with no extra install.

Frequently asked questions

Does optimAIzr send my prompts anywhere? Its README says no account, no upload and no telemetry, and that it reads token counts rather than prompts.

Is the one-hour cache free? No. The write costs 2x base input against 1.25x for five minutes, and reads are cheaper than either.

Can I use Codex on Crack with any model? Not automatically. The Claude adapter targets claude-opus-5-5, and native workers need a compatible configured route.

Does a cheaper cache setting help on a subscription? Your dollars do not change, but the same cache misses use more of your plan's allowance.

Tool details come from each project's GitHub page. Claims are the makers' own and have not been independently verified. Cost figures are illustrations from the stated list prices.

Sources

  • https://platform.claude.com/docs/en/build-with-claude/prompt-caching
  • https://code.claude.com/docs/en/prompt-caching
  • https://code.claude.com/docs/en/costs
  • https://github.com/blendbunjaku/optimaizr
  • https://github.com/ethanplusai/codex-on-crack
  • https://raw.githubusercontent.com/Louis-CFM/coucou/main/README.md
  • https://github.com/La5u/Parsimony
  • https://parsimony.lasu.dev/
  • https://github.com/Louis-CFM/coucou
  • https://github.com/ryoppippi/ccusage

Comments (0)