loopcap 0.0.0-stage → 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +110 -2
- package/dist/cli/commands-CWPR6G7K.js +1448 -0
- package/dist/cli/index.js +57 -0
- package/dist/web/assets/index-Dh109ogZ.css +2 -0
- package/dist/web/assets/index-piKH5vJH.js +9 -0
- package/dist/web/index.html +14 -0
- package/loopcap.config.yaml +31 -0
- package/package.json +68 -4
- package/pricing.json +57 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# LoopCap configuration. All amounts are in USD.
|
|
2
|
+
server:
|
|
3
|
+
host: 127.0.0.1 # loopback only: the proxy forwards your API keys
|
|
4
|
+
proxyPort: 4000
|
|
5
|
+
dashboardPort: 4001
|
|
6
|
+
|
|
7
|
+
upstreams:
|
|
8
|
+
anthropic: https://api.anthropic.com
|
|
9
|
+
openai: https://api.openai.com
|
|
10
|
+
|
|
11
|
+
breakers:
|
|
12
|
+
loop:
|
|
13
|
+
enabled: true
|
|
14
|
+
windowSize: 10 # recent turns kept per session
|
|
15
|
+
identicalLoopThreshold: 3 # identical consecutive turns that trip the breaker
|
|
16
|
+
ignoreArgKeys: [description] # tool arguments ignored when comparing calls
|
|
17
|
+
spend:
|
|
18
|
+
enabled: true
|
|
19
|
+
maxSessionSpendUsd: 2.00
|
|
20
|
+
maxBurnRatePerMinUsd: 0.75
|
|
21
|
+
warnAtFraction: 0.8 # dashboard shows WARNING at this share of a cap
|
|
22
|
+
|
|
23
|
+
sessions:
|
|
24
|
+
header: x-loopcap-session # optional client header that names a session
|
|
25
|
+
idleTimeoutMinutes: 30 # a quiet session is closed after this
|
|
26
|
+
|
|
27
|
+
storage:
|
|
28
|
+
path: ~/.loopcap/loopcap.db # token counts and costs only; never prompts or keys
|
|
29
|
+
|
|
30
|
+
pricing:
|
|
31
|
+
file: null # path to a pricing.json that overrides the bundled table
|
package/package.json
CHANGED
|
@@ -1,6 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "loopcap",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Local proxy that meters LLM token spend and trips a circuit breaker on runaway agent loops",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"llm",
|
|
7
|
+
"ai-agents",
|
|
8
|
+
"claude",
|
|
9
|
+
"anthropic",
|
|
10
|
+
"openai",
|
|
11
|
+
"finops",
|
|
12
|
+
"token-usage",
|
|
13
|
+
"cost",
|
|
14
|
+
"circuit-breaker",
|
|
15
|
+
"proxy"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://github.com/Loopcap/loopcap#readme",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/Loopcap/loopcap/issues"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/Loopcap/loopcap.git"
|
|
26
|
+
},
|
|
27
|
+
"bin": {
|
|
28
|
+
"loopcap": "dist/cli/index.js"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"pricing.json",
|
|
33
|
+
"loopcap.config.yaml"
|
|
34
|
+
],
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=24"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"dev": "tsx watch src/cli/index.ts start",
|
|
40
|
+
"start": "tsx src/cli/index.ts start",
|
|
41
|
+
"demo": "tsx src/cli/index.ts demo",
|
|
42
|
+
"build": "npm run build:cli && npm run build:web",
|
|
43
|
+
"build:cli": "tsup src/cli/index.ts --format esm --target node24 --out-dir dist/cli --clean",
|
|
44
|
+
"build:web": "vite build --config web/vite.config.ts",
|
|
45
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p web",
|
|
46
|
+
"test": "vitest run",
|
|
47
|
+
"prepublishOnly": "npm run typecheck && npm test && npm run build"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@hono/node-server": "^2.1.11",
|
|
51
|
+
"hono": "^4.13.23",
|
|
52
|
+
"yaml": "^2.9.1",
|
|
53
|
+
"zod": "^4.6.7"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@tailwindcss/vite": "^4.3.5",
|
|
57
|
+
"@types/node": "^24",
|
|
58
|
+
"@types/react": "^19.3.3",
|
|
59
|
+
"@types/react-dom": "^19.3.0",
|
|
60
|
+
"@vitejs/plugin-react": "^6.3.1",
|
|
61
|
+
"react": "^19.3.1",
|
|
62
|
+
"react-dom": "^19.3.1",
|
|
63
|
+
"tailwindcss": "^4.3.5",
|
|
64
|
+
"tsup": "^9.0.0",
|
|
65
|
+
"tsx": "^4.23.15",
|
|
66
|
+
"typescript": "^5.9.3",
|
|
67
|
+
"vite": "^8.4.1",
|
|
68
|
+
"vitest": "^5.1.2"
|
|
69
|
+
}
|
|
70
|
+
}
|
package/pricing.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"unit": "USD per million tokens",
|
|
3
|
+
"verifiedAt": "2026-12-05",
|
|
4
|
+
"sources": [
|
|
5
|
+
"https://platform.claude.com/docs/en/about-claude/pricing",
|
|
6
|
+
"https://developers.openai.com/api/docs/pricing"
|
|
7
|
+
],
|
|
8
|
+
"anthropicWebSearchPerRequestUsd": 0.01,
|
|
9
|
+
"models": {
|
|
10
|
+
"claude-fable-5-2": { "provider": "anthropic", "input": 8, "output": 40, "cacheRead": 0.2, "cacheWrite5m": 10, "cacheWrite1h": 16 },
|
|
11
|
+
"claude-fable-5-1": { "provider": "anthropic", "input": 10, "output": 50, "cacheRead": 0.25, "cacheWrite5m": 12.5, "cacheWrite1h": 20 },
|
|
12
|
+
"claude-fable-5": { "provider": "anthropic", "input": 10, "output": 50, "cacheRead": 1, "cacheWrite5m": 12.5, "cacheWrite1h": 20 },
|
|
13
|
+
"claude-opus-5-5": { "provider": "anthropic", "input": 4, "output": 20, "cacheRead": 0.2, "cacheWrite5m": 5, "cacheWrite1h": 8 },
|
|
14
|
+
"claude-opus-5": { "provider": "anthropic", "input": 5, "output": 25, "cacheRead": 0.5, "cacheWrite5m": 6.25, "cacheWrite1h": 10 },
|
|
15
|
+
"claude-opus-4-8": { "provider": "anthropic", "input": 5, "output": 25, "cacheRead": 0.5, "cacheWrite5m": 6.25, "cacheWrite1h": 10 },
|
|
16
|
+
"claude-opus-4-7": { "provider": "anthropic", "input": 5, "output": 25, "cacheRead": 0.5, "cacheWrite5m": 6.25, "cacheWrite1h": 10 },
|
|
17
|
+
"claude-opus-4-6": { "provider": "anthropic", "input": 5, "output": 25, "cacheRead": 0.5, "cacheWrite5m": 6.25, "cacheWrite1h": 10 },
|
|
18
|
+
"claude-opus-4-5": { "provider": "anthropic", "input": 5, "output": 25, "cacheRead": 0.5, "cacheWrite5m": 6.25, "cacheWrite1h": 10 },
|
|
19
|
+
"claude-sonnet-5-5": { "provider": "anthropic", "input": 2, "output": 10, "cacheRead": 0.1, "cacheWrite5m": 2.5, "cacheWrite1h": 4 },
|
|
20
|
+
"claude-sonnet-5": { "provider": "anthropic", "input": 2, "output": 10, "cacheRead": 0.2, "cacheWrite5m": 2.5, "cacheWrite1h": 4 },
|
|
21
|
+
"claude-sonnet-4-6": { "provider": "anthropic", "input": 3, "output": 15, "cacheRead": 0.3, "cacheWrite5m": 3.75, "cacheWrite1h": 6 },
|
|
22
|
+
"claude-sonnet-4-5": { "provider": "anthropic", "input": 3, "output": 15, "cacheRead": 0.3, "cacheWrite5m": 3.75, "cacheWrite1h": 6 },
|
|
23
|
+
"claude-haiku-5-5": { "provider": "anthropic", "input": 0.1, "output": 0.5, "cacheRead": 0.01, "cacheWrite5m": 0.125, "cacheWrite1h": 0.2,
|
|
24
|
+
"longContext": { "aboveInputTokens": 100000, "input": 0.5, "output": 2.5, "cacheRead": 0.05, "cacheWrite5m": 0.625, "cacheWrite1h": 1 } },
|
|
25
|
+
"claude-haiku-4-5": { "provider": "anthropic", "input": 1, "output": 5, "cacheRead": 0.1, "cacheWrite5m": 1.25, "cacheWrite1h": 2 },
|
|
26
|
+
|
|
27
|
+
"gpt-6.2-astra": { "provider": "openai", "input": 8, "output": 40, "cacheRead": 0.4, "longContext": { "aboveInputTokens": 272000, "input": 16, "output": 60, "cacheRead": 0.8 } },
|
|
28
|
+
"gpt-6.2-sol": { "provider": "openai", "input": 2, "output": 10, "cacheRead": 0.1, "longContext": { "aboveInputTokens": 272000, "input": 4, "output": 15, "cacheRead": 0.2 } },
|
|
29
|
+
"gpt-6-astra": { "provider": "openai", "input": 10, "output": 50, "cacheRead": 1, "longContext": { "aboveInputTokens": 272000, "input": 20, "output": 75, "cacheRead": 2 } },
|
|
30
|
+
"gpt-6.1-sol": { "provider": "openai", "input": 2, "output": 10, "cacheRead": 0.1, "longContext": { "aboveInputTokens": 272000, "input": 4, "output": 15, "cacheRead": 0.2 } },
|
|
31
|
+
"gpt-6.1-terra": { "provider": "openai", "input": 1, "output": 5, "cacheRead": 0.05, "longContext": { "aboveInputTokens": 272000, "input": 2, "output": 7.5, "cacheRead": 0.1 } },
|
|
32
|
+
"gpt-6-luna": { "provider": "openai", "input": 0.1, "output": 0.5, "cacheRead": 0.01, "longContext": { "aboveInputTokens": 272000, "input": 0.2, "output": 0.75, "cacheRead": 0.02 } },
|
|
33
|
+
"gpt-6-sol": { "provider": "openai", "input": 2, "output": 10, "cacheRead": 0.2, "longContext": { "aboveInputTokens": 272000, "input": 4, "output": 15, "cacheRead": 0.4 } },
|
|
34
|
+
"gpt-5.6-sol": { "provider": "openai", "input": 5, "output": 30, "cacheRead": 0.5, "longContext": { "aboveInputTokens": 272000, "input": 10, "output": 45, "cacheRead": 1 } },
|
|
35
|
+
"gpt-5.6-terra": { "provider": "openai", "input": 2, "output": 12, "cacheRead": 0.2, "longContext": { "aboveInputTokens": 272000, "input": 4, "output": 18, "cacheRead": 0.4 } },
|
|
36
|
+
"gpt-5.6-luna": { "provider": "openai", "input": 0.2, "output": 1.2, "cacheRead": 0.02, "longContext": { "aboveInputTokens": 272000, "input": 0.4, "output": 1.8, "cacheRead": 0.04 } },
|
|
37
|
+
"gpt-5.5": { "provider": "openai", "input": 5, "output": 30, "cacheRead": 0.5, "longContext": { "aboveInputTokens": 272000, "input": 10, "output": 45, "cacheRead": 1 } },
|
|
38
|
+
"gpt-5.5-pro": { "provider": "openai", "input": 30, "output": 180, "longContext": { "aboveInputTokens": 272000, "input": 60, "output": 270 } },
|
|
39
|
+
"gpt-5.4": { "provider": "openai", "input": 2.5, "output": 15, "cacheRead": 0.25, "longContext": { "aboveInputTokens": 272000, "input": 5, "output": 22.5, "cacheRead": 0.5 } },
|
|
40
|
+
"gpt-5.4-pro": { "provider": "openai", "input": 30, "output": 180, "longContext": { "aboveInputTokens": 272000, "input": 60, "output": 270 } },
|
|
41
|
+
"gpt-5.4-mini": { "provider": "openai", "input": 0.75, "output": 4.5, "cacheRead": 0.075 },
|
|
42
|
+
"gpt-5.4-nano": { "provider": "openai", "input": 0.2, "output": 1.25, "cacheRead": 0.02 },
|
|
43
|
+
"gpt-5.2": { "provider": "openai", "input": 1.75, "output": 14, "cacheRead": 0.175 },
|
|
44
|
+
"gpt-5.2-pro": { "provider": "openai", "input": 21, "output": 168 },
|
|
45
|
+
"gpt-5.1": { "provider": "openai", "input": 1.25, "output": 10, "cacheRead": 0.125 },
|
|
46
|
+
"gpt-5": { "provider": "openai", "input": 1.25, "output": 10, "cacheRead": 0.125 },
|
|
47
|
+
"gpt-5-mini": { "provider": "openai", "input": 0.25, "output": 2, "cacheRead": 0.025 },
|
|
48
|
+
"gpt-5-nano": { "provider": "openai", "input": 0.05, "output": 0.4, "cacheRead": 0.005 },
|
|
49
|
+
"gpt-5-pro": { "provider": "openai", "input": 15, "output": 120 },
|
|
50
|
+
"gpt-4.1": { "provider": "openai", "input": 2, "output": 8, "cacheRead": 0.5 },
|
|
51
|
+
"gpt-4.1-mini": { "provider": "openai", "input": 0.4, "output": 1.6, "cacheRead": 0.1 },
|
|
52
|
+
"gpt-4o": { "provider": "openai", "input": 2.5, "output": 10, "cacheRead": 1.25 },
|
|
53
|
+
"gpt-4o-mini": { "provider": "openai", "input": 0.15, "output": 0.6, "cacheRead": 0.075 },
|
|
54
|
+
"o3-pro": { "provider": "openai", "input": 20, "output": 80 },
|
|
55
|
+
"o3": { "provider": "openai", "input": 2, "output": 8, "cacheRead": 0.5 }
|
|
56
|
+
}
|
|
57
|
+
}
|