For developers using Claude Code, Codex and Gemini CLI

An itemized bill for your AI coding tools

See what each project, session and model cost, whether your subscription pays off, and roughly how much time the agents saved you. Agent Ledger reads the logs your tools already keep on your computer. Nothing is uploaded.

npx agent-ledger

Needs Node.js 20 or newer. Opens in your browser at 127.0.0.1.

Agent Ledger dashboard: $433.60 API-equivalent cost over 30 days, budget meters for today, this month and one client project, and spend per day stacked by project.

Screenshot with sample data.

Your AI vendor shows one number. You need the breakdown.

Which project was it?

Freelancing or juggling repos? Agent Ledger splits spend by git repository, so you can bill a client or see where the month went.

Which session burned it?

The most expensive sessions are listed with their titles, request counts and models, so a runaway agent loop is easy to find.

Is the plan worth it?

Enter your monthly fee and Agent Ledger compares it with what the same tokens would cost at pay-as-you-go API prices.

How it works

  1. Run one command. npx agent-ledger needs no install, account or API key.
  2. It reads your local logs. Claude Code keeps session logs in ~/.claude/projects, Codex in ~/.codex/sessions, Gemini CLI in ~/.gemini/tmp. Every request in them records the model and token counts.
  3. Your bill opens in the browser. Tokens are priced per request, including cache reads and writes and long-context rates, then grouped by day, project, session and model.

What you get

Projects as line items

Sessions are grouped by the git repository they ran in, even when they started in a subfolder. Each project shows cost, share, tokens, sessions, active time and lines the AI wrote. Select one to see its sessions and models.

Cost you can check

Prices come from the public LiteLLM price list, which matches Anthropic's and OpenAI's published rates. If a model has no known price, Agent Ledger tells you and counts it as $0 until you enter one. It never guesses.

Export for invoicing

One click downloads a CSV of the period's projects, with cost, tokens, sessions, hours and lines.

Project view for Storefront (client): rename and merge controls, cost for the period, its monthly budget meter, and spend per day.

Time saved, with the formula shown

Lines the AI wrote ÷ your own pace (lines per hour, which you set). It's an estimate, labelled as one, and the assumption is always one click away.

History that doesn't disappear

Claude Code deletes transcripts after 30 days by default. Agent Ledger keeps what it has already read, so "All time" really means all time.

A terminal report too

npx agent-ledger report --since month --by project prints the bill in your terminal. Add --json for scripts.

Budgets that warn you

Set a daily, monthly or per-project limit. Meters show how close you are, and you get a desktop notification at 80% and 100%. The optional macOS menu-bar widget keeps today's spend in view.

Updates as you work

The dashboard re-reads changed logs every minute while it's open, and only parses files that changed.

Agent Ledger on a narrow screen: the bill summary and the spend chart.

Private by how it's built

Your session logs contain your prompts and your code. Agent Ledger is designed so they stay on your machine.

  • No account needed, no analytics, and no telemetry unless you turn on anonymous stats.
  • The dashboard server only listens on 127.0.0.1 and refuses requests addressed to any other host, which blocks other websites from reading it.
  • Log files are only read, never changed.
  • Out of the box, the only network request is the optional Update prices action, which downloads a public price list from GitHub and sends nothing about you.
  • Backup is optional. If you turn it on, your settings (and, if you like, daily totals) are encrypted on your computer with a passphrase only you know before upload. Logs, prompts and code are never uploaded. What the service can see.
  • Settings and saved history stay in your user folder. Delete that folder and everything Agent Ledger stored is gone (where it's stored).

Questions

I'm on a subscription (Claude Max, ChatGPT Plus/Pro). Is this useful?

Yes. The figure shown is API-equivalent cost: what the same tokens would cost at pay-as-you-go API prices. Enter your monthly fee in Settings to see how much value you get from the plan. It's also the best way to see which projects use up your rate limits.

How accurate are the numbers?

Token counts come straight from the logs. Agent Ledger removes the duplicate entries Claude Code writes while a response streams, keeping the final copy, which has the complete output count. Prices include cache reads, 5-minute and 1-hour cache writes, long-context rates, and Anthropic's fast-mode and US-only inference multipliers. Not included: web search fees, batch discounts and any negotiated pricing. Your invoice is the final word.

Which tools are supported?

Claude Code (in the terminal and in IDE extensions, which write the same logs) OpenAI Codex (CLI and desktop app) and Gemini CLI. Cursor and GitHub Copilot don't keep per-request token counts on your machine, so they can't be supported this way.

How is "time saved" calculated?

Lines added by the AI's file edits, divided by the lines per hour you'd write yourself (50 by default; change it in Settings). Edits Codex makes through shell commands aren't visible in its logs, so they aren't counted. Treat the result as a rough estimate.

My logs are in a non-standard folder.

Use --claude-dir, --codex-dir or --gemini-dir, or set CLAUDE_CONFIG_DIR / CODEX_HOME / GEMINI_CLI_HOME as you would for the tools themselves. To make it permanent, list the folders under logDirs in the config file (how).

What happens if I lose my laptop?

If you turned on the optional encrypted backup, sign in on the new computer with your passphrase (or recovery key): budgets, renames, merges, prices and your daily totals come back. Without a backup, only your logs and the settings folder hold that data.

What does it cost?

Nothing. Agent Ledger is free and open source under the MIT license.

See where your tokens go

npx agent-ledger