@opencompress/openclaw 3.0.2 → 3.0.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.
Files changed (2) hide show
  1. package/dist/index.js +17 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
6
6
  });
7
7
 
8
8
  // src/config.ts
9
- var VERSION = "3.0.2";
9
+ var VERSION = "3.0.4";
10
10
  var PROXY_PORT = 8401;
11
11
  var PROXY_HOST = "127.0.0.1";
12
12
  var OCC_API = "https://www.opencompress.ai/api";
@@ -14,11 +14,11 @@ var PROVIDER_ID = "opencompress";
14
14
 
15
15
  // src/models.ts
16
16
  var BUILTIN_PROVIDERS = {
17
- anthropic: { baseUrl: "https://api.anthropic.com", api: "anthropic-messages", envVar: "ANTHROPIC_API_KEY" },
18
- openai: { baseUrl: "https://api.openai.com", api: "openai-completions", envVar: "OPENAI_API_KEY" },
19
- google: { baseUrl: "https://generativelanguage.googleapis.com", api: "google-generative-ai", envVar: "GOOGLE_API_KEY" },
20
- xai: { baseUrl: "https://api.x.ai", api: "openai-completions", envVar: "XAI_API_KEY" },
21
- deepseek: { baseUrl: "https://api.deepseek.com", api: "openai-completions", envVar: "DEEPSEEK_API_KEY" }
17
+ anthropic: { baseUrl: "https://api.anthropic.com", api: "anthropic-messages", envVar: "ANTHROPIC_API_KEY", defaultModel: "claude-sonnet-4-20250514" },
18
+ openai: { baseUrl: "https://api.openai.com", api: "openai-completions", envVar: "OPENAI_API_KEY", defaultModel: "gpt-4o" },
19
+ google: { baseUrl: "https://generativelanguage.googleapis.com", api: "google-generative-ai", envVar: "GOOGLE_API_KEY", defaultModel: "gemini-2.0-flash" },
20
+ xai: { baseUrl: "https://api.x.ai", api: "openai-completions", envVar: "XAI_API_KEY", defaultModel: "grok-3" },
21
+ deepseek: { baseUrl: "https://api.deepseek.com", api: "openai-completions", envVar: "DEEPSEEK_API_KEY", defaultModel: "deepseek-chat" }
22
22
  };
23
23
  function resolveBuiltin(providerId) {
24
24
  const builtin = BUILTIN_PROVIDERS[providerId];
@@ -27,8 +27,7 @@ function resolveBuiltin(providerId) {
27
27
  if (!key) return null;
28
28
  return {
29
29
  upstreamProvider: providerId,
30
- upstreamModel: "",
31
- // caller must set
30
+ upstreamModel: builtin.defaultModel,
32
31
  upstreamKey: key,
33
32
  upstreamBaseUrl: builtin.baseUrl,
34
33
  upstreamApi: builtin.api
@@ -54,8 +53,7 @@ function resolveUpstream(modelId, providers) {
54
53
  if (key) {
55
54
  return {
56
55
  upstreamProvider: id,
57
- upstreamModel: "",
58
- // OpenClaw will set the actual model
56
+ upstreamModel: builtin2.defaultModel,
59
57
  upstreamKey: key,
60
58
  upstreamBaseUrl: builtin2.baseUrl,
61
59
  upstreamApi: builtin2.api
@@ -132,7 +130,7 @@ function startProxy(getProviders2, getOccKey) {
132
130
  server = http.createServer(async (req, res) => {
133
131
  if (req.url === "/health" && req.method === "GET") {
134
132
  res.writeHead(200, { "Content-Type": "application/json" });
135
- res.end(JSON.stringify({ status: "ok", version: "2.0.0" }));
133
+ res.end(JSON.stringify({ status: "ok", version: VERSION }));
136
134
  return;
137
135
  }
138
136
  if (req.url === "/provision" && req.method === "POST") {
@@ -304,6 +302,14 @@ function startProxy(getProviders2, getOccKey) {
304
302
  server.on("error", (err) => {
305
303
  if (err.code === "EADDRINUSE") {
306
304
  server = null;
305
+ try {
306
+ const { execSync } = __require("child_process");
307
+ execSync(`lsof -i :${PROXY_PORT} -t | xargs kill -9 2>/dev/null`, { stdio: "ignore" });
308
+ } catch {
309
+ }
310
+ setTimeout(() => {
311
+ if (!server) startProxy(getProviders2, getOccKey);
312
+ }, 2e3);
307
313
  }
308
314
  });
309
315
  return server;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencompress/openclaw",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "OpenCompress for OpenClaw — save tokens and sharpen quality on any LLM",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",