agentroi

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

agentroi

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 list rate, and divides by what you pay each month.

agentroi demo

(Synthetic data from tools/demodata; recorded with VHS from demo/demo.tape. Run agentroi --lang ja for Japanese.)

Everything runs locally. Nothing is uploaded; the only network call is the optional agentroi prices update.

Install

brew install --cask kanywst/tap/agentroi

Or with Go:

go install github.com/kanywst/agentroi@latest

Prebuilt binaries for macOS, Linux and Windows are on the releases page; checksums.txt is signed with cosign (keyless).

SQLite-backed agents (opencode, Goose) need the sqlite3 CLI, which macOS ships and most Linux distributions package.

Usage

agentroi                                   # last 30 days
agentroi set claude=max-5x chatgpt=plus    # remember your plans (~/.config/agentroi/config.json)
agentroi --plan claude=ultra               # what-if for this run only
agentroi --month last                      # 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 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 not in the catalog (qwen=12, claude=150 for a discounted seat). Without a plan, agentroi shows the API value and the return you would get on each plan. Codex logs the ChatGPT plan, so it is detected automatically; ChatGPT Pro is logged as plain pro, which is assumed to be the $100 tier (set it if you are on $200 or $500).

How the number is computed

  • API value: tokens × the provider's pay-as-you-go list price for that model, from a trimmed snapshot of LiteLLM's price table. Cache reads, 5-minute and 1-hour cache writes, long-context tiers (Gemini >200k, GPT >272k, Haiku 5.5 >100k), Claude fast mode and the US-only 1.1x inference surcharge are priced separately. Long-context tiers apply only to per-request records; agents that log session or turn totals (Copilot shutdowns, Droid, Goose, Grok Build) are priced at base rates, and fast mode on a model without a published fast price is flagged as an underestimate. Local models (Ollama, LM Studio) count as $0. When a model has no price, the agent's own logged cost is used if it wrote one; otherwise the tokens count as $0 and the report flags them.
  • Per month: the window's value × 30.44 / window days. The default 30-day window is your current pace.
  • Return: monthly API value ÷ monthly fee. The headline adds up every subscription with a fee.

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

Billing models matter:

  • Quota plans (Claude, ChatGPT/Codex, Google AI, Grok Build, Factory, opencode Go): the return is the interesting number. Several times over is normal for heavy use.
  • Credit plans billed at API rates (GitHub Copilot since 2026-06, Warp, Augment, Zed, Amp): you get roughly what you pay for by design, so value past the included credits is overage on your bill, not a bonus.
  • Bring your own key (Cline, Roo Code, Kilo Code, Goose, Aider): the API value is your actual spend; there is no subscription to compare against.
  • Routers: opencode usage counts toward opencode Go only through opencode's own providers, toward Copilot through the Copilot provider, and as your own spend otherwise. Cline requests that run through the Claude Code provider are left to Claude Code, so they are not counted twice.

Supported agents

Agent Where the data comes from Notes
Claude Code ~/.claude/projects/**/*.jsonl, ~/.config/claude, $CLAUDE_CONFIG_DIR Deduplicated by message id + request id across resumed sessions and subagents
Codex CLI $CODEX_HOME/sessions, archived_sessions Per-turn deltas; re-emitted token counts skipped; plan auto-detected
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 shutdown totals
opencode ~/.local/share/opencode/opencode.db, legacy storage/message Rows proxied through Claude Code are skipped
Cline / Roo Code / Kilo Code VS Code, Cursor, Windsurf, VSCodium, Kiro globalStorage tasks/*/ui_messages.json
Grok Build CLI (ex-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 --analytics-log file ($AIDER_ANALYTICS_LOG or ~/.aider/analytics.jsonl) The chat history file is rounded, so it is not used

Not counted, because the usage is not on disk in a usable form: Cursor IDE, Windsurf / Devin Desktop, Devin (cloud), Amp, Kiro, Antigravity, Warp, Augment, Zed and Jules. agentroi plans lists why for each.

Prices and plans go stale

Both catalogs are dated. agentroi prices update caches a fresh LiteLLM snapshot in your user cache directory; --prices FILE layers your own per-token prices on top. Plan prices live in internal/plans/plans.json with a source URL for each subscription; corrections are welcome.

To refresh the embedded price snapshot before a release:

go run ./tools/genprices

ccusage, tokscale and splitrail report token usage and API cost across many agents in much more depth. agentroi focuses on one question those leave open: against what you actually pay, is each subscription worth it.

License

MIT

Documentation

Overview

Command agentroi estimates whether your AI coding-agent subscriptions pay for themselves: it reads the agents' local logs, prices the tokens at pay-as-you-go API rates, and divides by what you pay each month.

Directories

Path Synopsis
internal
collect
Package collect reads the local session logs that coding agents leave on disk and turns them into normalized per-request token usage.
Package collect reads the local session logs that coding agents leave on disk and turns them into normalized per-request token usage.
plans
Package plans holds the subscription catalog (which plan costs what, and which agents it covers) and resolves the user's own plans.
Package plans holds the subscription catalog (which plan costs what, and which agents it covers) and resolves the user's own plans.
pricing
Package pricing prices token usage at pay-as-you-go API list rates, from a trimmed snapshot of LiteLLM's price table (embedded) plus local overrides.
Package pricing prices token usage at pay-as-you-go API list rates, from a trimmed snapshot of LiteLLM's price table (embedded) plus local overrides.
report
Package report aggregates priced usage into per-agent and per-subscription value and renders it.
Package report aggregates priced usage into per-agent and per-subscription value and renders it.
tools
demodata command
Command demodata writes synthetic agent logs under a fake home directory, for the README demo (demo/demo.tape).
Command demodata writes synthetic agent logs under a fake home directory, for the README demo (demo/demo.tape).
genprices command
Command genprices refreshes the embedded price snapshot (internal/pricing/prices.json) from LiteLLM.
Command genprices refreshes the embedded price snapshot (internal/pricing/prices.json) from LiteLLM.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL