The bill tells you what you spent. It rarely tells you which agent session, project, or model got you there.
That gets messy fast when several coding agents are working across several repositories. A productive day and a runaway context window can look identical until the invoice arrives.
v1.4.0 makes that spend legible from usage records already on your machine:
agentjail cost
The new report groups estimated cost by project and model, counts sessions, breaks down input and output tokens, and shows token efficiency. The same report now has a Cost tab in the local dashboard.
TL;DR
- One local report reads three usage sources. Local records from Claude Code, Codex, and OpenCode are normalized into the same project and model breakdown. Cursor remains supported for sandboxing and policy enforcement, but it is not a cost-report source in v1.4.0.
- You can see where the tokens went. The report includes session counts, input and output tokens, cache hit rate, average cost, and average tokens per session.
- Budget alerts catch drift early. Set a global daily amount, per-project amounts, and the percentage that should trigger a warning.
- The analysis stays local. AgentJail reads local usage sources and keeps typed aggregates for the report. It does not upload the records it reads. Model matching and pricing run locally through the bundled Gryph library.
- Linux updates now prove the new daemon started. If restart or version attestation fails, AgentJail restores the previous installation.
- Doctor is easier to scan. The report calls out CLI and daemon version skew and tells you how to repair it.
Find where the spend went
The default report covers the last seven days. Here is a real local report with 44 sessions and a $1,975.74 API list-price estimate. The project breakdown is omitted here because it contains local repository names.
| Model | Spend | Share | Output tokens |
|---|---|---|---|
claude-opus-4-8 | $1,389.10 | 70% | 8.0M |
gpt-5.6-sol | $586.63 | 30% | 2.8M |
| Token efficiency | Value |
|---|---|
| Cache hit rate | 99% |
| Average API estimate per session | $44.90 |
| Average usage per session | 611.3K input, 244.5K output |
This is an API list-price equivalent. Subscription plans are not billed this way. Some GPT-5.6 sessions did not contain complete per-request usage, so this sample uses base rates where the long-context tier could not be reconstructed.
Change the window, narrow it to one project, or hand the typed output to a script:
agentjail cost --period 1d
agentjail cost --period 30d --project ~/work/api
agentjail cost --period 7d --json
These numbers are estimates. AgentJail uses the cost recorded by OpenCode when one is available. For token-only sources, it calculates the estimate offline with the Gryph library bundled into AgentJail. Provider invoices remain the source of truth, especially when a model identifier is unknown or pricing has changed since the installed AgentJail release.
The dashboard gets the same view
Run agentjail ui and open the Cost tab. It uses the same typed report as the
CLI, so the totals do not change when you switch views.
The page shows:
- total estimated spend and unique sessions for 1, 7, or 30 days
- spend by project and model
- input and output token counts
- cache hit rate and average cost per session
- active budget warnings and exceeded amounts
The dashboard is still loopback-only. The cost view does not turn local usage records into a hosted analytics feed.
Budget alerts, without surprise enforcement
Add reporting thresholds to ~/.agentjail/policy.yaml:
cost:
daily_budget: 25
alert_threshold: 0.8
project_budgets:
"~/work/production-api": 10
At 80 percent, the report warns. At 100 percent, it marks the budget exceeded. The global amount and project amounts are checked against today’s local usage.
These are alerts, not hard spending limits. They do not terminate a session, block a model request, or change OPA policy. We would rather label that boundary clearly than imply a report can stop a provider charge.
What the readers keep
Each supported agent writes usage information in a different local format. AgentJail reads those sources through bounded, read-only adapters and normalizes only the fields the report needs:
- session identity
- project and model attribution
- token totals
- recorded or computed cost
- session start time
Conversation content is not retained in the cost report, and the cost-analysis path does not upload the usage records it reads. Gryph supplies the model matching and price catalog bundled into the AgentJail binary, so the calculation works offline.
If one optional source is missing, the other sources still work. A malformed or bounded-out source produces a warning and leaves enforcement alone.
Updates that can prove they worked
v1.4.0 also tightens the Linux manual update path. Swapping a binary is not a successful update if the supervised daemon is still running the old code.
The updater now restarts the daemon, asks it for its version, and commits the new installation only after the response matches. If restart or attestation fails, it restores the exact prior binary and role paths, restarts that version, and reports the rollback.
agentjail doctor now makes the same state easier to read. Its structured
terminal report highlights version skew between the CLI and daemon instead of
hiding it in a wall of checks, and agentjail doctor --fix can repair a stale
process.
Thanks
Thanks to the Gryph maintainers. Their model matching and pricing package let us ship local cost estimates much faster than building and maintaining that catalog from scratch.
Upgrade
Upgrade through the same channel you installed from:
brew upgrade agentjail
# or
agentjail update
Then run:
agentjail cost --period 7d
agentjail doctor
One shows where the agent budget went. The other confirms the version doing the guarding.