open source · your keys · never resold
Save hundreds,
even thousands —
for cents.
The agentic spend governor for LLMs and remote compute. It estimates before you spend, caps runaway jobs, and learns from every call — so your whole team's spend is guarded by what the network already knows.
▸_ uvx --from llm-spendguard spendguard scan
10 seconds · no key, no config · nothing leaves your machine
caps · this monthlive
LLM$1,840 / $2,000
Remote compute$340 / $800
Total ceiling$2,180 / $2,800
guarded ~$58caught $632 waste

no effort. huge gain.

A minute to install. It pays you back every day after.

Save money

Caps stop overruns, waste gets caught, cheaper routing is proven — hundreds to thousands, automatically.

Always learning

Every call feeds a cost + quality corpus. It gets sharper with each batch — your own playbook, growing.

Always delivering insights

Not just what you spent — what’s worth spending: $/good-result, what to downgrade, surfaced continuously.

the agentic loop — it runs with your agents, not after them

EstimateCapReconcileLearn Advise the agent

what it does

Govern every dollar — before it's spent.

Estimate-first gate

A zero-spend projection runs before every batch; the call is hard-capped before a token is spent. Observability tools tell you what you already spent — this runs before the tokens are billed.

Reconciled to your actual bill — with a published error rate

Your ledger is diffed against the provider’s own billing, estimates are trued down to billed actuals, and the gap is NAMED as ungoverned spend instead of quietly absorbed. Batch reconciles exact; realtime measured at +4.4%. We publish the method and what we do not capture — nobody else in this category publishes a number at all.

Never guesses a price

An unknown model fails loud instead of logging $0. Elsewhere a $0 price can also silently exempt the call from your budget — an unknown model becomes an uncapped one.

Estimates that learn

Naive tokens×price misses in predictable ways — models rarely fill max_tokens, batch ≠ realtime. Calibration learned from your own captured history cuts the error, and the whole org shares it: statistics up, a better prior down, your local data always on top.

LLM, compute & total caps

Daily and monthly ceilings per resource class, plus one total backstop. Breach any → blocked or alerted.

Provider-truth reconcile

Every row matched to OpenAI, Anthropic and vast.ai billing — by a per-row id, fully auditable.

Guarded as a distribution

What caching, caps and cascades save — mean, p10–p90 and a conservative floor, not a vanity number.

Roll up who & what

Per user → team → org, LLM + GPU, one ledger — spend attributed to the work that caused it.

Spend visible inline

A receipt after every run — tokens, estimate → actual, and a running daily / weekly / monthly tally scoped to the repo — right in Claude Code, Codex, or your terminal.

Gate remote compute too

GPU clouds through one port — vast.ai enforced from boot (fail-closed), RunPod, Modal and Lambda reconciled from their own billing. Unpriced or untimed rows stay visibly unknown, never $0-clean.

Alerts when it happens

Thresholds are checked the moment spend data arrives — crossing 80% of your monthly cap fires the flare that instant, once, not on tomorrow’s schedule. No cron lag between the event and the email.

Forecast & unit economics

The open month projects itself — “month-end ~$X (p50) … $Y (p90)” from your own daily run-rate — and the dashboard prices the output: billed $ per shipped work-unit, per project.

Meta work on your plan

The governor’s own thinking (insight synthesis, judging) can run on your flat-fee Claude plan instead of metered API — $0 billed, value counted on its own axis, automatic fallback if the plan is busy.

Agent-native

Agents check the budget and the org’s cost learnings before they spend — through the team dashboard’s scope-bound remote MCP, or the client’s CLI on your machine. Governance they can reason with.

Captured at the source

Every channel recorded as it happens — chat, Responses, batch, streaming, embeddings, images, audio, TTS, per-call tool fees, even raw HTTP that skips the SDK. OpenAI, Anthropic, Gemini. Live truth, not a guess after the fact.

Nothing ungated

A coverage audit flags any environment with an LLM SDK but no gate — so a stray venv or script can never spend silently. Reconcile catches the rest against provider bills.

Two honest axes

Real billed dollars — API + subscription + remote compute — kept separate from subscription value (Claude Code, claude.ai). Never one misleading total.

Audit-grade ledger

Immutable spend events in integer micros, hash-chained — every number traces back to the exact call, lifecycle and version that produced it.

smart attribution

Every dollar, tagged to the work that caused it.

Smart tagging reads your conversations and code to attribute each call to the right project and intent — no manual bookkeeping. Then it rolls up across who and what.

WHO · ROLLS UP
Org
↳ Team
↳ Contributor
WHAT · AUTO-TAGGED
Project (repo / workstream)
Intent (classify, extract, …)
Resource (LLM / GPU)

A clean P&L by team, by project, by intent — orthogonal dimensions, no double-counting, zero manual tagging. Across any period: day, week, month, quarter, year or YTD.

learn & optimize — the part that pays for itself

It doesn't just measure spend. It makes it cheaper.

Every call feeds a private cost + quality corpus, and an advisor turns it into proven savings — never a blind downgrade. All caged: estimate-first, on your own key, recorded so you never re-pay.

Cost + quality corpus

Real prompts and outputs sampled and judged good-vs-wasteful — your own playbook of what works, sharper every batch.

Prove-then-switch A/B lab

Runs a cheaper config beside your current one and only recommends the change when the output holds. No guessing, no quality regressions.

Cost-aware cascade

Route cheap-model-first → verify → escalate only when the cheap answer fails. Same results for a fraction of the spend.

Stop re-paying

A semantic response cache and batch dedup catch repeated work before it bills; a cache audit shows exactly what prompt-caching would save.

Per-model profiles

Measured bounds surface on every call — your max_tokens vs the observed p99 — and opt-in autotune applies them: shrink-only, truncation-safe, logged, one flag to turn off.

Backtest + community

Backtest a recommendation against your own history before you trust it, and import scrubbed cost lessons from the community (or export yours).

depth, not a dashboard — what it actually catches

$632

cancelled-but-billed jobs that dashboards never show as loss

leaks

provider-billed spend an ungated venv or script ran silently

26×

under-batched calls a cheaper model + packing would have done

install in a minute — configure with zero LLM calls

Install the client, then set caps with spendguard init. It's deterministic — no API key, no model call (you don't need an LLM to configure the thing that governs LLMs). Two ways to answer:

1. spendguard init — a few quick prompts (or your AI assistant in Claude Code / Cursor runs it for you). Deterministic.
2. spendguard init --chat — describe budgets in plain English; one tiny call on your own key, caged under caps.meta — never our server.

Try it with no install at all: uvx --from llm-spendguard spendguard scan. Then pip install llm-spendguard and gate a job with spendguard run -- python job.py — that puts the gate on that one command; nothing is written into your interpreter and nothing persists. Auto-gating a whole venv is still supported, as an explicit opt-in. Projects auto-tag from your git repos (deterministic).

$ spendguard init
monthly LLM cap? ▸ $2,000
remote-compute cap? ▸ $800
→ caps.llm / compute / total set
→ projects auto-tagged from your git repos
gate enforcing ✓ doctor: green (no LLM)
$ spendguard init --chat # conversational
you: $2k for LLMs and $800 for GPUs
→ parsed on your key · caged caps.meta (~$0.001)
→ caps set

extend

Works with what you use — extends to anything.

Tracks your coding agents — Claude Code and Codex — plus claude.ai, and the OpenAI and Anthropic APIs (batch, realtime, and the Responses API). Register any other SDK with one call, and emit every event to your webhook, OpenTelemetry, or a callback. Zero required dependencies — it never blocks your code.

spendguard.register(your_sdk)

for teams — the hosted dashboard (llmspendguard.com)

The client governs each machine. The dashboard rolls it up — and your agents can query it.

Point the OSS client at the dashboard and every gated machine's spend rolls into one team P&L — by org, team, project and contributor. Your keys and tokens never touch our servers; we ingest only scrubbed roll-ups and abstracts.

Remote MCP for your agents

Mint a scope-bound key and your team’s Claude queries the aggregate — spend, coverage, efficiency and the team’s cost learnings — read-only, via the Claude API mcp_servers param or any MCP client. Governance agents consult before they spend.

One hosted roll-up

Org → team → project → contributor, LLM + remote compute, any period (day → YTD). The website, the MCP and the CLI all read one data layer, so the numbers can never diverge.

Pooled learnings + semantic search

The team’s cost lessons in one searchable corpus — hybrid vector + keyword — so a fix one engineer found is one query away for everyone. Opt into community learnings across orgs.

Scoped keys + device-link

Per org / team / user keys with ingest · read · mcp caps — mint, rotate, revoke. Device-link binds a verified contributor, so seats derive from real usage, not a headcount guess.

Alerts, drill-down & export

Coverage-low and spend-spike emails to admins; per-user and per-project drill-down; one-click CSV export. The dashboard tells you when something drifts.

Your data, tenant-isolated

Scrubbed roll-ups and abstracts only — never prompts or tokens. Row-level tenant isolation; export or purge the whole org anytime. Open source, audit it yourself.

pricing

Free for the client, forever. Pay only to roll up a team.

Open-source gate: free. Team dashboard: free up to 2 seats, then $1/seat/mo ($5 floor). Your keys, your tokens — always.

Start free View on GitHub
Your keys. Your data. Open source.
We never proxy or resell your tokens — audit the gate yourself.
Start free Star on GitHub
66f1e61 · production