Stop runaway AI bills before they happen.
Governor sits between your apps or AI agents and the model providers. Every call is checked against your budgets and rules before it goes out, billed from the provider's real usage when it comes back, and written to a signed audit log.
What it's for
AI agents call paid APIs on their own, often thousands of times a day. Provider dashboards tell you what you spent after the fact. Governor decides before each call whether it may spend at all.
Runaway loops
An agent stuck retrying the same request can burn a month's budget overnight. Governor spots the repeat and blocks it, and can switch that agent's key off.
Surprise bills
Daily and monthly caps per agent and for the whole account. A call that could cross a cap is refused before it is sent.
Expensive one-offs
Big jobs above a threshold wait for a person to approve that exact request. Approve or deny in one click.
Emergencies
One kill switch stops every AI call at once, from the console or the command line.
Leaked keys
Apps get Governor keys, not your real provider key. A leaked Governor key is capped, and you can disable it without rotating anything upstream.
Proof of what happened
Every decision and every charge goes into a tamper-evident, signed log you can verify at any time.
How it works
Your code keeps using the normal Anthropic or OpenAI SDK. You change two settings: the address it calls, and the key it uses.
Your app or agent
Uses a Governor key (gk_...) instead of the provider key.
Governor
Checks caps, approvals, loops and the kill switch. Reserves the worst-case cost, then bills the real cost.
Claude or OpenAI
Receives the call with your real key, which never leaves the Governor host.
Before a call, Governor works out the most it could cost: the prompt plus every output token the call is allowed to produce. If that could break a rule, the call is refused and nothing is sent. If it passes, that amount is set aside so several calls at once cannot jointly overshoot a cap. When the answer comes back, the set-aside amount is replaced with the exact cost from the provider's usage numbers.
Get started
Governor runs on your own machine or server. It needs Node.js 18 or newer and nothing else.
- Try the demo first (no API key, no cost)It runs a scripted scenario against a fake provider: a budget cap, an approval, a runaway loop and the kill switch.
npm run demo - Start Governor with your provider keySet the key in your terminal so it is never written to a file, then start the server.
$env:ANTHROPIC_API_KEY = Read-Host "Anthropic key" -MaskInput npm start - Create a key for each app or agent, with its limitsThe
gk_...key is shown once. Governor keeps only a hash of it.node bin/governor.js create-key --name support-agent --daily 5 --monthly 50 --approve-above 0.50 - Point your code at Governor
# Anthropic SDK client = anthropic.Anthropic(base_url="http://127.0.0.1:8787", api_key="gk_...") # OpenAI SDK client = OpenAI(base_url="http://127.0.0.1:8787/v1", api_key="gk_...") - Watch and steer from the consoleOpen the console and paste the admin token from
data/admin-token.txt. You will see spend against each cap, approvals waiting, alerts, and the audit trail.
Controls
Set defaults for every key, then override per key. All limits are in US dollars.
| Control | What happens | Response the app sees |
|---|---|---|
| Daily and monthly caps | A call that could cross the cap is refused | 402 budget_exceeded |
| Account-wide caps | Same, across every key combined | 402 org_budget_exceeded |
| Per-request cap | Refuses any single call that could cost too much | 402 request_too_expensive |
| Approval threshold | Holds the call until an admin approves that exact request | 403 approval_required |
| Kill switch | Stops every call immediately | 403 kill_switch |
| Loop breaker | Blocks the same request repeated too often; can disable the key | 403 loop_detected |
| Spend per minute | Caps how fast a key can spend | 429 spend_velocity |
| Requests per minute | Rate limit per key | 429 rate_limited |
| Model allow-list | Only the models you name | 403 model_not_allowed |
| Unknown models | Refused; Governor never guesses a price | 403 unknown_price |
| Alerts | Slack or Discord webhook at 50%, 80% and 100% of each cap, on kill and on approval requests | none |
Tested against the real API
On 11 October 2026 Governor ran against the live Anthropic API with Claude Opus 5.5. A call of 25 input and 36 output tokens was billed $0.00082, which matches the $4 / $20 per million list price exactly. A streaming call was billed from the provider's final usage numbers. An oversized call was refused before reaching Anthropic, the kill switch blocked a call, and the audit log verified intact.
On 12 October 2026 the fingerprint of a 28-record demo audit log was published on Bitcoin BSV for a 26-satoshi fee. Anyone can recompute it from the log and compare: view the transaction.
Merkle root 786e045f363f9ddbf8433d7267cd62f2bd1b718d1578b99e42eeaffeb25687ed
FAQ
Does Governor read or store my prompts?
No. Prompts and answers pass straight through. The audit log stores who called, which model, what it cost and a one-way hash of the request, never the text itself.
Which providers and models does it support?
Anthropic (Claude, through the Messages API) and OpenAI (Chat Completions). Current Claude models and two OpenAI models are priced out of the box. You can add any other model and its price in the config file. Models without a price are refused.
What does my app see when a call is blocked?
A normal API error from the SDK, with a plain-English message such as "Daily budget of $5.00 reached". The x-governor-decision header names the rule that fired, so your code can react to it.
How accurate is the cost?
Each charge is computed from the token counts the provider returns, using list prices, including prompt caching. Before the call Governor uses a deliberately high estimate, so it errs toward blocking, never toward overspending. If a streaming call is cut off before the final usage arrives, the high estimate is billed. Check the built-in prices against your provider's pricing page; you can override any of them.
Does it slow my calls down?
The checks run in memory before the call is forwarded, so the added time is very small next to the model's own response time. Streaming responses are passed through as they arrive.
What happens if Governor is down?
Calls through it fail; nothing slips past it uncontrolled. That is deliberate. If you need a bypass for an outage, give that app the provider key directly for the duration.
Where is my real provider key kept?
Only on the machine running Governor, as an environment variable. Apps never see it. Callers can also bring their own provider key per request if you allow it; Governor forwards it and never stores or logs it.
How does an approval work?
When a call is held, the response includes an approval ID. An admin approves it in the console. The app resends the identical request with the header x-governor-approval. An approval works once, for that exact request, within 24 hours.
How do I know the audit log hasn't been altered?
Each record carries the fingerprint of the one before it and is signed with a key that only your Governor instance holds. Editing, deleting or reordering any record breaks the check. Click "Verify chain" in the console or run node bin/governor.js verify.
Do I need crypto or a Bitcoin BSV wallet?
No. Payment to the AI provider stays exactly as it is today. Anchoring is an optional extra: you can publish each day's audit fingerprint on Bitcoin BSV, so anyone can later confirm the log existed in that exact form on that date.
Where does it run, and can I host it?
Today it runs as one process on your own machine or server and keeps its state in a local file. Run it on localhost, or put it behind HTTPS if other machines need to reach it.
How much does it cost?
Governor is in early access. Email embryospace@gmail.com to try it with your team.