ZachFara

Cost Lens — Development skill for Claude Code

Development community

Claude Code mod: see where tokens and dollars go, catch cold-cache rebuilds, pick cheaper models.

How to install Cost Lens

This entry records only its repository, not the path inside it, so there is no exact command to give. Open ZachFara/cost-lens and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Cost Lens does

Claude Code mod: see where tokens and dollars go, catch cold-cache rebuilds, pick cheaper models.

Alternatives in Development

  • Opik Openclaw — 🦞 Official plugin for OpenClaw that exports agent traces to Opik 725 ★
  • TokenCode — 为 Token 燃烧而生:token 越来越便宜,质量永远稀缺——与其省 token,不如把它当燃料烧 34 ★
  • Ctx Handoff Mod — Claude Code mod: auto handoff to a fresh conversation when context hits a threshold, keeps the prompt cache wa 25 ★

README

cost-lens

A Claude Code mod that shows where your Claude Code tokens and dollars go, warns before a message rebuilds a cold prompt cache, and can recommend the model that fits each prompt.

![cost-lens docked beside a Claude Code session: plan usage, this session's cost and split, and the context window as a grid](docs/media/now.png)

Install

Requires Claude Code 2.1.319 or later, Node.js 22.18 or later on your `PATH`, and, for the PRs tab, the GitHub CLI (`gh`). Built and tested on macOS.

At the prompt of a Claude Code terminal session:

/plugin install cost-lens --marketplace ZachFara/cost-lens

Answer `y` to add the marketplace, then pick a scope (user scope loads it in every session). From a shell instead:

claude plugin install cost-lens --marketplace ZachFara/cost-lens

In the desktop app, where `/plugin` does not run: click + next to the prompt box, then Plugins, Add marketplace with `ZachFara/cost-lens`, then Add plugin.

Then type `/cost-lens` to open the pane. Click a tab, or give the pane the keyboard with `ctrl+x tab` (twice while the cache line shows above the prompt: the first press goes to that line) and press `1` to `9`. In Claude Code's fullscreen layout (`/tui fullscreen`) it docks beside the chat; otherwise it opens above the prompt.

What it shows

  • Model: the model that fits your last prompts (needs LLM features, below), recent recommendations and how prompts are judged.
  • Now: your plan's usage limits (as /usage shows them), this session's model, cost, cost split and context.
  • Today, 30 days, All time: total cost, cache hit rate, cost by category and by model.
  • Projects, Branches, PRs: where the last 30 days went, and what each branch and pull request of the current repository cost.
  • Tips: what drives your usage in the last 24 hours, and the cost of expired-cache rebuilds and large context in the last 30 days.
  • A line above the prompt with the prompt cache's state, a warnin