@openclaw/synthetic-provider 2026.8.1-beta.3 → 2026.8.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/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SYNTHETIC_DEFAULT_MODEL_REF } from "./models.js";
2
2
  import { applySyntheticConfig } from "./onboard.js";
3
- import { buildSyntheticProvider } from "./provider-catalog.js";
3
+ import { SYNTHETIC_MODEL_DISCOVERY, buildSyntheticProvider } from "./provider-catalog.js";
4
4
  import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
5
5
  var synthetic_default = defineSingleProviderPluginEntry({
6
6
  id: "synthetic",
@@ -11,6 +11,7 @@ var synthetic_default = defineSingleProviderPluginEntry({
11
11
  activation: { "onStartup": false },
12
12
  enabledByDefault: true,
13
13
  providers: ["synthetic"],
14
+ modelCatalog: { "discovery": { "synthetic": "refreshable" } },
14
15
  setup: { "providers": [{
15
16
  "id": "synthetic",
16
17
  "envVars": ["SYNTHETIC_API_KEY"]
@@ -42,7 +43,12 @@ var synthetic_default = defineSingleProviderPluginEntry({
42
43
  defaultModel: SYNTHETIC_DEFAULT_MODEL_REF,
43
44
  applyConfig: applySyntheticConfig
44
45
  },
45
- catalog: { buildProvider: buildSyntheticProvider }
46
+ catalog: {
47
+ buildProvider: buildSyntheticProvider,
48
+ buildStaticProvider: buildSyntheticProvider,
49
+ allowExplicitBaseUrl: true,
50
+ liveModelDiscovery: SYNTHETIC_MODEL_DISCOVERY
51
+ }
46
52
  }
47
53
  });
48
54
  //#endregion
@@ -1,4 +1,5 @@
1
1
  import { SYNTHETIC_BASE_URL, SYNTHETIC_MODEL_CATALOG, buildSyntheticModelDefinition } from "./models.js";
2
+ import { asOptionalRecord, asPositiveSafeInteger, filterStringEntries, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
2
3
  //#region extensions/synthetic/provider-catalog.ts
3
4
  function buildSyntheticProvider() {
4
5
  return {
@@ -7,5 +8,52 @@ function buildSyntheticProvider() {
7
8
  models: SYNTHETIC_MODEL_CATALOG.map(buildSyntheticModelDefinition)
8
9
  };
9
10
  }
11
+ function readTokenPrice(value) {
12
+ const raw = normalizeOptionalString(value)?.replace(/^\$/, "");
13
+ const price = raw ? Number(raw) * 1e6 : NaN;
14
+ return Number.isFinite(price) && price >= 0 ? Number(price.toFixed(9)) : void 0;
15
+ }
16
+ function projectSyntheticModels(rows, fallback) {
17
+ const seeds = new Map(fallback.models.map((model) => [model.id, model]));
18
+ const models = /* @__PURE__ */ new Map();
19
+ for (const row of rows) {
20
+ const record = asOptionalRecord(row);
21
+ const id = normalizeOptionalString(record?.id);
22
+ const contextWindow = asPositiveSafeInteger(record?.context_length);
23
+ const input = filterStringEntries(record?.input_modalities);
24
+ if (!record || !id || id.length > 512 || /[\s\p{Cc}]/u.test(id) || !contextWindow || !input.includes("text") || !filterStringEntries(record.output_modalities).includes("text") || record.deprecated === true || record.active === false) continue;
25
+ const seed = seeds.get(id);
26
+ const features = filterStringEntries(record.supported_features);
27
+ const efforts = filterStringEntries(asOptionalRecord(record.reasoning_parameters)?.efforts);
28
+ const pricing = asOptionalRecord(record.pricing);
29
+ models.set(id, {
30
+ ...seed,
31
+ id,
32
+ name: normalizeOptionalString(record.name) ?? id,
33
+ reasoning: features.includes("reasoning") || efforts.some((effort) => effort !== "none"),
34
+ input: input.includes("image") ? ["text", "image"] : ["text"],
35
+ contextWindow,
36
+ maxTokens: Math.min(asPositiveSafeInteger(record.max_output_length) ?? seed?.maxTokens ?? 8192, contextWindow),
37
+ cost: {
38
+ input: readTokenPrice(pricing?.prompt) ?? seed?.cost.input ?? 0,
39
+ output: readTokenPrice(pricing?.completion) ?? seed?.cost.output ?? 0,
40
+ cacheRead: readTokenPrice(pricing?.input_cache_reads) ?? seed?.cost.cacheRead ?? 0,
41
+ cacheWrite: readTokenPrice(pricing?.input_cache_writes) ?? seed?.cost.cacheWrite ?? 0
42
+ },
43
+ ...Array.isArray(record.supported_features) ? { compat: {
44
+ ...seed?.compat,
45
+ supportsTools: features.includes("tools")
46
+ } } : {}
47
+ });
48
+ }
49
+ return [...models.values()].toSorted((a, b) => a.id.localeCompare(b.id));
50
+ }
51
+ const SYNTHETIC_MODEL_DISCOVERY = {
52
+ endpointUrl: {
53
+ url: "https://api.synthetic.new/openai/v1/models",
54
+ requireBaseUrl: SYNTHETIC_BASE_URL
55
+ },
56
+ projectRows: projectSyntheticModels
57
+ };
10
58
  //#endregion
11
- export { buildSyntheticProvider };
59
+ export { SYNTHETIC_MODEL_DISCOVERY, buildSyntheticProvider };
@@ -5,6 +5,11 @@
5
5
  },
6
6
  "enabledByDefault": true,
7
7
  "providers": ["synthetic"],
8
+ "modelCatalog": {
9
+ "discovery": {
10
+ "synthetic": "refreshable"
11
+ }
12
+ },
8
13
  "setup": {
9
14
  "providers": [
10
15
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/synthetic-provider",
3
- "version": "2026.8.1-beta.3",
3
+ "version": "2026.8.2",
4
4
  "description": "OpenClaw Synthetic provider plugin.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,10 +18,10 @@
18
18
  "minHostVersion": ">=2026.7.2"
19
19
  },
20
20
  "compat": {
21
- "pluginApi": ">=2026.8.1-beta.3"
21
+ "pluginApi": ">=2026.8.2"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.8.1-beta.3",
24
+ "openclawVersion": "2026.8.2",
25
25
  "bundledDist": false
26
26
  },
27
27
  "release": {
@@ -38,7 +38,7 @@
38
38
  "README.md"
39
39
  ],
40
40
  "peerDependencies": {
41
- "openclaw": ">=2026.8.1-beta.3"
41
+ "openclaw": ">=2026.8.2"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "openclaw": {