Skip to content
kanywstPublic

About

Are your AI coding-agent subscriptions paying off? Prices your local agent logs at API rates and divides by what you pay.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

agentroi

English | 日本語

CI Go Reference Release License

Are your AI coding-agent subscriptions paying off? agentroi reads the logs your agents already keep on disk, prices every token at the pay-as-you-go API rate, and divides by what you pay each month.

agentroi on made-up logs: the API value of a month with no plan set, then with Claude Max 5x and Copilot Pro set, then the Japanese report

The logs in the demo are made up by tools/demodata. vhs demo/demo.tape re-records it.

Usage trackers tell you how many tokens you burned and what that would cost on the API. They do not tell you whether the $100 or $200 you pay each month is the better deal, or which of your four subscriptions is the one to cancel. agentroi puts the API value next to the fee, per subscription, and knows which plans bill by quota (where the multiple matters) and which bill credits at API rates (where about 1x is the design).

Install

brew install --cask kanywst/tap/agentroi

Or with Go:

go install github.com/kanywst/agentroi@latest

Or take a binary from releases (macOS, Linux and Windows; checksums.txt is signed with cosign, keyless).

opencode and Goose keep their data in SQLite, which agentroi reads through the sqlite3 CLI. macOS ships it; on Linux install your distribution's sqlite3 package.

Use

agentroi                                   # the last 30 days
agentroi set claude=max-5x chatgpt=plus    # remember your plans
agentroi --plan claude=ultra               # what if, for this run only
agentroi --month last                      # the previous calendar month
agentroi --since 2026-11-01 --until 2026-12-01
agentroi --detail                          # every model, and the return on every other plan
agentroi --json                            # for scripts and dashboards
agentroi --lang ja                         # Japanese (the default follows $LANG)
agentroi agents                            # which agents were found, and where
agentroi plans                             # the plan catalog, with prices and sources
agentroi prices update                     # refresh API prices from LiteLLM

A plan is SUBSCRIPTION=PLAN (claude=pro, copilot=pro+) or SUBSCRIPTION=USD for anything the catalog does not have (qwen=12, or claude=150 for a discounted seat). set writes them to ~/.config/agentroi/config.json; --plan overrides it for one run. Without a plan, agentroi shows the API value and the return each plan would give.

Codex logs your ChatGPT plan, so it is picked up without set. ChatGPT Pro is logged as plain pro and taken to be the $100 tier; set chatgpt=pro-200 or pro-500 if you pay more.

What the number means

  • API value: tokens × the provider's pay-as-you-go price for that model, from a snapshot of LiteLLM's price table. Cache reads, 5-minute and 1-hour cache writes, long-context tiers (over 100k, 200k or 272k tokens, wherever the model's price sheet has one), Claude fast mode and the 1.1x US-only inference surcharge are priced separately. Local models (Ollama, LM Studio) count as $0.
  • Per month: the window's value × 30.44 ÷ days in the window. With the default 30 days, that is your current pace.
  • Return: API value per month ÷ fee per month. The headline adds up every subscription that has a fee.

It measures what the same usage would cost on the API, not how much work it got done. A high return means the subscription is cheaper than the API for the way you use it, not that the tokens were well spent.

How the plan bills changes what the return tells you:

Billing Subscriptions Read the return as
Quota Claude, ChatGPT (Codex), Google AI (Gemini CLI), Grok, Factory (Droid), opencode Go, Qwen the deal you are getting; several times over is normal for heavy use
Credits at API rates GitHub Copilot (since 2026-06-01) about 1x by design; value past the included credits is overage on your bill, not a bonus
Your own API key Cline, Roo Code, Kilo Code, Goose, Aider your actual spend; there is no fee to divide by

opencode is a router, so its usage goes where it was billed: to opencode Go through opencode's own providers, to Copilot through the Copilot provider, and to your own key otherwise. Cline requests sent through the Claude Code provider are left to Claude Code, so nothing is counted twice.

Next to a usage tracker

ccusage, tokscale, splitrail agentroi
Answers how many tokens, and what they would cost on the API whether each subscription is worth its fee
Plans and fees not modeled a dated catalog of 9 subscriptions with sources; Codex's plan detected from its logs
Billing model not distinguished quota, credits at API rates, and your own key are reported differently
Reports daily, monthly, per session, live dashboards, leaderboards one screen: the return, per subscription and per agent
Agents 20 to 30 13 (see below)

Use a tracker for the detail. agentroi answers the one question they leave to you.

Supported agents

Agent Where the data comes from Notes
Claude Code ~/.claude/projects/**/*.jsonl, ~/.config/claude, $CLAUDE_CONFIG_DIR Deduplicated by message id and request id across resumed sessions and subagents
Codex CLI $CODEX_HOME/sessions, archived_sessions Per-turn deltas; repeated token counts and history replayed into forks are skipped
Gemini CLI ~/.gemini/tmp/*/chats/session-*.json(l)
Qwen Code ~/.qwen/projects/*/chats/**/*.jsonl Archived chats counted once
GitHub Copilot CLI ~/.copilot/session-state/*/events.jsonl Per-call receipts when present, otherwise per-run totals
opencode ~/.local/share/opencode/opencode.db, older storage/message
Cline, Roo Code, Kilo Code tasks/*/ui_messages.json in the VS Code, Cursor, Windsurf, VSCodium and Kiro extension storage
Grok Build CLI (formerly Cursor) ~/.grok/sessions/**/updates.jsonl
Factory Droid ~/.factory/sessions/**/*.settings.json Session totals, dated at session start
Goose sessions.db Session totals, no cache split
Aider the --analytics-log file ($AIDER_ANALYTICS_LOG or ~/.aider/analytics.jsonl) The chat history file rounds to thousands, so it is not used

Not counted, because their usage is not on disk in a form that can be read: Cursor IDE, Windsurf and Devin Desktop, Devin in the cloud, Amp, Kiro, Antigravity, Warp, Augment, Zed and Jules. agentroi plans says why for each.

Privacy

  • agentroi only reads. It never changes an agent's files, and the only thing it writes is its own config (set) and price cache (prices update).
  • Nothing leaves your machine. The one network call is agentroi prices update, which downloads LiteLLM's public price table from GitHub. There is no telemetry.
  • The report shows token counts, model names and dollar amounts. Prompts, code and project names are never read into it.

Limits

  • Agents that log session or turn totals (Copilot without receipts, Droid, Goose, Grok Build) are priced at base rates: a total cannot tell which requests crossed a long-context tier, so their value is a floor.
  • A model the price table does not know is priced from the agent's own logged cost if it wrote one, and otherwise counts as $0 with a warning under the agent.
  • Fast mode on a model without a published fast price is priced at the standard rate and flagged as an underestimate.
  • Older Copilot CLI sessions without per-call receipts only write usage when the session ends, so a session that is still open, or was killed, is missing until then.
  • Plan prices come from each vendor's pricing page on the date in agentroi plans. Google AI's USD prices come from third-party pages, because Google's own page showed only local currency.

Prices and plans go stale

Both catalogs are dated. agentroi prices update stores a fresh LiteLLM snapshot in your user cache directory, and --prices FILE layers your own per-token prices on top, field by field. Plan prices live in internal/plans/plans.json with a source URL for each subscription; a pull request with a newer source is welcome.

Development

go test -race ./...
golangci-lint run
go run ./tools/genprices    # refresh the embedded price snapshot from LiteLLM
vhs demo/demo.tape          # re-record the demo from made-up logs

CI runs the tests on macOS and Linux and the linter on every push. Pushing a vX.Y.Z tag runs GoReleaser, which builds for macOS, Linux and Windows, signs the checksums with cosign, attaches SBOMs and updates the Homebrew cask in kanywst/homebrew-tap.

License

MIT

About

Are your AI coding-agent subscriptions paying off? Prices your local agent logs at API rates and divides by what you pay.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages