@relayplane/proxy 1.8.2 → 1.8.4
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 +61 -5
- package/dist/cli.js +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -271,9 +271,10 @@ Use your Anthropic MAX subscription token for expensive models (Opus) while usin
|
|
|
271
271
|
|
|
272
272
|
**How it works:**
|
|
273
273
|
|
|
274
|
-
- When a request targets a model matching any pattern in `useMaxForModels`, the proxy uses `anthropicMaxToken`
|
|
274
|
+
- When a request targets a model matching any pattern in `useMaxForModels`, the proxy uses `anthropicMaxToken` via `x-api-key` header
|
|
275
275
|
- All other Anthropic requests use the standard `ANTHROPIC_API_KEY` env var with `x-api-key` header
|
|
276
|
-
- Pattern matching is case-insensitive substring match
|
|
276
|
+
- Pattern matching is case-insensitive substring match, so `"opus"` matches `claude-opus-4-20250514`
|
|
277
|
+
- Both `sk-ant-api*` and `sk-ant-oat*` tokens are sent as `x-api-key` (Anthropic accepts all token types via this header)
|
|
277
278
|
|
|
278
279
|
Set your standard key in the environment as usual:
|
|
279
280
|
|
|
@@ -356,11 +357,66 @@ When content logging is enabled, the dashboard stores and displays:
|
|
|
356
357
|
|
|
357
358
|
This makes it easy to correlate a cost spike with the actual request that caused it. Content is stored locally only — nothing is sent to RelayPlane servers.
|
|
358
359
|
|
|
359
|
-
###
|
|
360
|
+
### Auth Passthrough (Claude Max / OpenClaw Users)
|
|
360
361
|
|
|
361
|
-
If you use a Claude Max subscription
|
|
362
|
+
If you use a Claude Max subscription (tokens starting with `sk-ant-oat*`), the proxy handles them correctly via the `x-api-key` header. No special configuration needed. The proxy also forwards `user-agent` and `x-app` headers required by Anthropic for subscription validation.
|
|
362
363
|
|
|
363
|
-
|
|
364
|
+
**Important:** All Anthropic token types (`sk-ant-api*` and `sk-ant-oat*`) are sent via `x-api-key`. The proxy does not use `Authorization: Bearer` for Anthropic requests.
|
|
365
|
+
|
|
366
|
+
## OpenClaw Integration
|
|
367
|
+
|
|
368
|
+
The simplest way to use RelayPlane with OpenClaw is to point the Anthropic provider at the proxy. This routes all Anthropic model requests through RelayPlane transparently, with no changes to model names or agent configs.
|
|
369
|
+
|
|
370
|
+
### Setup
|
|
371
|
+
|
|
372
|
+
1. Install and start the proxy:
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
npm install -g @relayplane/proxy
|
|
376
|
+
relayplane init
|
|
377
|
+
relayplane start
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
2. Point OpenClaw's Anthropic provider at the proxy:
|
|
381
|
+
|
|
382
|
+
```bash
|
|
383
|
+
openclaw config set models.providers.anthropic.baseUrl http://localhost:4100
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
That's it. All `anthropic/*` model requests now flow through RelayPlane. Your existing model names (`anthropic/claude-sonnet-4-6`, `anthropic/claude-opus-4-6`) work unchanged.
|
|
387
|
+
|
|
388
|
+
### What you get
|
|
389
|
+
|
|
390
|
+
- **Cost tracking** per agent, per model, per day
|
|
391
|
+
- **Complexity-based routing** (e.g., simple tasks use Sonnet, complex tasks use Opus)
|
|
392
|
+
- **Budget enforcement** with automatic downgrades
|
|
393
|
+
- **Dashboard** at http://localhost:4100
|
|
394
|
+
|
|
395
|
+
### Complexity routing example
|
|
396
|
+
|
|
397
|
+
Configure the proxy to automatically route simple tasks to Sonnet and complex tasks to Opus:
|
|
398
|
+
|
|
399
|
+
```json
|
|
400
|
+
{
|
|
401
|
+
"routing": {
|
|
402
|
+
"mode": "complexity",
|
|
403
|
+
"complexity": {
|
|
404
|
+
"enabled": true,
|
|
405
|
+
"simple": "claude-sonnet-4-6",
|
|
406
|
+
"moderate": "claude-sonnet-4-6",
|
|
407
|
+
"complex": "claude-opus-4-6"
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
OpenClaw agents request whatever model they're configured with. The proxy classifies the task and routes accordingly. No agent config changes needed.
|
|
414
|
+
|
|
415
|
+
### Auth
|
|
416
|
+
|
|
417
|
+
The proxy passes through whatever API key OpenClaw sends. If you use a MAX subscription, OpenClaw sends your `sk-ant-oat*` token and the proxy forwards it directly to Anthropic. No extra auth configuration in the proxy is needed for passthrough mode.
|
|
418
|
+
|
|
419
|
+
For hybrid auth (MAX token for expensive models, standard key for cheap ones), see [Hybrid Auth](#hybrid-auth).
|
|
364
420
|
|
|
365
421
|
### API Endpoints
|
|
366
422
|
|
package/dist/cli.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@relayplane/proxy",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.4",
|
|
4
4
|
"description": "Open source cost intelligence proxy for AI agents. Cut LLM costs ~80% with smart model routing. Dashboard, policy engine, 11 providers. MIT licensed.",
|
|
5
5
|
"homepage": "https://relayplane.com",
|
|
6
6
|
"repository": {
|