Free
$0
- Per-run cap
- Terminal alerts
- Local only
Local spend cap for AI agents
AgentCap runs Gemini CLI, Codex / OpenAI-based agents and your own scripts
behind a local proxy on 127.0.0.1 and stops the run when the
next request would cross your USD budget.
No account. No server. Nothing leaves your machine except your own API calls (and, for Pro, a license check about once a week).
A looping agent or a long unattended run can burn money on API keys while you are not watching. Provider budget alerts are delayed and usually do not stop anything — by the time the email arrives, the spend has already happened.
agentcap run --cap 0.50 -- gemini
agentcap run --cap 0.50 -- codex
agentcap run --cap 0.50 -- python my_agent.py
AgentCap sets OPENAI_BASE_URL and
GOOGLE_GEMINI_BASE_URL so requests go through the local
proxy. Before each request it reserves the worst-case cost and lowers
the output limit to what is left.
At the cap it blocks the request and terminates the agent
(SIGTERM, then SIGKILL after 5 s). The run
exits with code 3 — or 4 for a detected loop in Pro.
pipx install agentcap
(PyPI release coming soon — until then: install from source)
Then put a cap on a run:
agentcap run --cap 0.50 -- gemini
$0
$19 one-time
Payments handled by Polar (merchant of record). Not a subscription.
No. Nothing about prompts, responses or keys is stored. Only token counts, costs, model names, timestamps and request hashes are recorded.
No. The cap is enforced before each request with a conservative reservation. If a provider bills more input tokens than estimated, final spend can exceed the cap by at most one request's estimation error, and you get an overshoot alert.
No. Only API-key traffic through OPENAI_BASE_URL /
GOOGLE_GEMINI_BASE_URL is metered.
OpenAI-compatible and Gemini APIs. Prices come from a local table you can override.
No, it is a one-time $19 purchase.
Contact kutaykarahan6@gmail.com.
No, it runs locally on your machine.