@anjieyang/uncommon-route 0.2.7 → 0.2.9
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 +67 -26
- package/package.json +1 -1
- package/src/index.js +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
|
+
<p align="right"><strong>English</strong> | <a href="https://github.com/anjieyang/UncommonRoute/blob/main/README.zh-CN.md">简体中文</a></p>
|
|
2
|
+
|
|
1
3
|
# @anjieyang/uncommon-route
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
OpenClaw plugin for [UncommonRoute](https://github.com/anjieyang/UncommonRoute), the local LLM router that sends easy requests to cheaper models and saves stronger models for harder work.
|
|
6
|
+
|
|
7
|
+
If you use OpenClaw and want one local endpoint with smart routing behind it, this plugin is the shortest path.
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
## Mental Model
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
OpenClaw -> UncommonRoute -> your upstream API
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This plugin:
|
|
16
|
+
|
|
17
|
+
- installs the Python `uncommon-route` package if needed
|
|
18
|
+
- starts `uncommon-route serve`
|
|
19
|
+
- registers the local provider with OpenClaw
|
|
20
|
+
- exposes the virtual routing profiles like `uncommon-route/auto`
|
|
6
21
|
|
|
7
22
|
## Install
|
|
8
23
|
|
|
@@ -11,29 +26,15 @@ openclaw plugins install @anjieyang/uncommon-route
|
|
|
11
26
|
openclaw gateway restart
|
|
12
27
|
```
|
|
13
28
|
|
|
14
|
-
That
|
|
15
|
-
|
|
16
|
-
## What It Does
|
|
29
|
+
That is enough to install the plugin.
|
|
17
30
|
|
|
18
|
-
|
|
31
|
+
For real responses, you still need to configure an upstream model API.
|
|
19
32
|
|
|
20
|
-
|
|
21
|
-
- **Step-aware agentic routing** — different models for different steps in a workflow
|
|
22
|
-
- **Session persistence** — sticky model per task, auto-escalation on failure
|
|
23
|
-
- **Spend control** — per-request, hourly, daily, session limits
|
|
24
|
-
- **Dual protocol** — OpenAI (`/v1/chat/completions`) + Anthropic (`/v1/messages`)
|
|
33
|
+
## Configure An Upstream
|
|
25
34
|
|
|
26
|
-
|
|
35
|
+
UncommonRoute does not host models. It routes to an upstream OpenAI-compatible API.
|
|
27
36
|
|
|
28
|
-
|
|
29
|
-
|---|---|
|
|
30
|
-
| `/route <prompt>` | Preview which model would be selected |
|
|
31
|
-
| `/spend status` | View current spending and limits |
|
|
32
|
-
| `/spend set hourly 5.00` | Set an hourly spending limit |
|
|
33
|
-
| `/feedback ok\|weak\|strong` | Rate the last routing decision |
|
|
34
|
-
| `/sessions` | View active routing sessions |
|
|
35
|
-
|
|
36
|
-
## Configuration
|
|
37
|
+
Example plugin config:
|
|
37
38
|
|
|
38
39
|
```yaml
|
|
39
40
|
plugins:
|
|
@@ -46,21 +47,61 @@ plugins:
|
|
|
46
47
|
daily: 20.00
|
|
47
48
|
```
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Works with any OpenAI-compatible API:
|
|
50
|
+
Common upstream choices:
|
|
52
51
|
|
|
53
52
|
| Provider | URL |
|
|
54
53
|
|---|---|
|
|
54
|
+
| [Parallax](https://github.com/GradientHQ/parallax) | `http://127.0.0.1:3001/v1` |
|
|
55
55
|
| [Commonstack](https://commonstack.ai) | `https://api.commonstack.ai/v1` |
|
|
56
56
|
| OpenAI | `https://api.openai.com/v1` |
|
|
57
|
-
| Local
|
|
57
|
+
| Local Ollama / vLLM | `http://127.0.0.1:11434/v1` |
|
|
58
|
+
|
|
59
|
+
If your upstream needs a key, set `UNCOMMON_ROUTE_API_KEY` in the environment where OpenClaw runs.
|
|
60
|
+
|
|
61
|
+
Parallax is best treated as an experimental local upstream for now: its public docs show `POST /v1/chat/completions`, but UncommonRoute model discovery may be limited because a public `/v1/models` route was not obvious in the repo.
|
|
62
|
+
|
|
63
|
+
## What You Get
|
|
64
|
+
|
|
65
|
+
- `uncommon-route/auto` for balanced smart routing
|
|
66
|
+
- `uncommon-route/eco` for cheapest capable routing
|
|
67
|
+
- `uncommon-route/premium` for quality-first routing
|
|
68
|
+
- `uncommon-route/free` for free-first routing
|
|
69
|
+
- `uncommon-route/agentic` for tool-heavy workflows
|
|
70
|
+
|
|
71
|
+
The router also keeps a fallback chain, applies session-aware routing, and exposes a local dashboard at `http://127.0.0.1:8403/dashboard/`.
|
|
72
|
+
|
|
73
|
+
## OpenClaw Commands
|
|
74
|
+
|
|
75
|
+
| Command | Description |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `/route <prompt>` | Preview which model the router would pick |
|
|
78
|
+
| `/spend status` | Show current spending and limits |
|
|
79
|
+
| `/spend set hourly 5.00` | Set an hourly spend limit |
|
|
80
|
+
| `/feedback ok\|weak\|strong` | Rate the last routing decision |
|
|
81
|
+
| `/sessions` | Show active routing sessions |
|
|
82
|
+
|
|
83
|
+
## Troubleshooting
|
|
84
|
+
|
|
85
|
+
If the plugin is installed but responses are failing:
|
|
86
|
+
|
|
87
|
+
1. Make sure your upstream URL is configured.
|
|
88
|
+
2. Make sure `UNCOMMON_ROUTE_API_KEY` is set if your provider requires one.
|
|
89
|
+
3. Open `http://127.0.0.1:8403/health`.
|
|
90
|
+
4. Open `http://127.0.0.1:8403/dashboard/`.
|
|
91
|
+
|
|
92
|
+
## Benchmarks
|
|
93
|
+
|
|
94
|
+
Current repo benchmarks:
|
|
95
|
+
|
|
96
|
+
- 92.3% held-out routing accuracy
|
|
97
|
+
- ~0.5ms average routing latency
|
|
98
|
+
- 67% lower simulated cost than always using Claude Opus in a coding session
|
|
58
99
|
|
|
59
100
|
## Links
|
|
60
101
|
|
|
61
102
|
- [GitHub](https://github.com/anjieyang/UncommonRoute)
|
|
62
103
|
- [PyPI](https://pypi.org/project/uncommon-route/)
|
|
63
|
-
- [Full
|
|
104
|
+
- [Full README](https://github.com/anjieyang/UncommonRoute#readme)
|
|
64
105
|
|
|
65
106
|
## License
|
|
66
107
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { spawn, execSync } from "node:child_process";
|
|
17
17
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
18
18
|
|
|
19
|
-
const VERSION = "0.2.
|
|
19
|
+
const VERSION = "0.2.9";
|
|
20
20
|
const DEFAULT_PORT = 8403;
|
|
21
21
|
const DEFAULT_UPSTREAM = "";
|
|
22
22
|
const HEALTH_TIMEOUT_MS = 15_000;
|