clawtamer 0.1.1
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/README.md +114 -0
- package/bin/clawtamer.js +1205 -0
- package/package.json +21 -0
- package/plugin/index.js +164 -0
- package/plugin/openclaw.plugin.json +8 -0
- package/src/config.js +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Clawtamer
|
|
2
|
+
|
|
3
|
+
Reduce your OpenClaw costs by up to 90%. Clawtamer is the cost-control layer for OpenClaw.
|
|
4
|
+
|
|
5
|
+
It reduces spend by combining three things:
|
|
6
|
+
- request compression
|
|
7
|
+
- complexity-aware model routing
|
|
8
|
+
- prompt cashing
|
|
9
|
+
|
|
10
|
+
Clawtamer helps keep model quality where it matters while cutting waste where it does not.
|
|
11
|
+
|
|
12
|
+
## Why ClawTamer?
|
|
13
|
+
|
|
14
|
+
- Every proxied response includes cost/savings headers.
|
|
15
|
+
- Routing behavior is explicit (`simple`, `mid`, `complex`, `reasoning`).
|
|
16
|
+
- Setup prioritizes safety:
|
|
17
|
+
- preflight before activation
|
|
18
|
+
- staged install fallback
|
|
19
|
+
- auto-rollback when health checks fail
|
|
20
|
+
- Restore is reversible (`npx clawtamer restore`).
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx clawtamer init
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Recommended onboarding order:
|
|
29
|
+
1. Sign in with Google at https://www.clawtamer.ai/login
|
|
30
|
+
2. Open Dashboard and reveal/copy your Clawtamer API key
|
|
31
|
+
3. Run `npx clawtamer init` in your OpenClaw workspace
|
|
32
|
+
|
|
33
|
+
The setup flow will:
|
|
34
|
+
1. Register or connect your Clawtamer account
|
|
35
|
+
2. Link your Anthropic upstream key
|
|
36
|
+
3. Add Clawtamer provider config to OpenClaw
|
|
37
|
+
4. Set `clawtamer/auto` with preserved fallbacks
|
|
38
|
+
|
|
39
|
+
## Request Path
|
|
40
|
+
|
|
41
|
+
OpenClaw -> Clawtamer -> LLM API
|
|
42
|
+
|
|
43
|
+
Per request:
|
|
44
|
+
1. Input prompt is normalized/compressed
|
|
45
|
+
2. Complexity is scored
|
|
46
|
+
3. Route target is selected
|
|
47
|
+
4. Savings metadata is returned with the response
|
|
48
|
+
|
|
49
|
+
## Response Headers
|
|
50
|
+
|
|
51
|
+
Clawtamer adds:
|
|
52
|
+
|
|
53
|
+
- `x-clawtamer-baseline-model`
|
|
54
|
+
- `x-clawtamer-routed-model`
|
|
55
|
+
- `x-clawtamer-original-input-tokens`
|
|
56
|
+
- `x-clawtamer-compressed-input-tokens`
|
|
57
|
+
- `x-clawtamer-compression-ratio`
|
|
58
|
+
- `x-clawtamer-baseline-cost-usd`
|
|
59
|
+
- `x-clawtamer-actual-cost-usd`
|
|
60
|
+
- `x-clawtamer-saved-usd`
|
|
61
|
+
- `x-clawtamer-route-reason`
|
|
62
|
+
- `x-clawtamer-request-id`
|
|
63
|
+
|
|
64
|
+
## CLI
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npx clawtamer init # Setup + patch OpenClaw config
|
|
68
|
+
npx clawtamer test # Send a verification request through proxy
|
|
69
|
+
npx clawtamer savings # Savings snapshot
|
|
70
|
+
npx clawtamer savings 30d # Savings for last 30 days
|
|
71
|
+
npx clawtamer savings lifetime # Lifetime savings
|
|
72
|
+
npx clawtamer status # Local config + remote account status
|
|
73
|
+
npx clawtamer doctor # Diagnostic checks
|
|
74
|
+
npx clawtamer store-key # Replace upstream Anthropic key
|
|
75
|
+
npx clawtamer restore # Remove patch and restore prior defaults
|
|
76
|
+
npx clawtamer remove # Alias for restore
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Init Safety Behavior
|
|
80
|
+
|
|
81
|
+
`init` is intentionally defensive:
|
|
82
|
+
|
|
83
|
+
- Runs proxy preflight before switching default model.
|
|
84
|
+
- If preflight fails, leaves install in staged mode (provider added, primary unchanged).
|
|
85
|
+
- Runs post-install verification and auto-reverts activation if health fails.
|
|
86
|
+
- Supports dry run with `--dry-run`.
|
|
87
|
+
- Supports force activation with `--activate` (manual override).
|
|
88
|
+
|
|
89
|
+
## Common Flags
|
|
90
|
+
|
|
91
|
+
- `--email <email>`: account email for `init`
|
|
92
|
+
- `--new-user`: force signup path
|
|
93
|
+
- `--existing-user`: skip signup and use existing Clawtamer API key flow
|
|
94
|
+
- `--proxy-key <key>`: explicit Clawtamer key (`sk-cltm-*`)
|
|
95
|
+
- `--upstream-key <key>`: explicit Anthropic key (`sk-ant-*`)
|
|
96
|
+
- `--key <key>`: compatibility key flag (context-dependent)
|
|
97
|
+
- `--skip-install-test`: skip post-install test
|
|
98
|
+
- `--api-base <url>`: override backend API base
|
|
99
|
+
- `--dir <path>`: override OpenClaw root directory
|
|
100
|
+
- `--yes, -y`: auto-confirm prompts
|
|
101
|
+
- `--verbose`: extra diagnostic output
|
|
102
|
+
- `--dry-run`: run checks without editing `openclaw.json`
|
|
103
|
+
- `--activate`: force primary switch even if preflight fails
|
|
104
|
+
|
|
105
|
+
## Requirements
|
|
106
|
+
|
|
107
|
+
- Node.js 22
|
|
108
|
+
- OpenClaw installed
|
|
109
|
+
- Anthropic API key
|
|
110
|
+
|
|
111
|
+
## Links
|
|
112
|
+
|
|
113
|
+
- Website: https://www.clawtamer.ai
|
|
114
|
+
- Dashboard: https://www.clawtamer.ai/dashboard
|