@opencompress/openclaw 3.0.7 → 3.0.8

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 +27 -17
  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.7";
9
+ var VERSION = "3.0.8";
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";
@@ -63,23 +63,33 @@ function resolveUpstream(modelId, providers) {
63
63
  return null;
64
64
  }
65
65
  const slashIdx = stripped.indexOf("/");
66
- if (slashIdx === -1) {
67
- const config2 = providers[stripped];
68
- if (config2) {
69
- return {
70
- upstreamProvider: stripped,
71
- upstreamModel: config2.models?.[0]?.id || stripped,
72
- upstreamKey: config2.apiKey,
73
- upstreamBaseUrl: config2.baseUrl,
74
- upstreamApi: config2.api || "openai-completions"
75
- };
66
+ let upstreamProvider;
67
+ let upstreamModel;
68
+ if (slashIdx !== -1) {
69
+ upstreamProvider = stripped.slice(0, slashIdx);
70
+ upstreamModel = stripped.slice(slashIdx + 1);
71
+ } else {
72
+ const knownProviders = ["anthropic", "openai", "google", "xai", "deepseek"];
73
+ const matched = knownProviders.find((p) => stripped.startsWith(p + "-"));
74
+ if (matched) {
75
+ upstreamProvider = matched;
76
+ upstreamModel = stripped.slice(matched.length + 1);
77
+ } else {
78
+ const config2 = providers[stripped];
79
+ if (config2) {
80
+ return {
81
+ upstreamProvider: stripped,
82
+ upstreamModel: config2.models?.[0]?.id || stripped,
83
+ upstreamKey: config2.apiKey,
84
+ upstreamBaseUrl: config2.baseUrl,
85
+ upstreamApi: config2.api || "openai-completions"
86
+ };
87
+ }
88
+ const builtin2 = resolveBuiltin(stripped);
89
+ if (builtin2) return builtin2;
90
+ return null;
76
91
  }
77
- const builtin2 = resolveBuiltin(stripped);
78
- if (builtin2) return builtin2;
79
- return null;
80
92
  }
81
- const upstreamProvider = stripped.slice(0, slashIdx);
82
- const upstreamModel = stripped.slice(slashIdx + 1);
83
93
  const config = providers[upstreamProvider];
84
94
  if (config) {
85
95
  return {
@@ -514,7 +524,7 @@ function injectConfig(api) {
514
524
  }
515
525
  ];
516
526
  for (const modelId of existingModels) {
517
- const compressedId = `opencompress/${modelId}`;
527
+ const compressedId = `opencompress/${modelId.replace("/", "-")}`;
518
528
  const provider = modelId.split("/")[0];
519
529
  const modelApi = provider === "anthropic" ? "anthropic-messages" : "openai-completions";
520
530
  const modelName = modelId.split("/").slice(1).join("/");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencompress/openclaw",
3
- "version": "3.0.7",
3
+ "version": "3.0.8",
4
4
  "description": "OpenCompress for OpenClaw — save tokens and sharpen quality on any LLM",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",