agentcap-cli 0.1.0__tar.gz → 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/PKG-INFO +142 -75
- agentcap_cli-0.1.1/README.md +341 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/pyproject.toml +1 -1
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/src/agentcap/__init__.py +1 -1
- agentcap_cli-0.1.1/src/agentcap/adapters.py +281 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/src/agentcap/clamp.py +81 -10
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/src/agentcap/cli.py +19 -0
- agentcap_cli-0.1.1/src/agentcap/demo.py +155 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/src/agentcap/devtools/fake_upstream.py +43 -8
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/src/agentcap/estimate.py +211 -19
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/src/agentcap/license.py +86 -33
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/src/agentcap/proxy.py +122 -17
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/src/agentcap/runner.py +79 -4
- agentcap_cli-0.1.1/tests/test_adapters.py +251 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/tests/test_clamp.py +57 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/tests/test_cli.py +21 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/tests/test_estimate.py +201 -6
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/tests/test_license.py +48 -15
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/tests/test_proxy_core.py +19 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/tests/test_proxy_extras.py +87 -1
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/tests/test_proxy_streaming.py +46 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/tests/test_runner.py +108 -1
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/tests/test_upstreams.py +16 -0
- agentcap_cli-0.1.0/README.md +0 -274
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/.gitignore +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/LICENSE +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/landing/README.md +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/src/agentcap/alerts.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/src/agentcap/data/pricing.json +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/src/agentcap/devtools/__init__.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/src/agentcap/ledger.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/src/agentcap/loop.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/src/agentcap/pricing.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/src/agentcap/upstreams.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/src/agentcap/usage.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/tests/license_support.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/tests/proxy_support.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/tests/test_alerts.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/tests/test_ledger.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/tests/test_loop.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/tests/test_pricing.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.1}/tests/test_usage.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: agentcap-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: API-key spend guard for unattended Codex CLI and Gemini CLI runs: hard per-run cap, kills the process at the limit.
|
|
5
5
|
Project-URL: Homepage, https://agentcap.launchbench.studio
|
|
6
6
|
Project-URL: Repository, https://github.com/Blitz00X/agentcap
|
|
@@ -31,15 +31,15 @@ Description-Content-Type: text/markdown
|
|
|
31
31
|
# AgentCap
|
|
32
32
|
|
|
33
33
|
**The API-key guard for unattended Codex CLI and Gemini CLI runs.** AgentCap runs
|
|
34
|
-
the CLI behind a local proxy on `127.0.0.1
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
the CLI behind a local proxy on `127.0.0.1` and applies a local spend cap to the
|
|
35
|
+
run. Before each request it reserves the worst-case cost; when the budget is gone
|
|
36
|
+
it kills the local process and tells you why. No dashboard, no account, no code
|
|
37
|
+
changes for tools that honour a base-URL environment variable.
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
(OAuth/subscription) traffic is not metered.
|
|
39
|
+
Codex CLI and Gemini CLI are routed automatically. AgentCap meters API-key
|
|
40
|
+
traffic — `POST /v1/responses` and `/v1/chat/completions` (Codex CLI uses the
|
|
41
|
+
Responses API) plus Gemini `generateContent` / `streamGenerateContent`. ChatGPT
|
|
42
|
+
or Google sign-in (OAuth/subscription) traffic is not metered.
|
|
43
43
|
|
|
44
44
|
## What it is
|
|
45
45
|
|
|
@@ -53,7 +53,10 @@ agentcap run --cap 2 -- codex exec "fix the failing tests"
|
|
|
53
53
|
Everything the child sends to OpenAI or Gemini is routed through a proxy on
|
|
54
54
|
`127.0.0.1`. AgentCap reserves the worst-case cost of each request before it is
|
|
55
55
|
forwarded, settles the real usage afterwards, and terminates the agent's process
|
|
56
|
-
group if the cap would be exceeded.
|
|
56
|
+
group if the cap would be exceeded. This is a local spend cap, not a
|
|
57
|
+
mathematical guarantee: with conservative reservation it reserves worst-case
|
|
58
|
+
cost before each request, so overshoot is rare but possible when providers count
|
|
59
|
+
more tokens than estimated.
|
|
57
60
|
|
|
58
61
|
## Install
|
|
59
62
|
|
|
@@ -87,12 +90,18 @@ agentcap run --cap 2 -- codex exec "fix the failing tests"
|
|
|
87
90
|
# Gemini CLI under a $2 cap (API-key mode: uses GEMINI_API_KEY)
|
|
88
91
|
agentcap run --cap 2 -- gemini -p "refactor utils.py"
|
|
89
92
|
|
|
93
|
+
# Gemini CLI in a folder you have not trusted yet
|
|
94
|
+
agentcap run --cap 2 --trust-workspace -- gemini -p "refactor utils.py"
|
|
95
|
+
|
|
90
96
|
# Run your own Python agent (it must honour OPENAI_BASE_URL)
|
|
91
97
|
agentcap run --cap 1 -- python my_agent.py
|
|
92
98
|
|
|
93
99
|
# Keep a proxy open for several terminals
|
|
94
100
|
agentcap serve --port 8787 --cap 5
|
|
95
101
|
|
|
102
|
+
# Simulated, fully local demo (fake API, no key, no money)
|
|
103
|
+
agentcap demo
|
|
104
|
+
|
|
96
105
|
# Inspect spend
|
|
97
106
|
agentcap status --port 8787
|
|
98
107
|
agentcap status --db
|
|
@@ -106,39 +115,75 @@ Uses your API key (`OPENAI_API_KEY` / `GEMINI_API_KEY`). ChatGPT or Google
|
|
|
106
115
|
sign-in (OAuth/subscription) traffic is not metered.
|
|
107
116
|
|
|
108
117
|
`agentcap run` accepts `--cap` (default `$5`, or `$AGENTCAP_CAP`),
|
|
109
|
-
`--hour-cap` / `--day-cap` (Pro), `--allow-unmetered`, `--no-clamp`, `--port
|
|
110
|
-
and `--quiet`.
|
|
118
|
+
`--hour-cap` / `--day-cap` (Pro), `--allow-unmetered`, `--no-clamp`, `--port`,
|
|
119
|
+
`--trust-workspace` and `--quiet`.
|
|
120
|
+
|
|
121
|
+
### CLI routing
|
|
122
|
+
|
|
123
|
+
- **Codex CLI 0.163** ignores `OPENAI_BASE_URL`, so AgentCap passes
|
|
124
|
+
`-c model_provider=agentcap` and a `model_providers.agentcap` block (Responses
|
|
125
|
+
API over HTTP, websockets disabled) right after the executable. If your command
|
|
126
|
+
already sets `model_provider`, `model_providers.*` or `openai_base_url` with
|
|
127
|
+
`-c`/`--config`, AgentCap refuses to start (exit code 2) rather than let
|
|
128
|
+
traffic bypass the proxy.
|
|
129
|
+
- **Gemini CLI 0.58–0.66** needs an auth type in headless mode, so AgentCap
|
|
130
|
+
writes a temporary settings file (merged over
|
|
131
|
+
`$GEMINI_CLI_SYSTEM_SETTINGS_PATH` when set) that selects API-key auth, points
|
|
132
|
+
Gemini at `GEMINI_CLI_SYSTEM_SETTINGS_PATH` for the run, and removes it
|
|
133
|
+
afterwards; `~/.gemini` is never modified. `--trust-workspace` adds
|
|
134
|
+
`GEMINI_CLI_TRUST_WORKSPACE=true` for Gemini.
|
|
135
|
+
- `npx @openai/codex ...` and `npx @google/gemini-cli ...` are recognised too.
|
|
136
|
+
|
|
137
|
+
Add `--trust-workspace` for Gemini CLI runs in folders you have not trusted yet;
|
|
138
|
+
without it, headless Gemini may refuse the workspace.
|
|
139
|
+
|
|
140
|
+
At the end of a run AgentCap warns **“no model requests observed — protection
|
|
141
|
+
not verified”** if the proxy saw no model traffic. That means the agent may have
|
|
142
|
+
bypassed the proxy, so check the command and auth mode.
|
|
111
143
|
|
|
112
144
|
## Try it without an API key
|
|
113
145
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
146
|
+
`agentcap demo` is a simulated demo. It starts a fake API on a random loopback
|
|
147
|
+
port, runs a tiny child against it with a 5-cent cap, and prints `(simulated)` at
|
|
148
|
+
the end. It needs no API key, makes no real provider calls, and works from a
|
|
149
|
+
plain `pipx install agentcap-cli`. Exit code `3` means the cap stopped the child.
|
|
150
|
+
|
|
151
|
+
### Simulated demo (fake local API, no real money)
|
|
152
|
+
|
|
153
|
+
```text
|
|
154
|
+
$ agentcap demo
|
|
155
|
+
SIMULATED DEMO — fake local API, no real provider, no real money. Dollar amounts are simulated.
|
|
156
|
+
agentcap [run-3bc1257940cb]: 50% of the $0.05 run cap used ($0.0252).
|
|
157
|
+
agentcap [run-3bc1257940cb]: 80% of the $0.05 run cap used ($0.0408).
|
|
158
|
+
agentcap [run-3bc1257940cb]: budget low, limiting output to 15303 tokens per request
|
|
159
|
+
agentcap [run-3bc1257940cb]: RUN CAP HIT (scope=run, cap=$0.05, spent=$0.0499). Stopping the agent.
|
|
160
|
+
agentcap run summary
|
|
161
|
+
run id: run-3bc1257940cb
|
|
162
|
+
requests: 44
|
|
163
|
+
refused requests: 2
|
|
164
|
+
spent: $0.0500
|
|
165
|
+
cap: $0.05
|
|
166
|
+
reserved-but-unsettled: $0.0000
|
|
167
|
+
clamped requests: 8
|
|
168
|
+
reason: cap_exceeded
|
|
169
|
+
exit code: 3
|
|
170
|
+
(simulated)
|
|
130
171
|
```
|
|
131
172
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
`
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
`AGENTCAP_OPENAI_UPSTREAM` for OpenAI paths.
|
|
173
|
+
From a checkout, `python -m agentcap.devtools.fake_upstream --port 9000` still
|
|
174
|
+
starts the bundled fake upstream on loopback for manual metering experiments; the
|
|
175
|
+
test suite uses `httpx.MockTransport` and never calls the network.
|
|
176
|
+
|
|
177
|
+
## Supported & tested
|
|
138
178
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
179
|
+
| Tool | Verified version | Command and auth | Routing |
|
|
180
|
+
| --- | --- | --- | --- |
|
|
181
|
+
| Codex CLI | 0.163 | `codex exec "…"` with `OPENAI_API_KEY`; ChatGPT sign-in is not metered. | Automatically, via an injected custom provider (`-c model_provider=agentcap …`). |
|
|
182
|
+
| Gemini CLI | 0.58–0.66 | `gemini -p "…"` with `GEMINI_API_KEY`; Google sign-in is not metered. | Automatically, via a temporary `GEMINI_CLI_SYSTEM_SETTINGS_PATH` overlay (api-key auth). Add `--trust-workspace` to `agentcap run` for untrusted folders. |
|
|
183
|
+
| Your own script | Any | Uses the OpenAI or Gemini SDK with base-URL environment variables. | No code changes: AgentCap sets `OPENAI_BASE_URL` and `GOOGLE_GEMINI_BASE_URL`. |
|
|
184
|
+
|
|
185
|
+
Tested end-to-end against a local fake API with the real Codex and Gemini CLIs;
|
|
186
|
+
not yet verified against live billing with a real key.
|
|
142
187
|
|
|
143
188
|
## How it works
|
|
144
189
|
|
|
@@ -159,7 +204,7 @@ shows the active override with userinfo and query strings stripped.
|
|
|
159
204
|
a local SQLite ledger. The input estimate is padded by a conservative
|
|
160
205
|
`input_safety_factor` (1.25 by default) to cover system prompts, tool
|
|
161
206
|
schemas, images and tokenizer differences that the local estimate cannot
|
|
162
|
-
see. Concurrent requests
|
|
207
|
+
see. Concurrent requests reserve against the same budget.
|
|
163
208
|
4. After the upstream responds, the real usage is parsed and the reservation is
|
|
164
209
|
settled to the actual cost (rounded up to the micro-dollar). Settlement uses
|
|
165
210
|
the provider's reported tokens, never the padded estimate. If the provider
|
|
@@ -169,12 +214,12 @@ shows the active override with userinfo and query strings stripped.
|
|
|
169
214
|
5. If the worst case does not fit the remaining budget but the prompt itself
|
|
170
215
|
does, the proxy **clamps the output limit** to exactly what fits (at least
|
|
171
216
|
`256` tokens by default) and reserves only that amount. The agent keeps
|
|
172
|
-
running
|
|
173
|
-
|
|
174
|
-
`--no-clamp`.
|
|
217
|
+
running; real usage still settles the reservation. Clamping is on by default
|
|
218
|
+
and can be disabled with `--no-clamp`.
|
|
175
219
|
6. If even a minimal clamped request cannot fit, the request is blocked and the
|
|
176
220
|
whole child process group is terminated (`SIGTERM`, then `SIGKILL` after
|
|
177
|
-
5s). `agentcap run` exits with code `3`.
|
|
221
|
+
5s). `agentcap run` exits with code `3`. Pro's repeated-request breaker exits
|
|
222
|
+
with `4` when the identical API request is sent 5 times within 120 seconds.
|
|
178
223
|
The kill and its red alert fire at most once per run; later rejected
|
|
179
224
|
requests just receive `429` responses.
|
|
180
225
|
7. Unknown models and unparseable bodies are rejected (fail-closed); the request
|
|
@@ -192,7 +237,7 @@ raised. Everything else is forwarded byte-for-byte, including credentials.
|
|
|
192
237
|
Reasoning/thinking tokens are billed as output and count against the same
|
|
193
238
|
output limit, so a clamp also caps them.
|
|
194
239
|
|
|
195
|
-
##
|
|
240
|
+
## Metered endpoints
|
|
196
241
|
|
|
197
242
|
| Provider | Endpoints |
|
|
198
243
|
| --- | --- |
|
|
@@ -204,8 +249,9 @@ Request bodies are billed at price-book rates; embeddings are input-only.
|
|
|
204
249
|
|
|
205
250
|
## Limitations
|
|
206
251
|
|
|
207
|
-
-
|
|
208
|
-
|
|
252
|
+
- Tools that AgentCap can route (Codex CLI, Gemini CLI) or that honour
|
|
253
|
+
`OPENAI_BASE_URL` / `GOOGLE_GEMINI_BASE_URL` and send API keys can be metered.
|
|
254
|
+
OAuth or subscription logins are **not** metered.
|
|
209
255
|
- Prices are a local table, not a live feed. Check them with
|
|
210
256
|
`agentcap pricing`; override any entry in
|
|
211
257
|
`~/.config/agentcap/pricing.json` (or `$AGENTCAP_PRICING_FILE`).
|
|
@@ -214,54 +260,73 @@ Request bodies are billed at price-book rates; embeddings are input-only.
|
|
|
214
260
|
limit to what the remaining budget can afford. Prompts are never changed.
|
|
215
261
|
- Estimates are deliberately conservative, so a reservation can be larger than
|
|
216
262
|
the eventual cost. The cap is enforced before each request with a worst-case
|
|
217
|
-
reservation
|
|
218
|
-
a mathematical guarantee: if a provider bills more input tokens than
|
|
263
|
+
reservation and concurrent requests reserve against the same budget. This is
|
|
264
|
+
not a mathematical guarantee: if a provider bills more input tokens than
|
|
219
265
|
estimated (for example server-side system prompts, tool schemas, images or
|
|
220
|
-
tokenizer differences), the final spend can exceed the cap by
|
|
221
|
-
|
|
266
|
+
tokenizer differences), the final spend can exceed the cap by that one
|
|
267
|
+
request's estimation error. AgentCap emits an `overshoot` alert when a
|
|
222
268
|
settlement exceeds its reservation.
|
|
223
269
|
- The ledger lives at `~/.local/share/agentcap/ledger.sqlite3`
|
|
224
270
|
(override with `$AGENTCAP_DB`).
|
|
225
271
|
|
|
226
272
|
## Privacy
|
|
227
273
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
274
|
+
Prompts and keys pass through the local proxy in memory; AgentCap never stores
|
|
275
|
+
or uploads them. Free sends nothing anywhere. Pro sends alert metadata (run id,
|
|
276
|
+
spend, reason) only to webhook/Telegram destinations you configure, and
|
|
277
|
+
validates your licence key with Polar about once a week.
|
|
278
|
+
|
|
279
|
+
The ledger keeps token counts, costs, model names, timestamps and request
|
|
280
|
+
hashes — never prompts, response contents, API keys or Authorization headers.
|
|
233
281
|
|
|
234
|
-
**Pro
|
|
235
|
-
only the
|
|
282
|
+
**Pro licence checks:** activating a Pro key (and the periodic re-check) sends
|
|
283
|
+
only the licence key, the Polar organization id and an anonymous machine
|
|
236
284
|
fingerprint hash (SHA-256; it contains no hostname and no username) to Polar's
|
|
237
|
-
public
|
|
285
|
+
public licence API at `api.polar.sh`. Free users make no licence requests at
|
|
238
286
|
all.
|
|
239
287
|
|
|
240
288
|
## Free vs Pro
|
|
241
289
|
|
|
242
290
|
| Capability | Free | Pro |
|
|
243
291
|
| --- | --- | --- |
|
|
244
|
-
|
|
|
292
|
+
| Local spend cap per run, with conservative reservation | ✅ | ✅ |
|
|
245
293
|
| Output clamping | ✅ | ✅ |
|
|
246
294
|
| Kills the local process at the cap | ✅ | ✅ |
|
|
247
295
|
| Terminal alert with the reason | ✅ | ✅ |
|
|
248
|
-
|
|
|
296
|
+
| Repeated-request breaker (exit code 4) | — | ✅ |
|
|
249
297
|
| Webhook alerts (`AGENTCAP_WEBHOOK_URL`) | — | ✅ |
|
|
250
298
|
| Telegram alerts (`AGENTCAP_TELEGRAM_BOT_TOKEN`, `AGENTCAP_TELEGRAM_CHAT_ID`) | — | ✅ |
|
|
251
299
|
| Hourly / daily caps | — | ✅ |
|
|
252
300
|
|
|
253
|
-
Free is **$0
|
|
254
|
-
worst-case reservation, output clamping, the run killed at the cap, and
|
|
255
|
-
|
|
301
|
+
Free is **$0**: the local spend cap — a per-run USD cap with conservative
|
|
302
|
+
worst-case reservation, output clamping, the run killed at the cap, and terminal
|
|
303
|
+
alerts — with no account, no key, and no network calls.
|
|
256
304
|
|
|
257
|
-
Pro is **$12 one-time** — not a subscription
|
|
258
|
-
breaker**:
|
|
259
|
-
|
|
260
|
-
an
|
|
305
|
+
Pro is **$12 one-time** — not a subscription. It centres on the
|
|
306
|
+
**repeated-request breaker**: it stops a run when the identical API request is
|
|
307
|
+
sent 5 times within 120 seconds (exit code 4). It does not catch every
|
|
308
|
+
no-progress loop: an agent whose conversation keeps growing sends different
|
|
309
|
+
requests each time. Triggers: a retry storm resending the same request. Does not
|
|
310
|
+
trigger: an agent looping while its context grows. Pro also adds **alerts** over
|
|
311
|
+
a webhook and Telegram, plus hourly / daily caps as an extra, and updates for
|
|
312
|
+
the 0.x line.
|
|
261
313
|
|
|
262
314
|
[Buy AgentCap Pro — $12](https://buy.polar.sh/polar_cl_qagsvUdwQ0dRvaW7X5ynEJg5md27pEctIRAr40MBeLi)
|
|
263
315
|
|
|
264
|
-
|
|
316
|
+
### Purchase terms
|
|
317
|
+
|
|
318
|
+
- Pro is $12 one-time, no subscription.
|
|
319
|
+
- 14-day no-questions refund — email
|
|
320
|
+
[kutaykarahan6@gmail.com](mailto:kutaykarahan6@gmail.com).
|
|
321
|
+
- One licence key activates on up to 3 machines.
|
|
322
|
+
- The key is checked with Polar about once a week.
|
|
323
|
+
- If the licence server is unreachable your Pro keeps working (fail-open); only
|
|
324
|
+
an explicit Polar rejection of a refunded or revoked key downgrades it.
|
|
325
|
+
- If AgentCap is discontinued, Pro keeps working and you can ask for a refund
|
|
326
|
+
within 14 days of purchase.
|
|
327
|
+
- The Free tier (per-run cap) needs no key and makes no network calls.
|
|
328
|
+
|
|
329
|
+
After purchase you receive a licence key by email (via Polar). Activate it with
|
|
265
330
|
`agentcap license activate <KEY>`; `agentcap license deactivate` removes it from
|
|
266
331
|
this machine.
|
|
267
332
|
|
|
@@ -269,11 +334,11 @@ this machine.
|
|
|
269
334
|
|
|
270
335
|
| Tool | What it does and how it enforces a cap |
|
|
271
336
|
| --- | --- |
|
|
272
|
-
| RelayPlane | [relayplane.com](https://relayplane.com): free, MIT-licensed local proxy with daily/hourly/per-request/per-run caps, routing and a kill switch.
|
|
273
|
-
| LoopGuard | [tryloopguard.com](https://tryloopguard.com): free MIT CLI that
|
|
337
|
+
| RelayPlane | [relayplane.com](https://relayplane.com): free, MIT-licensed local proxy with daily/hourly/per-request/per-run caps, routing and a kill switch. It enforces budgets at the proxy — blocking or warning on breach — and is aimed at Anthropic/OpenAI chat routing. A good fit for gateway-style setups. |
|
|
338
|
+
| LoopGuard | [tryloopguard.com](https://tryloopguard.com): free MIT CLI that integrates with Claude Code, Codex CLI and Cursor (no proxy, works with subscriptions) with per-session/daily caps and a no-progress loop killer; paid tier ($9/month) adds phone/Slack alerts and remote pause. A good fit if you use subscriptions or Claude Code. |
|
|
274
339
|
| LiteLLM budgets | Budgets per key, user or team in the LiteLLM proxy; budgets need its database. A good fit if you already run a LiteLLM gateway; it is a server you deploy and configure. |
|
|
275
340
|
| OpenRouter credit limits / provider spend caps | Account- or key-level and typically monthly (OpenRouter credit limits, OpenAI and Google spend caps). Provider caps are evaluated with a delay — Google has described about 10 minutes for the Gemini API cap — so a fast loop can overshoot. |
|
|
276
|
-
| AgentCap |
|
|
341
|
+
| AgentCap | Local proxy for API-key traffic from Codex CLI, Gemini CLI or your own script: local spend cap per run with conservative reservation and output clamping, kills the process group at the cap and prints why. Pro: repeated-request breaker + Telegram/webhook alerts, $12 one-time. |
|
|
277
342
|
|
|
278
343
|
Pick what matches your setup — these tools can also be combined.
|
|
279
344
|
|
|
@@ -281,15 +346,17 @@ Pick what matches your setup — these tools can also be combined.
|
|
|
281
346
|
|
|
282
347
|
MIT — see [LICENSE](LICENSE). Copyright (c) 2026 Kutay Karahan.
|
|
283
348
|
|
|
284
|
-
The Pro
|
|
349
|
+
The Pro licence key is separate from the source licence. How it is checked:
|
|
285
350
|
|
|
286
|
-
- On activation the key is validated against Polar's public
|
|
351
|
+
- On activation the key is validated against Polar's public licence API
|
|
287
352
|
(`api.polar.sh`). After that it is re-checked at most about once every 7 days.
|
|
288
353
|
- The result is cached in `~/.config/agentcap/license.json` (overridable with
|
|
289
354
|
`$AGENTCAP_LICENSE_FILE`).
|
|
290
|
-
-
|
|
291
|
-
|
|
292
|
-
|
|
355
|
+
- The licence check fails open: if you are offline, or Polar cannot be reached,
|
|
356
|
+
a previously validated licence keeps working. Network failures (timeouts,
|
|
357
|
+
connection errors, 5xx, unexpected responses) never downgrade it, and
|
|
358
|
+
revalidation is retried about every 7 days. Only an explicit rejection from
|
|
359
|
+
Polar (for example a refunded or revoked key) falls back to the free tier.
|
|
293
360
|
- `AGENTCAP_POLAR_ORG_ID` selects the Polar organization the key belongs to.
|
|
294
361
|
|
|
295
362
|
## Development
|