Skip to content

Commit 8c5ed67

Browse files
committed
fix: recognize 'auto' model when OpenClaw strips prefix
1 parent b2e1767 commit 8c5ed67

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@blockrun/clawrouter",
3-
"version": "0.3.17",
3+
"version": "0.3.19",
44
"description": "Smart LLM router — save 78% on inference costs. 30+ models, one wallet, x402 micropayments.",
55
"type": "module",
66
"main": "dist/index.js",

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ const plugin: OpenClawPluginDefinition = {
238238
id: "clawrouter",
239239
name: "ClawRouter",
240240
description: "Smart LLM router — 30+ models, x402 micropayments, 78% cost savings",
241-
version: "0.3.17",
241+
version: "0.3.19",
242242

243243
register(api: OpenClawPluginApi) {
244244
// Skip heavy initialization in completion mode — only completion script is needed

src/proxy.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ import { InsufficientFundsError, EmptyWalletError } from "./errors.js";
4141

4242
const BLOCKRUN_API = "https://blockrun.ai/api";
4343
const AUTO_MODEL = "blockrun/auto";
44-
const USER_AGENT = "clawrouter/0.3.5";
44+
const AUTO_MODEL_SHORT = "auto"; // OpenClaw strips provider prefix
45+
const USER_AGENT = "clawrouter/0.3.19";
4546
const HEARTBEAT_INTERVAL_MS = 2_000;
4647
const DEFAULT_REQUEST_TIMEOUT_MS = 180_000; // 3 minutes (allows for on-chain tx + LLM response)
4748
const DEFAULT_PORT = 8402;
@@ -307,7 +308,7 @@ async function proxyRequest(
307308
modelId = (parsed.model as string) || "";
308309
maxTokens = (parsed.max_tokens as number) || 4096;
309310

310-
if (parsed.model === AUTO_MODEL) {
311+
if (parsed.model === AUTO_MODEL || parsed.model === AUTO_MODEL_SHORT) {
311312
// Extract prompt from messages
312313
type ChatMessage = { role: string; content: string };
313314
const messages = parsed.messages as ChatMessage[] | undefined;

0 commit comments

Comments
 (0)