openclaw-freerouter 2.0.1 → 2.0.2

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 CHANGED
@@ -7,6 +7,7 @@
7
7
  - 🔥 **Wasted money** — Running Claude Opus ($15/$75 per 1M tokens) for every message, even "what's 2+2?"
8
8
  - 🤷 **No control** — Can't switch models mid-conversation without editing config files and restarting
9
9
  - 📊 **Blind routing** — Your AI shows "freerouter/auto" instead of telling you which model actually answered
10
+ - 🧠 **No adaptive thinking** — OpenClaw's built-in thinking levels (`/think low`, `/think high`) are just prompt hints. Anthropic deprecated manual thinking for Opus 4.6 — it now requires the native `thinking: { type: "adaptive" }` API parameter, which OpenClaw doesn't send
10
11
  - 🔧 **Complex setup** — Existing routers need separate servers, Docker, complex infra
11
12
 
12
13
  ## The Solution
@@ -14,6 +15,7 @@
14
15
  FreeRouter is an OpenClaw plugin that:
15
16
  - **Classifies every request in <1ms** using a 14-dimension weighted scorer (no LLM needed for classification)
16
17
  - **Routes to the cheapest model that can handle it** — Kimi for "hello", Opus for architecture design
18
+ - **Sends native adaptive thinking** — Automatically passes `thinking: { type: "adaptive" }` to Anthropic's API for Opus 4.6, and `thinking: { type: "enabled", budget_tokens: N }` for Sonnet. No prompt hacks — real API-level thinking control that OpenClaw doesn't support natively
17
19
  - **Reports the real model name** — You see `anthropic/claude-opus-4-6`, not `freerouter/auto`
18
20
  - **Lets you override anytime** — Just say "use opus" in plain English
19
21
 
@@ -100,6 +102,36 @@ This prevents accidental switches when you're just talking *about* a model.
100
102
  | `haiku`, `haiku-4`, `haiku-4.5` | anthropic/claude-haiku-4-5 |
101
103
  | `kimi`, `kimi-k2`, `k2.5` | kimi-coding/kimi-for-coding |
102
104
 
105
+ ## Adaptive Thinking (Native API-Level)
106
+
107
+ This is a key reason FreeRouter exists.
108
+
109
+ **The problem:** OpenClaw's built-in `/think low|medium|high` commands are prompt-level hints — they add text like "think harder" to your prompt. This is unreliable and doesn't use Anthropic's actual thinking API. Worse, **Anthropic deprecated manual thinking (`type: "enabled"`) for Opus 4.6** — it now only supports `type: "adaptive"`, where the model decides how much to think based on the task.
110
+
111
+ **What FreeRouter does:** Sends the real `thinking` parameter directly to Anthropic's API:
112
+
113
+ | Model | Thinking Mode | What's Sent |
114
+ |---|---|---|
115
+ | Claude Opus 4.6 | **Adaptive** (always) | `thinking: { type: "adaptive" }` |
116
+ | Claude Sonnet 4.5 | Enabled with budget | `thinking: { type: "enabled", budget_tokens: 4096 }` |
117
+ | Others (Kimi, Haiku) | Off | No thinking parameter |
118
+
119
+ **Why this matters:**
120
+ - Adaptive thinking lets Opus 4.6 decide how much reasoning it needs — simple questions get quick answers, complex proofs get deep thinking chains
121
+ - You get the full benefit of Claude's extended thinking without managing budgets
122
+ - The `X-FreeRouter-Thinking` response header tells you exactly which thinking mode was used
123
+
124
+ Configure in your plugin config:
125
+ ```json5
126
+ "thinking": {
127
+ "adaptive": ["claude-opus-4-6"], // Models that use adaptive (always-on)
128
+ "enabled": {
129
+ "models": ["claude-sonnet-4-5"], // Models that get explicit thinking
130
+ "budget": 4096 // Token budget for thinking
131
+ }
132
+ }
133
+ ```
134
+
103
135
  ## How Routing Works
104
136
 
105
137
  1. You send a message → OpenClaw forwards to FreeRouter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-freerouter",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Smart LLM router plugin for OpenClaw — classify requests and route to the best model using your own API keys. 14-dimension scoring, <1ms classification, per-prompt/session model switching.",
5
5
  "type": "module",
6
6
  "openclaw": {
package/src/service.ts CHANGED
@@ -624,11 +624,15 @@ export function createProxyServer(options: ProxyOptions): { server: Server; stat
624
624
  }
625
625
 
626
626
  // Determine thinking mode
627
+ // Opus 4.6 REQUIRES adaptive thinking — manual mode is deprecated by Anthropic
628
+ // Other models can use enabled(budget) for explicit thinking control
627
629
  const thinkingCfg = pluginConfig.thinking as any;
628
630
  const adaptivePatterns = thinkingCfg?.adaptive ?? ["claude-opus-4-6"];
629
631
  const enabledCfg = thinkingCfg?.enabled;
630
632
 
631
- if (adaptivePatterns.some((p: string) => routedModel.includes(p)) && (tier === "COMPLEX" || tier === "REASONING")) {
633
+ if (adaptivePatterns.some((p: string) => routedModel.includes(p))) {
634
+ // Adaptive thinking models (e.g., Opus 4.6) — always use adaptive
635
+ // Anthropic deprecated manual thinking for Opus 4.6
632
636
  thinkingMode = "adaptive";
633
637
  } else if (enabledCfg?.models?.some((p: string) => routedModel.includes(p))) {
634
638
  thinkingMode = `enabled(${enabledCfg.budget ?? 4096})`;