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.
▸_ pip install llm-spendguard
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.

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

Spin up a vast.ai box and the gate is enforced from boot — fail-closed, so a remote script cannot spend ungated; its spend still rolls up to the org.

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

Actual tokens recorded as they stream — batch, realtime and the Responses API, sync or async, OpenAI and Anthropic. 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

Learnings auto-applied on every call — max_tokens at your measured p99, reasoning effort, batch packing — tuned to how each model behaves for you.

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.

Install itself is pip install llm-spendguard + two lines, or auto-gate a whole venv. 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
fcc74b1 · production