Where your AI spend went.

One day we'll pay AI for the work it does, not the words it spends. Segreant starts keeping that account today.

It runs on your computer and reads the usage logs your AI tools already keep, or sits between them and your provider. It shows what they cost, estimated from price lists or taken from your invoice, caps runaway spending on the requests it handles, and shows which spend went into work you kept.

No telemetry by default. Requests you route through Segreant still go to your AI provider. See what stays on your computer

On the reverse of the note: three jobs, done on your computer.

  1. 1Record

    Every request it sees is priced against a dated price list and written to a ledger on your computer.

    See a sample month
  2. 2Guard

    Caps refuse a request before it is forwarded, so a runaway loop stops before the bill arrives.

    How caps work
  3. 3Judge

    Spend is matched to the work you kept, judged 14 days after the commit, from git, tests and deploys.

    How it is judged

Every figure says what kind it is.

List cost, billed cost, allocated cost and value answer four different questions. Segreant keeps them apart and labels each one, so an estimate from a price list never passes for your invoice, and money spent never passes for work done.

Sample: $251.10 of $412.60 list cost (estimate) was spent on work you kept in September.

September 2026

Calendar month, your time zoneSample data
What it cost
Line 1List cost (estimate)$412.60
Why?

Tokens from 25,730 requests, priced at each provider's published list price as of 29 Sep. Discounts, credits and taxes are not included, which is why it is marked as an estimate.

Line 2Billed costNo invoice imported
Why?

Billed cost comes only from your provider's invoice, its cost export, or (for OpenAI) its read-only Costs API. Import one and Segreant sets it beside list cost, by project and day.

Line 3Allocated costNo cost split yet
Why?

Allocated cost divides spend between teams, projects or cost centres by rules you write. This sample has none.

What it went into
Line 4Kept$251.10
Why?

Spend on work that passed every check you track: at least 60% of the AI's suggestion accepted, committed, tests passed, merged, shipped, at least half of it still in the code, and no incidents. Work is judged 14 days after it is committed. A check you don't track is never counted as passed.

Line 5Not kept$98.40
Why?

Spend on work that failed a check: rewritten before commit, failing tests, never merged or shipped, or mostly gone from the code within 14 days.

Line 6Too early to tell (check back 14 Oct)$63.10
Why?

Spend on work committed in the last 14 days of the month. Each change is judged once it is 14 days old, so the last of it is judged on 14 Oct.

Total list cost$412.60
By model
ModelRequestsList cost (estimate)
claude-sonnet-5-55,410$188.20
gpt-6-sol3,380$121.45
claude-opus-5-51,020$74.30
gpt-6-luna15,920$28.65

Sample data, set out as a statement. The same figures come from segreant month and segreant roi in the terminal, and from the dashboard.

List cost (estimate)

What the tokens cost at each provider's published prices. Available from the first request.

Source: the price list

Billed cost

What your provider actually charged. Shown only once you import an invoice or cost export, or pull OpenAI's Costs API.

Source: your invoice

Allocated cost

Spend divided between teams, projects or cost centres by rules you write.

Source: your rules

Value (kept work)

The share of spend that went into work you kept. It counts outcomes, not money earned.

Source: git, tests and deploys

Count tokens, and people spend tokens.

AI coding agents bill by the token, and a stuck loop runs up the bill without a warning. When usage itself becomes the target, it gets worse: people chase the number.

In 2026, employees at Meta and Amazon built internal leaderboards ranking colleagues by AI tokens used. Amazon took its board, KiroRank, down after staff ran agents on low-value tasks to climb it and computing costs rose; a senior vice president asked staff not to use AI just for the sake of it. Meta's board was taken down in April.

A token count rewards spending more, not shipping more: a padded prompt scores the same as real work. Counting lines of code only rewards verbosity instead.

Latency and error dashboards can't see any of this. A request that costs $0.002 and a loop that costs $0.40 look the same to them. Segreant adds the cost, then shows what the cost went into.

Stop a runaway agent before the bill arrives.

For requests sent through Segreant, set a daily cap, a cap per agent session and a loop guard. A warning fires at the soft limit. At the hard limit Segreant refuses the request with a clear error instead of forwarding it.

Agent session · claude-sonnet-5-5Simulation
$ segreant budget --daily 25 --soft 18 --runaway 2

Caps cover requests sent through Segreant. They apply only when traffic is explicitly routed through Segreant. Usage imported from your tools' logs has already happened, so it can't be stopped and doesn't count toward a cap.

Caps are off until you set one. A fresh install measures but never blocks.

If Segreant can't read its settings or its ledger, it stops forwarding. A damaged configuration never turns into unlimited, unmeasured spending.

Each non-streaming response carries its cost in an X-Segreant-Cost-USD header. Streaming responses carry the remaining budget instead, because the cost isn't known until the stream ends; the final cost is recorded then.

--daily 25
Refuse requests once today's spend through Segreant reaches $25.
--soft 18
Warn at $18.
--runaway 2
Stop a loop that spends $2 within 60 seconds.
--session N
Cap a single agent session.

Two ways in. Neither needs an account.

1Read the logs you already have

If you use Claude Code, Codex or opencode, Segreant reads the usage they already log on your computer, including subscription usage that a proxy never sees. Nothing needs rewiring.

# find your AI tools and repos; changes nothing
$ segreant scan
# import that usage, grouped by project
$ segreant scan --setup
# today's cost by model, project and tool
$ segreant today

2Route requests through Segreant

Point a tool at the local proxy to measure it as it runs and enforce caps. There's no certificate to install, and it sees only traffic you send to it. Requests to OpenAI's and Anthropic's official APIs go straight through; another provider or gateway stays blocked until you add the one rule a refused request prints.

# proxy on :8090, dashboard on :8091
$ segreant start
# run one tool through it (or codex, opencode, aider)
$ segreant launch -- claude

Point segreant audit --repo at a repository and each commit gets the spend logged since the one before it, with the cost per 100 changed lines. Those two figures are all it reports: no invented efficiency score to chase.

Each routed call is priced against a dated price list and written to a ledger on your computer. Ordinary metering doesn't store prompt text in that ledger. The optional capture of the AI's suggestions, used to measure how much of them you accepted, stays on your computer and can be switched off.

A record you can hand to someone else.

For each piece of kept work, Segreant can issue a receipt: what it cost, the result of each check, and the outcome, signed with your ed25519 key. Anyone with your public key can confirm who issued it and that no byte has changed, without seeing your code.

The signature proves where the record came from, not that the checks inside were right. Those rest on the tests, deploys and history that produced them.

The arithmetic is published. Check it.

Every figure comes with the way it was worked out, and with what it can't tell you. A calculation on your computer is never presented as your provider's bill, or as proof that AI made you more productive.

Value score
Combines four measures so that one strong result can't hide a weak one. A measure you don't track stays open and is shown as missing; it is never scored as a pass.
95% range
The share of spend that went into kept work comes with a range that stays valid however often you check it. The cost is a wider range, about 1.5 to 2 times an ordinary interval.
Change alert
Fires when your kept-work rate shifts. It can't say why: a new model and a gamed number both set it off, and telling them apart takes evidence the rate doesn't carry.
Savings
Segreant doesn't promise a percentage. What you save depends on how much waste there was to find; its job is to show you where it is.

Built so developers want it switched on.

When two goals conflict, the higher one wins. This order is part of the design, not a promise added later.

  1. Security and privacy
  2. Speed of each request
  3. Enforcing budgets
  4. Interface and overrides

A cost tool that developers route around measures nothing. Personal views belong to the person. Team views are opt-in, show totals and spreads rather than individuals, and hide any group smaller than five people.

Team sync, when you turn it on, sends numbers only: no prompts, no code.

It reads your logs and controls live traffic, on your computer.

Where it runs
Measurement, ledger and dashboard all run on your computer. Built on Node's own SQLite, with no runtime dependencies.
Stops spending
Daily, session and loop caps on the requests it handles.
Links cost to commits
Yes, from your local git history.
Telemetry
None by default: 0 bytes of Segreant telemetry or product analytics. No Segreant-hosted telemetry by default.
What it measures live
Streaming and non-streaming responses from supported providers, when traffic is explicitly routed through Segreant.
Accounts
None needed to run it. Your provider keys stay under your control.

See it on sample data first.

The demo runs on labelled sample data in its own database, so it never touches your real usage. No API key, no account. You need Node 24 or later.

One command fetches it from npm and opens the dashboard at http://localhost:8091. When you move to real work, segreant guide reads your setup and names the next step.

# sample data, opens the dashboard
$ npx segreant demo --serve
# for real work: install the command
$ npm install -g segreant
Set it up for real work

Or ask your coding agent

Paste this into Claude Code, Codex or another agent. It shows you each step before it runs it.

Install Segreant for me with npm (npm install -g segreant), then run `segreant guide` and follow what it says. Show me each command before you run it.