@openclaw/baseten-provider 2026.7.2-beta.4 → 2026.7.2-beta.7

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/api.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as buildBasetenModelCompat, c as discoverBasetenModels, d as usesBasetenChatTemplateThinking, i as BASETEN_MODEL_CATALOG, l as projectBasetenLiveModels, n as BASETEN_DEFAULT_MODEL_ID, o as buildBasetenModelDefinition, r as BASETEN_DEFAULT_MODEL_REF, s as buildStaticBasetenModels, t as BASETEN_BASE_URL, u as resolveBasetenDynamicModel } from "./models-Dg5jGc7M.js";
1
+ import { a as buildBasetenModelCompat, c as resolveBasetenDynamicModel, i as BASETEN_MODEL_CATALOG, l as usesBasetenChatTemplateThinking, n as BASETEN_DEFAULT_MODEL_ID, o as buildStaticBasetenModels, r as BASETEN_DEFAULT_MODEL_REF, t as BASETEN_BASE_URL } from "./models-BXC6b2FZ.js";
2
2
  import { applyBasetenConfig } from "./onboard.js";
3
- import { buildBasetenProvider, buildStaticBasetenProvider } from "./provider-catalog.js";
4
- export { BASETEN_BASE_URL, BASETEN_DEFAULT_MODEL_ID, BASETEN_DEFAULT_MODEL_REF, BASETEN_MODEL_CATALOG, applyBasetenConfig, buildBasetenModelCompat, buildBasetenModelDefinition, buildBasetenProvider, buildStaticBasetenModels, buildStaticBasetenProvider, discoverBasetenModels, projectBasetenLiveModels, resolveBasetenDynamicModel, usesBasetenChatTemplateThinking };
3
+ import { buildStaticBasetenProvider } from "./provider-catalog.js";
4
+ export { BASETEN_BASE_URL, BASETEN_DEFAULT_MODEL_ID, BASETEN_DEFAULT_MODEL_REF, BASETEN_MODEL_CATALOG, applyBasetenConfig, buildBasetenModelCompat, buildStaticBasetenModels, buildStaticBasetenProvider, resolveBasetenDynamicModel, usesBasetenChatTemplateThinking };
package/dist/index.js CHANGED
@@ -1,45 +1,47 @@
1
- import { r as BASETEN_DEFAULT_MODEL_REF, u as resolveBasetenDynamicModel } from "./models-Dg5jGc7M.js";
1
+ import { c as resolveBasetenDynamicModel, s as projectBasetenLiveModels, u as openclaw_plugin_default } from "./models-BXC6b2FZ.js";
2
2
  import { applyBasetenConfig } from "./onboard.js";
3
- import { buildBasetenProvider, buildStaticBasetenProvider } from "./provider-catalog.js";
3
+ import { buildStaticBasetenProvider } from "./provider-catalog.js";
4
4
  import { createBasetenThinkingWrapper } from "./stream.js";
5
5
  import { resolveBasetenThinkingProfile } from "./thinking.js";
6
+ import { buildOpenAICompatibleLiveModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
6
7
  import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
7
8
  import { buildProviderReplayFamilyHooks } from "openclaw/plugin-sdk/provider-model-shared";
8
9
  //#region extensions/baseten/index.ts
10
+ /** Baseten provider plugin entrypoint. */
9
11
  const PROVIDER_ID = "baseten";
10
12
  var baseten_default = defineSingleProviderPluginEntry({
11
13
  id: PROVIDER_ID,
12
14
  name: "Baseten Provider",
13
15
  description: "Official Baseten Model APIs provider plugin",
16
+ manifest: openclaw_plugin_default,
14
17
  provider: {
15
18
  label: "Baseten",
16
19
  docsPath: "/providers/baseten",
17
- auth: [{
18
- methodId: "api-key",
19
- label: "Baseten API key",
20
- hint: "Hosted Model APIs, including Inkling",
21
- optionKey: "basetenApiKey",
22
- flagName: "--baseten-api-key",
23
- envVar: "BASETEN_API_KEY",
24
- promptMessage: "Enter Baseten API key",
25
- defaultModel: BASETEN_DEFAULT_MODEL_REF,
26
- applyConfig: (cfg) => applyBasetenConfig(cfg),
20
+ manifestAuth: {
21
+ applyConfig: applyBasetenConfig,
27
22
  noteTitle: "Baseten",
28
- noteMessage: ["Baseten hosts Thinking Machines Lab's Inkling and other frontier models behind one OpenAI-compatible API.", "Get your API key at: https://app.baseten.co/settings/api_keys"].join("\n"),
29
- wizard: {
30
- groupLabel: "Baseten",
31
- groupHint: "Hosted Model APIs, including Inkling"
32
- }
33
- }],
23
+ noteMessage: ["Baseten hosts Thinking Machines Lab's Inkling and other frontier models behind one OpenAI-compatible API.", "Get your API key at: https://app.baseten.co/settings/api_keys"].join("\n")
24
+ },
34
25
  catalog: {
35
26
  order: "simple",
36
27
  run: async (ctx) => {
37
28
  const { apiKey, discoveryApiKey } = ctx.resolveProviderAuth(PROVIDER_ID);
38
29
  if (!apiKey) return null;
39
- return { provider: {
40
- ...await buildBasetenProvider(discoveryApiKey),
30
+ if (!discoveryApiKey) return { provider: {
31
+ ...buildStaticBasetenProvider(),
41
32
  apiKey
42
33
  } };
34
+ return { provider: await buildOpenAICompatibleLiveModelProviderConfig({
35
+ providerId: PROVIDER_ID,
36
+ providerConfig: buildStaticBasetenProvider(),
37
+ apiKey,
38
+ discoveryApiKey,
39
+ modelDiscovery: {
40
+ timeoutMs: 1e4,
41
+ ttlMs: 300 * 1e3,
42
+ projectRows: projectBasetenLiveModels
43
+ }
44
+ }) };
43
45
  },
44
46
  staticRun: async () => ({ provider: buildStaticBasetenProvider() })
45
47
  },
@@ -0,0 +1,369 @@
1
+ import { buildManifestModelDefinition, readManifestProviderDefaultModelRef } from "openclaw/plugin-sdk/provider-catalog-shared";
2
+ //#region extensions/baseten/openclaw.plugin.json
3
+ var openclaw_plugin_default = {
4
+ id: "baseten",
5
+ name: "Baseten",
6
+ description: "OpenClaw Baseten provider plugin.",
7
+ activation: { "onStartup": false },
8
+ enabledByDefault: true,
9
+ providers: ["baseten"],
10
+ providerRequest: { "providers": { "baseten": {
11
+ "family": "baseten",
12
+ "openAICompletions": { "supportsStreamingUsage": true }
13
+ } } },
14
+ modelCatalog: {
15
+ "providers": { "baseten": {
16
+ "baseUrl": "https://inference.baseten.co/v1",
17
+ "api": "openai-completions",
18
+ "defaultModel": "thinkingmachines/inkling",
19
+ "models": [
20
+ {
21
+ "id": "deepseek-ai/DeepSeek-V4-Pro",
22
+ "name": "DeepSeek V4 Pro",
23
+ "reasoning": true,
24
+ "input": ["text"],
25
+ "contextWindow": 262e3,
26
+ "maxTokens": 262e3,
27
+ "cost": {
28
+ "input": 1.74,
29
+ "output": 3.48,
30
+ "cacheRead": .145,
31
+ "cacheWrite": 0
32
+ },
33
+ "compat": { "codeMode": "capable" }
34
+ },
35
+ {
36
+ "id": "zai-org/GLM-4.7",
37
+ "name": "GLM 4.7",
38
+ "reasoning": true,
39
+ "input": ["text"],
40
+ "contextWindow": 2e5,
41
+ "maxTokens": 2e5,
42
+ "cost": {
43
+ "input": .6,
44
+ "output": 2.2,
45
+ "cacheRead": .12,
46
+ "cacheWrite": 0
47
+ }
48
+ },
49
+ {
50
+ "id": "zai-org/GLM-5.2",
51
+ "name": "GLM 5.2",
52
+ "reasoning": true,
53
+ "input": ["text"],
54
+ "contextWindow": 524e3,
55
+ "maxTokens": 262e3,
56
+ "cost": {
57
+ "input": 1.4,
58
+ "output": 4.4,
59
+ "cacheRead": .14,
60
+ "cacheWrite": 0
61
+ },
62
+ "compat": { "codeMode": "capable" }
63
+ },
64
+ {
65
+ "id": "zai-org/GLM-5.2-Fast",
66
+ "name": "GLM 5.2 Fast",
67
+ "reasoning": true,
68
+ "input": ["text"],
69
+ "contextWindow": 524e3,
70
+ "maxTokens": 262e3,
71
+ "cost": {
72
+ "input": 2.1,
73
+ "output": 6.6,
74
+ "cacheRead": .21,
75
+ "cacheWrite": 0
76
+ }
77
+ },
78
+ {
79
+ "id": "thinkingmachines/inkling",
80
+ "name": "Inkling",
81
+ "reasoning": true,
82
+ "input": ["text", "image"],
83
+ "contextWindow": 1048e3,
84
+ "maxTokens": 32e3,
85
+ "cost": {
86
+ "input": 1,
87
+ "output": 4.05,
88
+ "cacheRead": .17,
89
+ "cacheWrite": 0
90
+ }
91
+ },
92
+ {
93
+ "id": "moonshotai/Kimi-K2.6",
94
+ "name": "Kimi K2.6",
95
+ "reasoning": true,
96
+ "input": ["text", "image"],
97
+ "contextWindow": 262e3,
98
+ "maxTokens": 262e3,
99
+ "cost": {
100
+ "input": .95,
101
+ "output": 4,
102
+ "cacheRead": .16,
103
+ "cacheWrite": 0
104
+ }
105
+ },
106
+ {
107
+ "id": "moonshotai/Kimi-K2.7-Code",
108
+ "name": "Kimi K2.7 Code",
109
+ "reasoning": true,
110
+ "input": ["text", "image"],
111
+ "contextWindow": 262e3,
112
+ "maxTokens": 262e3,
113
+ "cost": {
114
+ "input": .95,
115
+ "output": 4,
116
+ "cacheRead": .16,
117
+ "cacheWrite": 0
118
+ }
119
+ },
120
+ {
121
+ "id": "nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B",
122
+ "name": "Nemotron Ultra",
123
+ "reasoning": true,
124
+ "input": ["text"],
125
+ "contextWindow": 202e3,
126
+ "maxTokens": 202e3,
127
+ "cost": {
128
+ "input": .6,
129
+ "output": 2.4,
130
+ "cacheRead": .12,
131
+ "cacheWrite": 0
132
+ }
133
+ },
134
+ {
135
+ "id": "openai/gpt-oss-120b",
136
+ "name": "GPT OSS 120B",
137
+ "reasoning": true,
138
+ "input": ["text"],
139
+ "contextWindow": 128e3,
140
+ "maxTokens": 128e3,
141
+ "cost": {
142
+ "input": .1,
143
+ "output": .5,
144
+ "cacheRead": 0,
145
+ "cacheWrite": 0
146
+ }
147
+ }
148
+ ]
149
+ } },
150
+ "discovery": { "baseten": "refreshable" }
151
+ },
152
+ setup: { "providers": [{
153
+ "id": "baseten",
154
+ "envVars": ["BASETEN_API_KEY"]
155
+ }] },
156
+ providerAuthChoices: [{
157
+ "provider": "baseten",
158
+ "method": "api-key",
159
+ "choiceId": "baseten-api-key",
160
+ "appGuidedSecret": true,
161
+ "choiceLabel": "Baseten API key",
162
+ "groupId": "baseten",
163
+ "groupLabel": "Baseten",
164
+ "groupHint": "Hosted Model APIs, including Inkling",
165
+ "optionKey": "basetenApiKey",
166
+ "cliFlag": "--baseten-api-key",
167
+ "cliOption": "--baseten-api-key <key>",
168
+ "cliDescription": "Baseten API key"
169
+ }],
170
+ configSchema: {
171
+ "type": "object",
172
+ "additionalProperties": false,
173
+ "properties": {}
174
+ }
175
+ };
176
+ //#endregion
177
+ //#region extensions/baseten/models.ts
178
+ /**
179
+ * Baseten model catalog, compat metadata, and live row projection.
180
+ */
181
+ const BASETEN_MANIFEST_CATALOG = openclaw_plugin_default.modelCatalog.providers.baseten;
182
+ const DEFAULT_CONTEXT_WINDOW = 128e3;
183
+ const DEFAULT_MAX_TOKENS = 8192;
184
+ const CHAT_TEMPLATE_THINKING_MODEL_IDS = /* @__PURE__ */ new Set([
185
+ "zai-org/glm-4.7",
186
+ "zai-org/glm-5.2",
187
+ "zai-org/glm-5.2-fast",
188
+ "moonshotai/kimi-k2.6",
189
+ "moonshotai/kimi-k2.7-code",
190
+ "nvidia/nvidia-nemotron-3-ultra-550b-a55b"
191
+ ]);
192
+ const FULL_REASONING_EFFORT_MODEL_IDS = /* @__PURE__ */ new Set(["deepseek-ai/DeepSeek-V4-Pro", "openai/gpt-oss-120b"]);
193
+ const INKLING_REASONING_EFFORTS = [
194
+ "none",
195
+ "minimal",
196
+ "low",
197
+ "medium",
198
+ "high",
199
+ "xhigh"
200
+ ];
201
+ const FULL_REASONING_EFFORTS = [...INKLING_REASONING_EFFORTS, "max"];
202
+ const BASE_COMPAT = {
203
+ supportsStore: false,
204
+ supportsDeveloperRole: false,
205
+ supportsUsageInStreaming: true,
206
+ supportsStrictMode: true,
207
+ supportsTools: true,
208
+ maxTokensField: "max_tokens"
209
+ };
210
+ /** Base URL for Baseten's OpenAI-compatible Model APIs. */
211
+ const BASETEN_BASE_URL = BASETEN_MANIFEST_CATALOG.baseUrl;
212
+ /** Default Baseten model id used for onboarding. */
213
+ const BASETEN_DEFAULT_MODEL_ID = BASETEN_MANIFEST_CATALOG.defaultModel;
214
+ /** Default Baseten model ref used for onboarding. */
215
+ const BASETEN_DEFAULT_MODEL_REF = readManifestProviderDefaultModelRef(openclaw_plugin_default, "baseten");
216
+ /** Bundled fallback rows for all Baseten Model APIs available at release time. */
217
+ const BASETEN_MODEL_CATALOG = BASETEN_MANIFEST_CATALOG.models;
218
+ /** Whether Baseten requires chat-template thinking control for this model. */
219
+ function usesBasetenChatTemplateThinking(modelId) {
220
+ return CHAT_TEMPLATE_THINKING_MODEL_IDS.has(modelId.trim().toLowerCase());
221
+ }
222
+ function buildBasetenReasoningCompat(modelId) {
223
+ if (FULL_REASONING_EFFORT_MODEL_IDS.has(modelId)) return {
224
+ supportsReasoningEffort: true,
225
+ supportedReasoningEfforts: FULL_REASONING_EFFORTS,
226
+ reasoningEffortMap: {
227
+ off: "none",
228
+ none: "none",
229
+ adaptive: "max"
230
+ }
231
+ };
232
+ if (modelId === BASETEN_DEFAULT_MODEL_ID) return {
233
+ supportsReasoningEffort: true,
234
+ supportedReasoningEfforts: INKLING_REASONING_EFFORTS,
235
+ reasoningEffortMap: {
236
+ off: "none",
237
+ none: "none",
238
+ adaptive: "xhigh",
239
+ max: "xhigh"
240
+ }
241
+ };
242
+ if (modelId === "zai-org/GLM-5.2" || modelId === "zai-org/GLM-5.2-Fast") return {
243
+ supportsReasoningEffort: true,
244
+ supportedReasoningEfforts: [
245
+ "none",
246
+ "high",
247
+ "max"
248
+ ],
249
+ reasoningEffortMap: {
250
+ off: "none",
251
+ none: "none",
252
+ minimal: "high",
253
+ low: "high",
254
+ medium: "high",
255
+ xhigh: "high",
256
+ adaptive: "max"
257
+ }
258
+ };
259
+ return {};
260
+ }
261
+ /** Complete OpenAI-compatible transport policy for one Baseten model. */
262
+ function buildBasetenModelCompat(modelId) {
263
+ return {
264
+ ...BASE_COMPAT,
265
+ ...buildBasetenReasoningCompat(modelId)
266
+ };
267
+ }
268
+ /** Builds the network-free fallback catalog. */
269
+ function buildStaticBasetenModels() {
270
+ return BASETEN_MODEL_CATALOG.map(buildManifestModelDefinition({
271
+ providerId: "baseten",
272
+ catalog: BASETEN_MANIFEST_CATALOG,
273
+ decorate: (normalized) => ({
274
+ ...normalized,
275
+ compat: buildBasetenModelCompat(normalized.id)
276
+ })
277
+ }));
278
+ }
279
+ function readPositiveInteger(value) {
280
+ const number = typeof value === "number" ? value : Number(value);
281
+ return Number.isSafeInteger(number) && number > 0 ? number : void 0;
282
+ }
283
+ function readPerTokenPrice(value) {
284
+ if (typeof value !== "number" && (typeof value !== "string" || !value.trim())) return;
285
+ const number = typeof value === "number" ? value : Number(value);
286
+ return Number.isFinite(number) && number >= 0 ? Number((number * 1e6).toFixed(9)) : void 0;
287
+ }
288
+ function readStringArray(value) {
289
+ return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
290
+ }
291
+ function applyLiveReasoningEffortCompat(fallbackCompat, supportsReasoningEffort) {
292
+ if (supportsReasoningEffort) return {
293
+ ...fallbackCompat,
294
+ supportsReasoningEffort: true
295
+ };
296
+ const compat = { ...fallbackCompat };
297
+ delete compat.supportsReasoningEffort;
298
+ delete compat.supportedReasoningEfforts;
299
+ delete compat.reasoningEffortMap;
300
+ return compat;
301
+ }
302
+ function projectLiveModel(row, fallback) {
303
+ if (row.object !== void 0 && row.object !== "model") return;
304
+ const id = typeof row.id === "string" ? row.id.trim() : "";
305
+ if (!id) return;
306
+ const hasLiveFeatures = Array.isArray(row.supported_features);
307
+ const features = new Set(readStringArray(row.supported_features));
308
+ const pricing = row.pricing && typeof row.pricing === "object" && !Array.isArray(row.pricing) ? row.pricing : {};
309
+ const inputPrice = readPerTokenPrice(pricing.prompt);
310
+ const outputPrice = readPerTokenPrice(pricing.completion);
311
+ const cacheReadPrice = readPerTokenPrice(pricing.input_cache_read);
312
+ const supportsReasoningEffort = features.has("reasoning_effort");
313
+ const fallbackCompat = fallback?.compat ?? buildBasetenModelCompat(id);
314
+ const compat = hasLiveFeatures ? applyLiveReasoningEffortCompat(fallbackCompat, supportsReasoningEffort) : fallbackCompat;
315
+ return {
316
+ id,
317
+ name: typeof row.name === "string" && row.name.trim() ? row.name.trim() : fallback?.name ?? id,
318
+ reasoning: hasLiveFeatures ? features.has("reasoning") || supportsReasoningEffort : fallback?.reasoning ?? false,
319
+ input: hasLiveFeatures ? features.has("vision") ? ["text", "image"] : ["text"] : fallback?.input ?? ["text"],
320
+ cost: {
321
+ input: inputPrice ?? fallback?.cost.input ?? 0,
322
+ output: outputPrice ?? fallback?.cost.output ?? 0,
323
+ cacheRead: cacheReadPrice ?? fallback?.cost.cacheRead ?? 0,
324
+ cacheWrite: fallback?.cost.cacheWrite ?? 0
325
+ },
326
+ contextWindow: readPositiveInteger(row.context_length) ?? fallback?.contextWindow ?? DEFAULT_CONTEXT_WINDOW,
327
+ maxTokens: readPositiveInteger(row.max_completion_tokens) ?? fallback?.maxTokens ?? DEFAULT_MAX_TOKENS,
328
+ compat
329
+ };
330
+ }
331
+ /** Projects Baseten's authenticated `/models` response into OpenClaw model rows. */
332
+ function projectBasetenLiveModels(rows) {
333
+ const fallbacks = new Map(buildStaticBasetenModels().map((model) => [model.id, model]));
334
+ const seen = /* @__PURE__ */ new Set();
335
+ const models = [];
336
+ for (const row of rows) {
337
+ if (!row || typeof row !== "object" || Array.isArray(row)) continue;
338
+ const model = projectLiveModel(row, fallbacks.get(String(row.id)));
339
+ if (!model || seen.has(model.id)) continue;
340
+ seen.add(model.id);
341
+ models.push(model);
342
+ }
343
+ return models;
344
+ }
345
+ /** Resolves a forward-compatible Baseten model id not yet in the bundled catalog. */
346
+ function resolveBasetenDynamicModel(modelId) {
347
+ const id = modelId.trim();
348
+ if (!id || BASETEN_MODEL_CATALOG.some((model) => model.id === id)) return;
349
+ return {
350
+ id,
351
+ name: id,
352
+ provider: "baseten",
353
+ api: "openai-completions",
354
+ baseUrl: BASETEN_BASE_URL,
355
+ reasoning: false,
356
+ input: ["text"],
357
+ cost: {
358
+ input: 0,
359
+ output: 0,
360
+ cacheRead: 0,
361
+ cacheWrite: 0
362
+ },
363
+ contextWindow: DEFAULT_CONTEXT_WINDOW,
364
+ maxTokens: DEFAULT_MAX_TOKENS,
365
+ compat: buildBasetenModelCompat(id)
366
+ };
367
+ }
368
+ //#endregion
369
+ export { buildBasetenModelCompat as a, resolveBasetenDynamicModel as c, BASETEN_MODEL_CATALOG as i, usesBasetenChatTemplateThinking as l, BASETEN_DEFAULT_MODEL_ID as n, buildStaticBasetenModels as o, BASETEN_DEFAULT_MODEL_REF as r, projectBasetenLiveModels as s, BASETEN_BASE_URL as t, openclaw_plugin_default as u };
package/dist/models.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as buildBasetenModelCompat, c as discoverBasetenModels, d as usesBasetenChatTemplateThinking, i as BASETEN_MODEL_CATALOG, l as projectBasetenLiveModels, n as BASETEN_DEFAULT_MODEL_ID, o as buildBasetenModelDefinition, r as BASETEN_DEFAULT_MODEL_REF, s as buildStaticBasetenModels, t as BASETEN_BASE_URL, u as resolveBasetenDynamicModel } from "./models-Dg5jGc7M.js";
2
- export { BASETEN_BASE_URL, BASETEN_DEFAULT_MODEL_ID, BASETEN_DEFAULT_MODEL_REF, BASETEN_MODEL_CATALOG, buildBasetenModelCompat, buildBasetenModelDefinition, buildStaticBasetenModels, discoverBasetenModels, projectBasetenLiveModels, resolveBasetenDynamicModel, usesBasetenChatTemplateThinking };
1
+ import { a as buildBasetenModelCompat, c as resolveBasetenDynamicModel, i as BASETEN_MODEL_CATALOG, l as usesBasetenChatTemplateThinking, n as BASETEN_DEFAULT_MODEL_ID, o as buildStaticBasetenModels, r as BASETEN_DEFAULT_MODEL_REF, s as projectBasetenLiveModels, t as BASETEN_BASE_URL } from "./models-BXC6b2FZ.js";
2
+ export { BASETEN_BASE_URL, BASETEN_DEFAULT_MODEL_ID, BASETEN_DEFAULT_MODEL_REF, BASETEN_MODEL_CATALOG, buildBasetenModelCompat, buildStaticBasetenModels, projectBasetenLiveModels, resolveBasetenDynamicModel, usesBasetenChatTemplateThinking };
package/dist/onboard.js CHANGED
@@ -1,10 +1,11 @@
1
- import { r as BASETEN_DEFAULT_MODEL_REF, s as buildStaticBasetenModels, t as BASETEN_BASE_URL } from "./models-Dg5jGc7M.js";
1
+ import { o as buildStaticBasetenModels, r as BASETEN_DEFAULT_MODEL_REF, t as BASETEN_BASE_URL } from "./models-BXC6b2FZ.js";
2
2
  import { createModelCatalogPresetAppliers } from "openclaw/plugin-sdk/provider-onboard";
3
3
  //#region extensions/baseten/onboard.ts
4
4
  /** Baseten onboarding config helpers. */
5
- const basetenPresetAppliers = createModelCatalogPresetAppliers({
5
+ /** Applies Baseten's provider catalog, Inkling alias, and default model. */
6
+ const { applyConfig: applyBasetenConfig } = createModelCatalogPresetAppliers({
6
7
  primaryModelRef: BASETEN_DEFAULT_MODEL_REF,
7
- resolveParams: (_cfg) => ({
8
+ resolveParams: () => ({
8
9
  providerId: "baseten",
9
10
  api: "openai-completions",
10
11
  baseUrl: BASETEN_BASE_URL,
@@ -15,9 +16,5 @@ const basetenPresetAppliers = createModelCatalogPresetAppliers({
15
16
  }]
16
17
  })
17
18
  });
18
- /** Applies Baseten's provider catalog, Inkling alias, and default model. */
19
- function applyBasetenConfig(cfg) {
20
- return basetenPresetAppliers.applyConfig(cfg);
21
- }
22
19
  //#endregion
23
20
  export { applyBasetenConfig };
@@ -1,4 +1,4 @@
1
- import { c as discoverBasetenModels, s as buildStaticBasetenModels, t as BASETEN_BASE_URL } from "./models-Dg5jGc7M.js";
1
+ import { o as buildStaticBasetenModels, t as BASETEN_BASE_URL } from "./models-BXC6b2FZ.js";
2
2
  //#region extensions/baseten/provider-catalog.ts
3
3
  /** Builds Baseten's network-free fallback provider catalog. */
4
4
  function buildStaticBasetenProvider() {
@@ -8,13 +8,5 @@ function buildStaticBasetenProvider() {
8
8
  models: buildStaticBasetenModels()
9
9
  };
10
10
  }
11
- /** Builds Baseten's account-scoped live catalog. */
12
- async function buildBasetenProvider(discoveryApiKey) {
13
- return {
14
- baseUrl: BASETEN_BASE_URL,
15
- api: "openai-completions",
16
- models: await discoverBasetenModels({ discoveryApiKey })
17
- };
18
- }
19
11
  //#endregion
20
- export { buildBasetenProvider, buildStaticBasetenProvider };
12
+ export { buildStaticBasetenProvider };
package/dist/stream.js CHANGED
@@ -1,5 +1,5 @@
1
- import { d as usesBasetenChatTemplateThinking } from "./models-Dg5jGc7M.js";
2
- import { createPayloadPatchStreamWrapper } from "openclaw/plugin-sdk/provider-stream-shared";
1
+ import { l as usesBasetenChatTemplateThinking } from "./models-BXC6b2FZ.js";
2
+ import { createPayloadPatchStreamWrapper, normalizeOpenAICompatibleReasoningReplay } from "openclaw/plugin-sdk/provider-stream-shared";
3
3
  //#region extensions/baseten/stream.ts
4
4
  const BASETEN_DEEPSEEK_V4_MODEL_ID = "deepseek-ai/deepseek-v4-pro";
5
5
  function isThinkingEnabled(level) {
@@ -8,21 +8,15 @@ function isThinkingEnabled(level) {
8
8
  function isBasetenDeepSeekV4ModelId(modelId) {
9
9
  return modelId.trim().toLowerCase() === BASETEN_DEEPSEEK_V4_MODEL_ID;
10
10
  }
11
- function patchBasetenDeepSeekV4Replay(payload, thinkingEnabled) {
12
- if (!Array.isArray(payload.messages)) return;
13
- for (const message of payload.messages) {
14
- if (!message || typeof message !== "object" || Array.isArray(message)) continue;
15
- const record = message;
16
- if (record.role !== "assistant") continue;
17
- if (thinkingEnabled) record.reasoning_content ??= "";
18
- else delete record.reasoning_content;
19
- }
20
- }
21
11
  /** Adds Baseten's `chat_template_args.enable_thinking` without dropping caller args. */
22
12
  function createBasetenThinkingWrapper(ctx) {
23
13
  return createPayloadPatchStreamWrapper(ctx.streamFn, ({ payload, model }) => {
24
14
  if (model.provider !== "baseten" || model.api !== "openai-completions") return;
25
- if (isBasetenDeepSeekV4ModelId(model.id)) patchBasetenDeepSeekV4Replay(payload, ctx.thinkingLevel !== "off");
15
+ if (isBasetenDeepSeekV4ModelId(model.id)) normalizeOpenAICompatibleReasoningReplay(payload, {
16
+ thinkingEnabled: ctx.thinkingLevel !== "off",
17
+ stripAssistantMessagesOnly: true,
18
+ replaceNullReasoningContent: true
19
+ });
26
20
  if (!usesBasetenChatTemplateThinking(model.id)) return;
27
21
  payload.chat_template_args = {
28
22
  ...payload.chat_template_args && typeof payload.chat_template_args === "object" && !Array.isArray(payload.chat_template_args) ? payload.chat_template_args : {},
package/dist/thinking.js CHANGED
@@ -1,4 +1,4 @@
1
- import { d as usesBasetenChatTemplateThinking } from "./models-Dg5jGc7M.js";
1
+ import { l as usesBasetenChatTemplateThinking } from "./models-BXC6b2FZ.js";
2
2
  //#region extensions/baseten/thinking.ts
3
3
  const BASETEN_BINARY_THINKING_PROFILE = {
4
4
  levels: [{ id: "off" }, {
@@ -18,7 +18,7 @@ const BASETEN_GLM_52_THINKING_PROFILE = {
18
18
  /** Exposes only the thinking levels that Baseten actually accepts for opt-in models. */
19
19
  function resolveBasetenThinkingProfile(modelId) {
20
20
  const normalized = modelId.trim().toLowerCase();
21
- if (normalized === "zai-org/glm-5.2") return BASETEN_GLM_52_THINKING_PROFILE;
21
+ if (normalized === "zai-org/glm-5.2" || normalized === "zai-org/glm-5.2-fast") return BASETEN_GLM_52_THINKING_PROFILE;
22
22
  return usesBasetenChatTemplateThinking(normalized) ? BASETEN_BINARY_THINKING_PROFILE : void 0;
23
23
  }
24
24
  //#endregion
@@ -6,7 +6,9 @@
6
6
  "onStartup": false
7
7
  },
8
8
  "enabledByDefault": true,
9
- "providers": ["baseten"],
9
+ "providers": [
10
+ "baseten"
11
+ ],
10
12
  "providerRequest": {
11
13
  "providers": {
12
14
  "baseten": {
@@ -22,12 +24,15 @@
22
24
  "baseten": {
23
25
  "baseUrl": "https://inference.baseten.co/v1",
24
26
  "api": "openai-completions",
27
+ "defaultModel": "thinkingmachines/inkling",
25
28
  "models": [
26
29
  {
27
30
  "id": "deepseek-ai/DeepSeek-V4-Pro",
28
31
  "name": "DeepSeek V4 Pro",
29
32
  "reasoning": true,
30
- "input": ["text"],
33
+ "input": [
34
+ "text"
35
+ ],
31
36
  "contextWindow": 262000,
32
37
  "maxTokens": 262000,
33
38
  "cost": {
@@ -35,13 +40,18 @@
35
40
  "output": 3.48,
36
41
  "cacheRead": 0.145,
37
42
  "cacheWrite": 0
43
+ },
44
+ "compat": {
45
+ "codeMode": "capable"
38
46
  }
39
47
  },
40
48
  {
41
49
  "id": "zai-org/GLM-4.7",
42
50
  "name": "GLM 4.7",
43
51
  "reasoning": true,
44
- "input": ["text"],
52
+ "input": [
53
+ "text"
54
+ ],
45
55
  "contextWindow": 200000,
46
56
  "maxTokens": 200000,
47
57
  "cost": {
@@ -52,44 +62,37 @@
52
62
  }
53
63
  },
54
64
  {
55
- "id": "zai-org/GLM-5",
56
- "name": "GLM 5",
65
+ "id": "zai-org/GLM-5.2",
66
+ "name": "GLM 5.2",
57
67
  "reasoning": true,
58
- "input": ["text"],
59
- "contextWindow": 202000,
60
- "maxTokens": 202000,
68
+ "input": [
69
+ "text"
70
+ ],
71
+ "contextWindow": 524000,
72
+ "maxTokens": 262000,
61
73
  "cost": {
62
- "input": 0.95,
63
- "output": 3.15,
64
- "cacheRead": 0.2,
74
+ "input": 1.4,
75
+ "output": 4.4,
76
+ "cacheRead": 0.14,
65
77
  "cacheWrite": 0
78
+ },
79
+ "compat": {
80
+ "codeMode": "capable"
66
81
  }
67
82
  },
68
83
  {
69
- "id": "zai-org/GLM-5.1",
70
- "name": "GLM 5.1",
84
+ "id": "zai-org/GLM-5.2-Fast",
85
+ "name": "GLM 5.2 Fast",
71
86
  "reasoning": true,
72
- "input": ["text"],
73
- "contextWindow": 202000,
74
- "maxTokens": 202000,
87
+ "input": [
88
+ "text"
89
+ ],
90
+ "contextWindow": 524000,
91
+ "maxTokens": 262000,
75
92
  "cost": {
76
- "input": 1.3,
77
- "output": 4.3,
78
- "cacheRead": 0.26,
79
- "cacheWrite": 0
80
- }
81
- },
82
- {
83
- "id": "zai-org/GLM-5.2",
84
- "name": "GLM 5.2",
85
- "reasoning": true,
86
- "input": ["text"],
87
- "contextWindow": 202000,
88
- "maxTokens": 202000,
89
- "cost": {
90
- "input": 1.4,
91
- "output": 4.4,
92
- "cacheRead": 0.26,
93
+ "input": 2.1,
94
+ "output": 6.6,
95
+ "cacheRead": 0.21,
93
96
  "cacheWrite": 0
94
97
  }
95
98
  },
@@ -97,7 +100,10 @@
97
100
  "id": "thinkingmachines/inkling",
98
101
  "name": "Inkling",
99
102
  "reasoning": true,
100
- "input": ["text", "image"],
103
+ "input": [
104
+ "text",
105
+ "image"
106
+ ],
101
107
  "contextWindow": 1048000,
102
108
  "maxTokens": 32000,
103
109
  "cost": {
@@ -107,25 +113,14 @@
107
113
  "cacheWrite": 0
108
114
  }
109
115
  },
110
- {
111
- "id": "moonshotai/Kimi-K2.5",
112
- "name": "Kimi K2.5",
113
- "reasoning": true,
114
- "input": ["text", "image"],
115
- "contextWindow": 262000,
116
- "maxTokens": 262000,
117
- "cost": {
118
- "input": 0.6,
119
- "output": 3,
120
- "cacheRead": 0.12,
121
- "cacheWrite": 0
122
- }
123
- },
124
116
  {
125
117
  "id": "moonshotai/Kimi-K2.6",
126
118
  "name": "Kimi K2.6",
127
119
  "reasoning": true,
128
- "input": ["text", "image"],
120
+ "input": [
121
+ "text",
122
+ "image"
123
+ ],
129
124
  "contextWindow": 262000,
130
125
  "maxTokens": 262000,
131
126
  "cost": {
@@ -139,7 +134,10 @@
139
134
  "id": "moonshotai/Kimi-K2.7-Code",
140
135
  "name": "Kimi K2.7 Code",
141
136
  "reasoning": true,
142
- "input": ["text", "image"],
137
+ "input": [
138
+ "text",
139
+ "image"
140
+ ],
143
141
  "contextWindow": 262000,
144
142
  "maxTokens": 262000,
145
143
  "cost": {
@@ -149,25 +147,13 @@
149
147
  "cacheWrite": 0
150
148
  }
151
149
  },
152
- {
153
- "id": "nvidia/Nemotron-120B-A12B",
154
- "name": "Nemotron Super",
155
- "reasoning": true,
156
- "input": ["text"],
157
- "contextWindow": 202000,
158
- "maxTokens": 202000,
159
- "cost": {
160
- "input": 0.3,
161
- "output": 0.75,
162
- "cacheRead": 0.06,
163
- "cacheWrite": 0
164
- }
165
- },
166
150
  {
167
151
  "id": "nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B",
168
152
  "name": "Nemotron Ultra",
169
153
  "reasoning": true,
170
- "input": ["text"],
154
+ "input": [
155
+ "text"
156
+ ],
171
157
  "contextWindow": 202000,
172
158
  "maxTokens": 202000,
173
159
  "cost": {
@@ -181,7 +167,9 @@
181
167
  "id": "openai/gpt-oss-120b",
182
168
  "name": "GPT OSS 120B",
183
169
  "reasoning": true,
184
- "input": ["text"],
170
+ "input": [
171
+ "text"
172
+ ],
185
173
  "contextWindow": 128000,
186
174
  "maxTokens": 128000,
187
175
  "cost": {
@@ -202,7 +190,9 @@
202
190
  "providers": [
203
191
  {
204
192
  "id": "baseten",
205
- "envVars": ["BASETEN_API_KEY"]
193
+ "envVars": [
194
+ "BASETEN_API_KEY"
195
+ ]
206
196
  }
207
197
  ]
208
198
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/baseten-provider",
3
- "version": "2026.7.2-beta.4",
3
+ "version": "2026.7.2-beta.7",
4
4
  "description": "OpenClaw Baseten 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.7.2-beta.4"
21
+ "pluginApi": ">=2026.7.2-beta.7"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.7.2-beta.4",
24
+ "openclawVersion": "2026.7.2-beta.7",
25
25
  "bundledDist": false
26
26
  },
27
27
  "release": {
@@ -35,11 +35,10 @@
35
35
  "files": [
36
36
  "dist/**",
37
37
  "openclaw.plugin.json",
38
- "npm-shrinkwrap.json",
39
38
  "README.md"
40
39
  ],
41
40
  "peerDependencies": {
42
- "openclaw": ">=2026.7.2-beta.4"
41
+ "openclaw": ">=2026.7.2-beta.7"
43
42
  },
44
43
  "peerDependenciesMeta": {
45
44
  "openclaw": {
@@ -1,414 +0,0 @@
1
- import { getCachedLiveProviderModelRows } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
2
- import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
3
- import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
4
- import { ssrfPolicyFromHttpBaseUrlAllowedHostname } from "openclaw/plugin-sdk/ssrf-runtime";
5
- //#region extensions/baseten/openclaw.plugin.json
6
- var modelCatalog = {
7
- "providers": { "baseten": {
8
- "baseUrl": "https://inference.baseten.co/v1",
9
- "api": "openai-completions",
10
- "models": [
11
- {
12
- "id": "deepseek-ai/DeepSeek-V4-Pro",
13
- "name": "DeepSeek V4 Pro",
14
- "reasoning": true,
15
- "input": ["text"],
16
- "contextWindow": 262e3,
17
- "maxTokens": 262e3,
18
- "cost": {
19
- "input": 1.74,
20
- "output": 3.48,
21
- "cacheRead": .145,
22
- "cacheWrite": 0
23
- }
24
- },
25
- {
26
- "id": "zai-org/GLM-4.7",
27
- "name": "GLM 4.7",
28
- "reasoning": true,
29
- "input": ["text"],
30
- "contextWindow": 2e5,
31
- "maxTokens": 2e5,
32
- "cost": {
33
- "input": .6,
34
- "output": 2.2,
35
- "cacheRead": .12,
36
- "cacheWrite": 0
37
- }
38
- },
39
- {
40
- "id": "zai-org/GLM-5",
41
- "name": "GLM 5",
42
- "reasoning": true,
43
- "input": ["text"],
44
- "contextWindow": 202e3,
45
- "maxTokens": 202e3,
46
- "cost": {
47
- "input": .95,
48
- "output": 3.15,
49
- "cacheRead": .2,
50
- "cacheWrite": 0
51
- }
52
- },
53
- {
54
- "id": "zai-org/GLM-5.1",
55
- "name": "GLM 5.1",
56
- "reasoning": true,
57
- "input": ["text"],
58
- "contextWindow": 202e3,
59
- "maxTokens": 202e3,
60
- "cost": {
61
- "input": 1.3,
62
- "output": 4.3,
63
- "cacheRead": .26,
64
- "cacheWrite": 0
65
- }
66
- },
67
- {
68
- "id": "zai-org/GLM-5.2",
69
- "name": "GLM 5.2",
70
- "reasoning": true,
71
- "input": ["text"],
72
- "contextWindow": 202e3,
73
- "maxTokens": 202e3,
74
- "cost": {
75
- "input": 1.4,
76
- "output": 4.4,
77
- "cacheRead": .26,
78
- "cacheWrite": 0
79
- }
80
- },
81
- {
82
- "id": "thinkingmachines/inkling",
83
- "name": "Inkling",
84
- "reasoning": true,
85
- "input": ["text", "image"],
86
- "contextWindow": 1048e3,
87
- "maxTokens": 32e3,
88
- "cost": {
89
- "input": 1,
90
- "output": 4.05,
91
- "cacheRead": .17,
92
- "cacheWrite": 0
93
- }
94
- },
95
- {
96
- "id": "moonshotai/Kimi-K2.5",
97
- "name": "Kimi K2.5",
98
- "reasoning": true,
99
- "input": ["text", "image"],
100
- "contextWindow": 262e3,
101
- "maxTokens": 262e3,
102
- "cost": {
103
- "input": .6,
104
- "output": 3,
105
- "cacheRead": .12,
106
- "cacheWrite": 0
107
- }
108
- },
109
- {
110
- "id": "moonshotai/Kimi-K2.6",
111
- "name": "Kimi K2.6",
112
- "reasoning": true,
113
- "input": ["text", "image"],
114
- "contextWindow": 262e3,
115
- "maxTokens": 262e3,
116
- "cost": {
117
- "input": .95,
118
- "output": 4,
119
- "cacheRead": .16,
120
- "cacheWrite": 0
121
- }
122
- },
123
- {
124
- "id": "moonshotai/Kimi-K2.7-Code",
125
- "name": "Kimi K2.7 Code",
126
- "reasoning": true,
127
- "input": ["text", "image"],
128
- "contextWindow": 262e3,
129
- "maxTokens": 262e3,
130
- "cost": {
131
- "input": .95,
132
- "output": 4,
133
- "cacheRead": .16,
134
- "cacheWrite": 0
135
- }
136
- },
137
- {
138
- "id": "nvidia/Nemotron-120B-A12B",
139
- "name": "Nemotron Super",
140
- "reasoning": true,
141
- "input": ["text"],
142
- "contextWindow": 202e3,
143
- "maxTokens": 202e3,
144
- "cost": {
145
- "input": .3,
146
- "output": .75,
147
- "cacheRead": .06,
148
- "cacheWrite": 0
149
- }
150
- },
151
- {
152
- "id": "nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B",
153
- "name": "Nemotron Ultra",
154
- "reasoning": true,
155
- "input": ["text"],
156
- "contextWindow": 202e3,
157
- "maxTokens": 202e3,
158
- "cost": {
159
- "input": .6,
160
- "output": 2.4,
161
- "cacheRead": .12,
162
- "cacheWrite": 0
163
- }
164
- },
165
- {
166
- "id": "openai/gpt-oss-120b",
167
- "name": "GPT OSS 120B",
168
- "reasoning": true,
169
- "input": ["text"],
170
- "contextWindow": 128e3,
171
- "maxTokens": 128e3,
172
- "cost": {
173
- "input": .1,
174
- "output": .5,
175
- "cacheRead": 0,
176
- "cacheWrite": 0
177
- }
178
- }
179
- ]
180
- } },
181
- "discovery": { "baseten": "refreshable" }
182
- };
183
- //#endregion
184
- //#region extensions/baseten/models.ts
185
- /**
186
- * Baseten model catalog, compat metadata, and authenticated live discovery.
187
- */
188
- const log = createSubsystemLogger("baseten-models");
189
- const BASETEN_MANIFEST_CATALOG = modelCatalog.providers.baseten;
190
- const CACHE_TTL_MS = 300 * 1e3;
191
- const DEFAULT_CONTEXT_WINDOW = 128e3;
192
- const DEFAULT_MAX_TOKENS = 8192;
193
- const CHAT_TEMPLATE_THINKING_MODEL_IDS = /* @__PURE__ */ new Set([
194
- "zai-org/glm-4.7",
195
- "zai-org/glm-5",
196
- "zai-org/glm-5.1",
197
- "zai-org/glm-5.2",
198
- "moonshotai/kimi-k2.5",
199
- "moonshotai/kimi-k2.6",
200
- "moonshotai/kimi-k2.7-code",
201
- "nvidia/nemotron-120b-a12b",
202
- "nvidia/nvidia-nemotron-3-ultra-550b-a55b"
203
- ]);
204
- const FULL_REASONING_EFFORT_MODEL_IDS = /* @__PURE__ */ new Set(["deepseek-ai/DeepSeek-V4-Pro", "openai/gpt-oss-120b"]);
205
- const INKLING_REASONING_EFFORTS = [
206
- "none",
207
- "minimal",
208
- "low",
209
- "medium",
210
- "high",
211
- "xhigh"
212
- ];
213
- const FULL_REASONING_EFFORTS = [...INKLING_REASONING_EFFORTS, "max"];
214
- const BASE_COMPAT = {
215
- supportsStore: false,
216
- supportsDeveloperRole: false,
217
- supportsUsageInStreaming: true,
218
- supportsStrictMode: true,
219
- supportsTools: true,
220
- maxTokensField: "max_tokens"
221
- };
222
- /** Base URL for Baseten's OpenAI-compatible Model APIs. */
223
- const BASETEN_BASE_URL = BASETEN_MANIFEST_CATALOG.baseUrl;
224
- /** Default Baseten model id used for onboarding. */
225
- const BASETEN_DEFAULT_MODEL_ID = "thinkingmachines/inkling";
226
- /** Default Baseten model ref used for onboarding. */
227
- const BASETEN_DEFAULT_MODEL_REF = `baseten/${BASETEN_DEFAULT_MODEL_ID}`;
228
- /** Bundled fallback rows for all Baseten Model APIs available at release time. */
229
- const BASETEN_MODEL_CATALOG = BASETEN_MANIFEST_CATALOG.models;
230
- /** Whether Baseten requires chat-template thinking control for this model. */
231
- function usesBasetenChatTemplateThinking(modelId) {
232
- return CHAT_TEMPLATE_THINKING_MODEL_IDS.has(modelId.trim().toLowerCase());
233
- }
234
- function buildBasetenReasoningCompat(modelId) {
235
- if (FULL_REASONING_EFFORT_MODEL_IDS.has(modelId)) return {
236
- supportsReasoningEffort: true,
237
- supportedReasoningEfforts: FULL_REASONING_EFFORTS,
238
- reasoningEffortMap: {
239
- off: "none",
240
- none: "none",
241
- adaptive: "max"
242
- }
243
- };
244
- if (modelId === "thinkingmachines/inkling") return {
245
- supportsReasoningEffort: true,
246
- supportedReasoningEfforts: INKLING_REASONING_EFFORTS,
247
- reasoningEffortMap: {
248
- off: "none",
249
- none: "none",
250
- adaptive: "xhigh",
251
- max: "xhigh"
252
- }
253
- };
254
- if (modelId === "zai-org/GLM-5.2") return {
255
- supportsReasoningEffort: true,
256
- supportedReasoningEfforts: [
257
- "none",
258
- "high",
259
- "max"
260
- ],
261
- reasoningEffortMap: {
262
- off: "none",
263
- none: "none",
264
- minimal: "high",
265
- low: "high",
266
- medium: "high",
267
- xhigh: "high",
268
- adaptive: "max"
269
- }
270
- };
271
- return {};
272
- }
273
- /** Complete OpenAI-compatible transport policy for one Baseten model. */
274
- function buildBasetenModelCompat(modelId) {
275
- return {
276
- ...BASE_COMPAT,
277
- ...buildBasetenReasoningCompat(modelId)
278
- };
279
- }
280
- /** Builds one normalized Baseten model definition from a manifest entry. */
281
- function buildBasetenModelDefinition(model) {
282
- const normalized = buildManifestModelProviderConfig({
283
- providerId: "baseten",
284
- catalog: {
285
- ...BASETEN_MANIFEST_CATALOG,
286
- models: [model]
287
- }
288
- }).models[0];
289
- if (!normalized) throw new Error(`Missing normalized Baseten model ${model.id}`);
290
- return {
291
- ...normalized,
292
- compat: buildBasetenModelCompat(normalized.id)
293
- };
294
- }
295
- /** Builds the network-free fallback catalog. */
296
- function buildStaticBasetenModels() {
297
- return BASETEN_MODEL_CATALOG.map(buildBasetenModelDefinition);
298
- }
299
- function readPositiveInteger(value) {
300
- const number = typeof value === "number" ? value : Number(value);
301
- return Number.isSafeInteger(number) && number > 0 ? number : void 0;
302
- }
303
- function readPerTokenPrice(value) {
304
- if (typeof value !== "number" && (typeof value !== "string" || !value.trim())) return;
305
- const number = typeof value === "number" ? value : Number(value);
306
- return Number.isFinite(number) && number >= 0 ? Number((number * 1e6).toFixed(9)) : void 0;
307
- }
308
- function readStringArray(value) {
309
- return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
310
- }
311
- function applyLiveReasoningEffortCompat(fallbackCompat, supportsReasoningEffort) {
312
- if (supportsReasoningEffort) return {
313
- ...fallbackCompat,
314
- supportsReasoningEffort: true
315
- };
316
- const compat = { ...fallbackCompat };
317
- delete compat.supportsReasoningEffort;
318
- delete compat.supportedReasoningEfforts;
319
- delete compat.reasoningEffortMap;
320
- return compat;
321
- }
322
- function projectLiveModel(row, fallback) {
323
- if (row.object !== void 0 && row.object !== "model") return;
324
- const id = typeof row.id === "string" ? row.id.trim() : "";
325
- if (!id) return;
326
- const hasLiveFeatures = Array.isArray(row.supported_features);
327
- const features = new Set(readStringArray(row.supported_features));
328
- const pricing = row.pricing && typeof row.pricing === "object" && !Array.isArray(row.pricing) ? row.pricing : {};
329
- const inputPrice = readPerTokenPrice(pricing.prompt);
330
- const outputPrice = readPerTokenPrice(pricing.completion);
331
- const cacheReadPrice = readPerTokenPrice(pricing.input_cache_read);
332
- const supportsReasoningEffort = features.has("reasoning_effort");
333
- const fallbackCompat = fallback?.compat ?? buildBasetenModelCompat(id);
334
- const compat = hasLiveFeatures ? applyLiveReasoningEffortCompat(fallbackCompat, supportsReasoningEffort) : fallbackCompat;
335
- return {
336
- id,
337
- name: typeof row.name === "string" && row.name.trim() ? row.name.trim() : fallback?.name ?? id,
338
- reasoning: hasLiveFeatures ? features.has("reasoning") || supportsReasoningEffort : fallback?.reasoning ?? false,
339
- input: hasLiveFeatures ? features.has("vision") ? ["text", "image"] : ["text"] : fallback?.input ?? ["text"],
340
- cost: {
341
- input: inputPrice ?? fallback?.cost.input ?? 0,
342
- output: outputPrice ?? fallback?.cost.output ?? 0,
343
- cacheRead: cacheReadPrice ?? fallback?.cost.cacheRead ?? 0,
344
- cacheWrite: fallback?.cost.cacheWrite ?? 0
345
- },
346
- contextWindow: readPositiveInteger(row.context_length) ?? fallback?.contextWindow ?? DEFAULT_CONTEXT_WINDOW,
347
- maxTokens: readPositiveInteger(row.max_completion_tokens) ?? fallback?.maxTokens ?? DEFAULT_MAX_TOKENS,
348
- compat
349
- };
350
- }
351
- /** Projects Baseten's authenticated `/models` response into OpenClaw model rows. */
352
- function projectBasetenLiveModels(rows) {
353
- const fallbacks = new Map(buildStaticBasetenModels().map((model) => [model.id, model]));
354
- const seen = /* @__PURE__ */ new Set();
355
- const models = [];
356
- for (const row of rows) {
357
- if (!row || typeof row !== "object" || Array.isArray(row)) continue;
358
- const model = projectLiveModel(row, fallbacks.get(String(row.id)));
359
- if (!model || seen.has(model.id)) continue;
360
- seen.add(model.id);
361
- models.push(model);
362
- }
363
- return models;
364
- }
365
- /** Discovers every model enabled for a Baseten account, with a static fallback. */
366
- async function discoverBasetenModels(params = {}) {
367
- const staticModels = buildStaticBasetenModels();
368
- const env = params.env ?? process.env;
369
- if (!params.discoveryApiKey?.trim() || !params.forceLive && (env.NODE_ENV === "test" || env.VITEST === "true")) return staticModels;
370
- try {
371
- const models = projectBasetenLiveModels(await getCachedLiveProviderModelRows({
372
- providerId: "baseten",
373
- endpoint: `${BASETEN_BASE_URL}/models`,
374
- discoveryApiKey: params.discoveryApiKey,
375
- fetchGuard: params.fetchGuard,
376
- signal: params.signal,
377
- timeoutMs: 1e4,
378
- ttlMs: CACHE_TTL_MS,
379
- policy: ssrfPolicyFromHttpBaseUrlAllowedHostname(BASETEN_BASE_URL),
380
- auditContext: "baseten-model-discovery",
381
- shouldCacheRows: (candidateRows) => projectBasetenLiveModels(candidateRows).length > 0
382
- }));
383
- if (models.length > 0) return models;
384
- log.warn("Baseten returned no usable models; using bundled catalog");
385
- } catch (error) {
386
- log.warn(`Baseten model discovery failed; using bundled catalog: ${String(error)}`);
387
- }
388
- return staticModels;
389
- }
390
- /** Resolves a forward-compatible Baseten model id not yet in the bundled catalog. */
391
- function resolveBasetenDynamicModel(modelId) {
392
- const id = modelId.trim();
393
- if (!id || BASETEN_MODEL_CATALOG.some((model) => model.id === id)) return;
394
- return {
395
- id,
396
- name: id,
397
- provider: "baseten",
398
- api: "openai-completions",
399
- baseUrl: BASETEN_BASE_URL,
400
- reasoning: false,
401
- input: ["text"],
402
- cost: {
403
- input: 0,
404
- output: 0,
405
- cacheRead: 0,
406
- cacheWrite: 0
407
- },
408
- contextWindow: DEFAULT_CONTEXT_WINDOW,
409
- maxTokens: DEFAULT_MAX_TOKENS,
410
- compat: buildBasetenModelCompat(id)
411
- };
412
- }
413
- //#endregion
414
- export { buildBasetenModelCompat as a, discoverBasetenModels as c, usesBasetenChatTemplateThinking as d, BASETEN_MODEL_CATALOG as i, projectBasetenLiveModels as l, BASETEN_DEFAULT_MODEL_ID as n, buildBasetenModelDefinition as o, BASETEN_DEFAULT_MODEL_REF as r, buildStaticBasetenModels as s, BASETEN_BASE_URL as t, resolveBasetenDynamicModel as u };
@@ -1,12 +0,0 @@
1
- {
2
- "name": "@openclaw/baseten-provider",
3
- "version": "2026.7.2-beta.4",
4
- "lockfileVersion": 3,
5
- "requires": true,
6
- "packages": {
7
- "": {
8
- "name": "@openclaw/baseten-provider",
9
- "version": "2026.7.2-beta.4"
10
- }
11
- }
12
- }