agentcap-cli 0.1.0__tar.gz → 0.1.2__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.2}/PKG-INFO +144 -75
- agentcap_cli-0.1.2/README.md +343 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/pyproject.toml +1 -1
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/src/agentcap/__init__.py +1 -1
- agentcap_cli-0.1.2/src/agentcap/adapters.py +429 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/src/agentcap/clamp.py +89 -10
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/src/agentcap/cli.py +19 -0
- agentcap_cli-0.1.2/src/agentcap/demo.py +155 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/src/agentcap/devtools/fake_upstream.py +83 -8
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/src/agentcap/estimate.py +211 -19
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/src/agentcap/license.py +86 -33
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/src/agentcap/proxy.py +122 -17
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/src/agentcap/runner.py +79 -4
- agentcap_cli-0.1.2/tests/test_adapters.py +508 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/tests/test_clamp.py +184 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/tests/test_cli.py +21 -0
- agentcap_cli-0.1.2/tests/test_estimate.py +457 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/tests/test_license.py +48 -15
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/tests/test_proxy_core.py +19 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/tests/test_proxy_extras.py +87 -1
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/tests/test_proxy_streaming.py +46 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/tests/test_runner.py +108 -1
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/tests/test_upstreams.py +94 -0
- agentcap_cli-0.1.0/README.md +0 -274
- agentcap_cli-0.1.0/tests/test_estimate.py +0 -225
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/.gitignore +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/LICENSE +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/landing/README.md +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/src/agentcap/alerts.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/src/agentcap/data/pricing.json +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/src/agentcap/devtools/__init__.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/src/agentcap/ledger.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/src/agentcap/loop.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/src/agentcap/pricing.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/src/agentcap/upstreams.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/src/agentcap/usage.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/tests/license_support.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/tests/proxy_support.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/tests/test_alerts.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/tests/test_ledger.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/tests/test_loop.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/tests/test_pricing.py +0 -0
- {agentcap_cli-0.1.0 → agentcap_cli-0.1.2}/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.2
|
|
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,77 @@ 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, and from 0.60 it
|
|
130
|
+
also refuses system settings files that are not root-owned. AgentCap therefore
|
|
131
|
+
runs Gemini with a temporary `GEMINI_CLI_HOME`: its `.gemini` directory links
|
|
132
|
+
your real entries (history, `trustedFolders.json`, credentials) and holds a
|
|
133
|
+
copied `settings.json` with the auth type forced to `gemini-api-key`. The
|
|
134
|
+
overlay is removed afterwards; nothing in your real `~/.gemini` is modified.
|
|
135
|
+
`--trust-workspace` adds `GEMINI_CLI_TRUST_WORKSPACE=true` for Gemini.
|
|
136
|
+
- `npx @openai/codex ...` and `npx @google/gemini-cli ...` are recognised too.
|
|
137
|
+
|
|
138
|
+
Add `--trust-workspace` for Gemini CLI runs in folders you have not trusted yet;
|
|
139
|
+
without it, headless Gemini may refuse the workspace.
|
|
140
|
+
|
|
141
|
+
At the end of a run AgentCap warns **“no model requests observed — protection
|
|
142
|
+
not verified”** if the proxy saw no model traffic. That means the agent may have
|
|
143
|
+
bypassed the proxy, so check the command and auth mode.
|
|
111
144
|
|
|
112
145
|
## Try it without an API key
|
|
113
146
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
147
|
+
`agentcap demo` is a simulated demo. It starts a fake API on a random loopback
|
|
148
|
+
port, runs a tiny child against it with a 5-cent cap, and prints `(simulated)` at
|
|
149
|
+
the end. It needs no API key, makes no real provider calls, and works from a
|
|
150
|
+
plain `pipx install agentcap-cli`. Exit code `3` means the cap stopped the child.
|
|
151
|
+
|
|
152
|
+
### Simulated demo (fake local API, no real money)
|
|
153
|
+
|
|
154
|
+
```text
|
|
155
|
+
$ agentcap demo
|
|
156
|
+
SIMULATED DEMO — fake local API, no real provider, no real money. Dollar amounts are simulated.
|
|
157
|
+
agentcap [run-3bc1257940cb]: 50% of the $0.05 run cap used ($0.0252).
|
|
158
|
+
agentcap [run-3bc1257940cb]: 80% of the $0.05 run cap used ($0.0408).
|
|
159
|
+
agentcap [run-3bc1257940cb]: budget low, limiting output to 15303 tokens per request
|
|
160
|
+
agentcap [run-3bc1257940cb]: RUN CAP HIT (scope=run, cap=$0.05, spent=$0.0499). Stopping the agent.
|
|
161
|
+
agentcap run summary
|
|
162
|
+
run id: run-3bc1257940cb
|
|
163
|
+
requests: 44
|
|
164
|
+
refused requests: 2
|
|
165
|
+
spent: $0.0500
|
|
166
|
+
cap: $0.05
|
|
167
|
+
reserved-but-unsettled: $0.0000
|
|
168
|
+
clamped requests: 8
|
|
169
|
+
reason: cap_exceeded
|
|
170
|
+
exit code: 3
|
|
171
|
+
(simulated)
|
|
130
172
|
```
|
|
131
173
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
`
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
`AGENTCAP_OPENAI_UPSTREAM` for OpenAI paths.
|
|
174
|
+
From a checkout, `python -m agentcap.devtools.fake_upstream --port 9000` still
|
|
175
|
+
starts the bundled fake upstream on loopback for manual metering experiments; the
|
|
176
|
+
test suite uses `httpx.MockTransport` and never calls the network.
|
|
177
|
+
|
|
178
|
+
## Supported & tested
|
|
138
179
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
180
|
+
| Tool | Verified version | Command and auth | Routing |
|
|
181
|
+
| --- | --- | --- | --- |
|
|
182
|
+
| 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 …`). |
|
|
183
|
+
| Gemini CLI | 0.58–0.66 | `gemini -p "…"` with `GEMINI_API_KEY`; Google sign-in is not metered. | Automatically, via a temporary `GEMINI_CLI_HOME` overlay (your `~/.gemini` is linked, its `settings.json` is copied with the auth type forced to `gemini-api-key`; nothing in `~/.gemini` is modified). Add `--trust-workspace` to `agentcap run` for untrusted folders. |
|
|
184
|
+
| 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`. |
|
|
185
|
+
|
|
186
|
+
Tested with a real Gemini API key on Gemini CLI 0.66 (spend metered from Google's
|
|
187
|
+
usageMetadata, output clamped to the cap); Gemini CLI 0.58 and Codex CLI 0.163 are
|
|
188
|
+
tested end-to-end against a local fake API only, not yet with real paid keys.
|
|
142
189
|
|
|
143
190
|
## How it works
|
|
144
191
|
|
|
@@ -159,7 +206,7 @@ shows the active override with userinfo and query strings stripped.
|
|
|
159
206
|
a local SQLite ledger. The input estimate is padded by a conservative
|
|
160
207
|
`input_safety_factor` (1.25 by default) to cover system prompts, tool
|
|
161
208
|
schemas, images and tokenizer differences that the local estimate cannot
|
|
162
|
-
see. Concurrent requests
|
|
209
|
+
see. Concurrent requests reserve against the same budget.
|
|
163
210
|
4. After the upstream responds, the real usage is parsed and the reservation is
|
|
164
211
|
settled to the actual cost (rounded up to the micro-dollar). Settlement uses
|
|
165
212
|
the provider's reported tokens, never the padded estimate. If the provider
|
|
@@ -169,12 +216,12 @@ shows the active override with userinfo and query strings stripped.
|
|
|
169
216
|
5. If the worst case does not fit the remaining budget but the prompt itself
|
|
170
217
|
does, the proxy **clamps the output limit** to exactly what fits (at least
|
|
171
218
|
`256` tokens by default) and reserves only that amount. The agent keeps
|
|
172
|
-
running
|
|
173
|
-
|
|
174
|
-
`--no-clamp`.
|
|
219
|
+
running; real usage still settles the reservation. Clamping is on by default
|
|
220
|
+
and can be disabled with `--no-clamp`.
|
|
175
221
|
6. If even a minimal clamped request cannot fit, the request is blocked and the
|
|
176
222
|
whole child process group is terminated (`SIGTERM`, then `SIGKILL` after
|
|
177
|
-
5s). `agentcap run` exits with code `3`.
|
|
223
|
+
5s). `agentcap run` exits with code `3`. Pro's repeated-request breaker exits
|
|
224
|
+
with `4` when the identical API request is sent 5 times within 120 seconds.
|
|
178
225
|
The kill and its red alert fire at most once per run; later rejected
|
|
179
226
|
requests just receive `429` responses.
|
|
180
227
|
7. Unknown models and unparseable bodies are rejected (fail-closed); the request
|
|
@@ -192,7 +239,7 @@ raised. Everything else is forwarded byte-for-byte, including credentials.
|
|
|
192
239
|
Reasoning/thinking tokens are billed as output and count against the same
|
|
193
240
|
output limit, so a clamp also caps them.
|
|
194
241
|
|
|
195
|
-
##
|
|
242
|
+
## Metered endpoints
|
|
196
243
|
|
|
197
244
|
| Provider | Endpoints |
|
|
198
245
|
| --- | --- |
|
|
@@ -204,8 +251,9 @@ Request bodies are billed at price-book rates; embeddings are input-only.
|
|
|
204
251
|
|
|
205
252
|
## Limitations
|
|
206
253
|
|
|
207
|
-
-
|
|
208
|
-
|
|
254
|
+
- Tools that AgentCap can route (Codex CLI, Gemini CLI) or that honour
|
|
255
|
+
`OPENAI_BASE_URL` / `GOOGLE_GEMINI_BASE_URL` and send API keys can be metered.
|
|
256
|
+
OAuth or subscription logins are **not** metered.
|
|
209
257
|
- Prices are a local table, not a live feed. Check them with
|
|
210
258
|
`agentcap pricing`; override any entry in
|
|
211
259
|
`~/.config/agentcap/pricing.json` (or `$AGENTCAP_PRICING_FILE`).
|
|
@@ -214,54 +262,73 @@ Request bodies are billed at price-book rates; embeddings are input-only.
|
|
|
214
262
|
limit to what the remaining budget can afford. Prompts are never changed.
|
|
215
263
|
- Estimates are deliberately conservative, so a reservation can be larger than
|
|
216
264
|
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
|
|
265
|
+
reservation and concurrent requests reserve against the same budget. This is
|
|
266
|
+
not a mathematical guarantee: if a provider bills more input tokens than
|
|
219
267
|
estimated (for example server-side system prompts, tool schemas, images or
|
|
220
|
-
tokenizer differences), the final spend can exceed the cap by
|
|
221
|
-
|
|
268
|
+
tokenizer differences), the final spend can exceed the cap by that one
|
|
269
|
+
request's estimation error. AgentCap emits an `overshoot` alert when a
|
|
222
270
|
settlement exceeds its reservation.
|
|
223
271
|
- The ledger lives at `~/.local/share/agentcap/ledger.sqlite3`
|
|
224
272
|
(override with `$AGENTCAP_DB`).
|
|
225
273
|
|
|
226
274
|
## Privacy
|
|
227
275
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
276
|
+
Prompts and keys pass through the local proxy in memory; AgentCap never stores
|
|
277
|
+
or uploads them. Free sends nothing anywhere. Pro sends alert metadata (run id,
|
|
278
|
+
spend, reason) only to webhook/Telegram destinations you configure, and
|
|
279
|
+
validates your licence key with Polar about once a week.
|
|
280
|
+
|
|
281
|
+
The ledger keeps token counts, costs, model names, timestamps and request
|
|
282
|
+
hashes — never prompts, response contents, API keys or Authorization headers.
|
|
233
283
|
|
|
234
|
-
**Pro
|
|
235
|
-
only the
|
|
284
|
+
**Pro licence checks:** activating a Pro key (and the periodic re-check) sends
|
|
285
|
+
only the licence key, the Polar organization id and an anonymous machine
|
|
236
286
|
fingerprint hash (SHA-256; it contains no hostname and no username) to Polar's
|
|
237
|
-
public
|
|
287
|
+
public licence API at `api.polar.sh`. Free users make no licence requests at
|
|
238
288
|
all.
|
|
239
289
|
|
|
240
290
|
## Free vs Pro
|
|
241
291
|
|
|
242
292
|
| Capability | Free | Pro |
|
|
243
293
|
| --- | --- | --- |
|
|
244
|
-
|
|
|
294
|
+
| Local spend cap per run, with conservative reservation | ✅ | ✅ |
|
|
245
295
|
| Output clamping | ✅ | ✅ |
|
|
246
296
|
| Kills the local process at the cap | ✅ | ✅ |
|
|
247
297
|
| Terminal alert with the reason | ✅ | ✅ |
|
|
248
|
-
|
|
|
298
|
+
| Repeated-request breaker (exit code 4) | — | ✅ |
|
|
249
299
|
| Webhook alerts (`AGENTCAP_WEBHOOK_URL`) | — | ✅ |
|
|
250
300
|
| Telegram alerts (`AGENTCAP_TELEGRAM_BOT_TOKEN`, `AGENTCAP_TELEGRAM_CHAT_ID`) | — | ✅ |
|
|
251
301
|
| Hourly / daily caps | — | ✅ |
|
|
252
302
|
|
|
253
|
-
Free is **$0
|
|
254
|
-
worst-case reservation, output clamping, the run killed at the cap, and
|
|
255
|
-
|
|
303
|
+
Free is **$0**: the local spend cap — a per-run USD cap with conservative
|
|
304
|
+
worst-case reservation, output clamping, the run killed at the cap, and terminal
|
|
305
|
+
alerts — with no account, no key, and no network calls.
|
|
256
306
|
|
|
257
|
-
Pro is **$12 one-time** — not a subscription
|
|
258
|
-
breaker**:
|
|
259
|
-
|
|
260
|
-
an
|
|
307
|
+
Pro is **$12 one-time** — not a subscription. It centres on the
|
|
308
|
+
**repeated-request breaker**: it stops a run when the identical API request is
|
|
309
|
+
sent 5 times within 120 seconds (exit code 4). It does not catch every
|
|
310
|
+
no-progress loop: an agent whose conversation keeps growing sends different
|
|
311
|
+
requests each time. Triggers: a retry storm resending the same request. Does not
|
|
312
|
+
trigger: an agent looping while its context grows. Pro also adds **alerts** over
|
|
313
|
+
a webhook and Telegram, plus hourly / daily caps as an extra, and updates for
|
|
314
|
+
the 0.x line.
|
|
261
315
|
|
|
262
316
|
[Buy AgentCap Pro — $12](https://buy.polar.sh/polar_cl_qagsvUdwQ0dRvaW7X5ynEJg5md27pEctIRAr40MBeLi)
|
|
263
317
|
|
|
264
|
-
|
|
318
|
+
### Purchase terms
|
|
319
|
+
|
|
320
|
+
- Pro is $12 one-time, no subscription.
|
|
321
|
+
- 14-day no-questions refund — email
|
|
322
|
+
[kutaykarahan6@gmail.com](mailto:kutaykarahan6@gmail.com).
|
|
323
|
+
- One licence key activates on up to 3 machines.
|
|
324
|
+
- The key is checked with Polar about once a week.
|
|
325
|
+
- If the licence server is unreachable your Pro keeps working (fail-open); only
|
|
326
|
+
an explicit Polar rejection of a refunded or revoked key downgrades it.
|
|
327
|
+
- If AgentCap is discontinued, Pro keeps working and you can ask for a refund
|
|
328
|
+
within 14 days of purchase.
|
|
329
|
+
- The Free tier (per-run cap) needs no key and makes no network calls.
|
|
330
|
+
|
|
331
|
+
After purchase you receive a licence key by email (via Polar). Activate it with
|
|
265
332
|
`agentcap license activate <KEY>`; `agentcap license deactivate` removes it from
|
|
266
333
|
this machine.
|
|
267
334
|
|
|
@@ -269,11 +336,11 @@ this machine.
|
|
|
269
336
|
|
|
270
337
|
| Tool | What it does and how it enforces a cap |
|
|
271
338
|
| --- | --- |
|
|
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
|
|
339
|
+
| 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. |
|
|
340
|
+
| 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
341
|
| 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
342
|
| 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 |
|
|
343
|
+
| 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
344
|
|
|
278
345
|
Pick what matches your setup — these tools can also be combined.
|
|
279
346
|
|
|
@@ -281,15 +348,17 @@ Pick what matches your setup — these tools can also be combined.
|
|
|
281
348
|
|
|
282
349
|
MIT — see [LICENSE](LICENSE). Copyright (c) 2026 Kutay Karahan.
|
|
283
350
|
|
|
284
|
-
The Pro
|
|
351
|
+
The Pro licence key is separate from the source licence. How it is checked:
|
|
285
352
|
|
|
286
|
-
- On activation the key is validated against Polar's public
|
|
353
|
+
- On activation the key is validated against Polar's public licence API
|
|
287
354
|
(`api.polar.sh`). After that it is re-checked at most about once every 7 days.
|
|
288
355
|
- The result is cached in `~/.config/agentcap/license.json` (overridable with
|
|
289
356
|
`$AGENTCAP_LICENSE_FILE`).
|
|
290
|
-
-
|
|
291
|
-
|
|
292
|
-
|
|
357
|
+
- The licence check fails open: if you are offline, or Polar cannot be reached,
|
|
358
|
+
a previously validated licence keeps working. Network failures (timeouts,
|
|
359
|
+
connection errors, 5xx, unexpected responses) never downgrade it, and
|
|
360
|
+
revalidation is retried about every 7 days. Only an explicit rejection from
|
|
361
|
+
Polar (for example a refunded or revoked key) falls back to the free tier.
|
|
293
362
|
- `AGENTCAP_POLAR_ORG_ID` selects the Polar organization the key belongs to.
|
|
294
363
|
|
|
295
364
|
## Development
|