@openclaw/baseten-provider 2026.7.2-beta.4 → 2026.7.2-beta.5
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 +3 -3
- package/dist/index.js +22 -20
- package/dist/models-B_KWtCCg.js +367 -0
- package/dist/models.js +2 -2
- package/dist/onboard.js +1 -1
- package/dist/provider-catalog.js +2 -10
- package/dist/stream.js +7 -13
- package/dist/thinking.js +2 -2
- package/openclaw.plugin.json +51 -67
- package/package.json +4 -5
- package/dist/models-Dg5jGc7M.js +0 -414
- package/npm-shrinkwrap.json +0 -12
package/dist/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as buildBasetenModelCompat, c as
|
|
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-B_KWtCCg.js";
|
|
2
2
|
import { applyBasetenConfig } from "./onboard.js";
|
|
3
|
-
import {
|
|
4
|
-
export { BASETEN_BASE_URL, BASETEN_DEFAULT_MODEL_ID, BASETEN_DEFAULT_MODEL_REF, BASETEN_MODEL_CATALOG, applyBasetenConfig, buildBasetenModelCompat,
|
|
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 {
|
|
1
|
+
import { c as resolveBasetenDynamicModel, s as projectBasetenLiveModels, u as openclaw_plugin_default } from "./models-B_KWtCCg.js";
|
|
2
2
|
import { applyBasetenConfig } from "./onboard.js";
|
|
3
|
-
import {
|
|
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
|
-
|
|
18
|
-
|
|
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
|
-
|
|
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
|
-
...
|
|
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,367 @@
|
|
|
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
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "zai-org/GLM-4.7",
|
|
36
|
+
"name": "GLM 4.7",
|
|
37
|
+
"reasoning": true,
|
|
38
|
+
"input": ["text"],
|
|
39
|
+
"contextWindow": 2e5,
|
|
40
|
+
"maxTokens": 2e5,
|
|
41
|
+
"cost": {
|
|
42
|
+
"input": .6,
|
|
43
|
+
"output": 2.2,
|
|
44
|
+
"cacheRead": .12,
|
|
45
|
+
"cacheWrite": 0
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": "zai-org/GLM-5.2",
|
|
50
|
+
"name": "GLM 5.2",
|
|
51
|
+
"reasoning": true,
|
|
52
|
+
"input": ["text"],
|
|
53
|
+
"contextWindow": 524e3,
|
|
54
|
+
"maxTokens": 262e3,
|
|
55
|
+
"cost": {
|
|
56
|
+
"input": 1.4,
|
|
57
|
+
"output": 4.4,
|
|
58
|
+
"cacheRead": .14,
|
|
59
|
+
"cacheWrite": 0
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"id": "zai-org/GLM-5.2-Fast",
|
|
64
|
+
"name": "GLM 5.2 Fast",
|
|
65
|
+
"reasoning": true,
|
|
66
|
+
"input": ["text"],
|
|
67
|
+
"contextWindow": 524e3,
|
|
68
|
+
"maxTokens": 262e3,
|
|
69
|
+
"cost": {
|
|
70
|
+
"input": 2.1,
|
|
71
|
+
"output": 6.6,
|
|
72
|
+
"cacheRead": .21,
|
|
73
|
+
"cacheWrite": 0
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"id": "thinkingmachines/inkling",
|
|
78
|
+
"name": "Inkling",
|
|
79
|
+
"reasoning": true,
|
|
80
|
+
"input": ["text", "image"],
|
|
81
|
+
"contextWindow": 1048e3,
|
|
82
|
+
"maxTokens": 32e3,
|
|
83
|
+
"cost": {
|
|
84
|
+
"input": 1,
|
|
85
|
+
"output": 4.05,
|
|
86
|
+
"cacheRead": .17,
|
|
87
|
+
"cacheWrite": 0
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"id": "moonshotai/Kimi-K2.6",
|
|
92
|
+
"name": "Kimi K2.6",
|
|
93
|
+
"reasoning": true,
|
|
94
|
+
"input": ["text", "image"],
|
|
95
|
+
"contextWindow": 262e3,
|
|
96
|
+
"maxTokens": 262e3,
|
|
97
|
+
"cost": {
|
|
98
|
+
"input": .95,
|
|
99
|
+
"output": 4,
|
|
100
|
+
"cacheRead": .16,
|
|
101
|
+
"cacheWrite": 0
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"id": "moonshotai/Kimi-K2.7-Code",
|
|
106
|
+
"name": "Kimi K2.7 Code",
|
|
107
|
+
"reasoning": true,
|
|
108
|
+
"input": ["text", "image"],
|
|
109
|
+
"contextWindow": 262e3,
|
|
110
|
+
"maxTokens": 262e3,
|
|
111
|
+
"cost": {
|
|
112
|
+
"input": .95,
|
|
113
|
+
"output": 4,
|
|
114
|
+
"cacheRead": .16,
|
|
115
|
+
"cacheWrite": 0
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"id": "nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B",
|
|
120
|
+
"name": "Nemotron Ultra",
|
|
121
|
+
"reasoning": true,
|
|
122
|
+
"input": ["text"],
|
|
123
|
+
"contextWindow": 202e3,
|
|
124
|
+
"maxTokens": 202e3,
|
|
125
|
+
"cost": {
|
|
126
|
+
"input": .6,
|
|
127
|
+
"output": 2.4,
|
|
128
|
+
"cacheRead": .12,
|
|
129
|
+
"cacheWrite": 0
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"id": "openai/gpt-oss-120b",
|
|
134
|
+
"name": "GPT OSS 120B",
|
|
135
|
+
"reasoning": true,
|
|
136
|
+
"input": ["text"],
|
|
137
|
+
"contextWindow": 128e3,
|
|
138
|
+
"maxTokens": 128e3,
|
|
139
|
+
"cost": {
|
|
140
|
+
"input": .1,
|
|
141
|
+
"output": .5,
|
|
142
|
+
"cacheRead": 0,
|
|
143
|
+
"cacheWrite": 0
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
} },
|
|
148
|
+
"discovery": { "baseten": "refreshable" }
|
|
149
|
+
},
|
|
150
|
+
setup: { "providers": [{
|
|
151
|
+
"id": "baseten",
|
|
152
|
+
"envVars": ["BASETEN_API_KEY"]
|
|
153
|
+
}] },
|
|
154
|
+
providerAuthChoices: [{
|
|
155
|
+
"provider": "baseten",
|
|
156
|
+
"method": "api-key",
|
|
157
|
+
"choiceId": "baseten-api-key",
|
|
158
|
+
"appGuidedSecret": true,
|
|
159
|
+
"choiceLabel": "Baseten API key",
|
|
160
|
+
"groupId": "baseten",
|
|
161
|
+
"groupLabel": "Baseten",
|
|
162
|
+
"groupHint": "Hosted Model APIs, including Inkling",
|
|
163
|
+
"optionKey": "basetenApiKey",
|
|
164
|
+
"cliFlag": "--baseten-api-key",
|
|
165
|
+
"cliOption": "--baseten-api-key <key>",
|
|
166
|
+
"cliDescription": "Baseten API key"
|
|
167
|
+
}],
|
|
168
|
+
configSchema: {
|
|
169
|
+
"type": "object",
|
|
170
|
+
"additionalProperties": false,
|
|
171
|
+
"properties": {}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region extensions/baseten/models.ts
|
|
176
|
+
/**
|
|
177
|
+
* Baseten model catalog, compat metadata, and live row projection.
|
|
178
|
+
*/
|
|
179
|
+
const BASETEN_MANIFEST_CATALOG = openclaw_plugin_default.modelCatalog.providers.baseten;
|
|
180
|
+
const DEFAULT_CONTEXT_WINDOW = 128e3;
|
|
181
|
+
const DEFAULT_MAX_TOKENS = 8192;
|
|
182
|
+
const CHAT_TEMPLATE_THINKING_MODEL_IDS = /* @__PURE__ */ new Set([
|
|
183
|
+
"zai-org/glm-4.7",
|
|
184
|
+
"zai-org/glm-5.2",
|
|
185
|
+
"zai-org/glm-5.2-fast",
|
|
186
|
+
"moonshotai/kimi-k2.6",
|
|
187
|
+
"moonshotai/kimi-k2.7-code",
|
|
188
|
+
"nvidia/nvidia-nemotron-3-ultra-550b-a55b"
|
|
189
|
+
]);
|
|
190
|
+
const FULL_REASONING_EFFORT_MODEL_IDS = /* @__PURE__ */ new Set(["deepseek-ai/DeepSeek-V4-Pro", "openai/gpt-oss-120b"]);
|
|
191
|
+
const INKLING_REASONING_EFFORTS = [
|
|
192
|
+
"none",
|
|
193
|
+
"minimal",
|
|
194
|
+
"low",
|
|
195
|
+
"medium",
|
|
196
|
+
"high",
|
|
197
|
+
"xhigh"
|
|
198
|
+
];
|
|
199
|
+
const FULL_REASONING_EFFORTS = [...INKLING_REASONING_EFFORTS, "max"];
|
|
200
|
+
const BASE_COMPAT = {
|
|
201
|
+
supportsStore: false,
|
|
202
|
+
supportsDeveloperRole: false,
|
|
203
|
+
supportsUsageInStreaming: true,
|
|
204
|
+
supportsStrictMode: true,
|
|
205
|
+
supportsTools: true,
|
|
206
|
+
maxTokensField: "max_tokens"
|
|
207
|
+
};
|
|
208
|
+
/** Base URL for Baseten's OpenAI-compatible Model APIs. */
|
|
209
|
+
const BASETEN_BASE_URL = BASETEN_MANIFEST_CATALOG.baseUrl;
|
|
210
|
+
/** Default Baseten model id used for onboarding. */
|
|
211
|
+
const BASETEN_DEFAULT_MODEL_ID = BASETEN_MANIFEST_CATALOG.defaultModel;
|
|
212
|
+
/** Default Baseten model ref used for onboarding. */
|
|
213
|
+
const BASETEN_DEFAULT_MODEL_REF = readManifestProviderDefaultModelRef(openclaw_plugin_default, "baseten");
|
|
214
|
+
/** Bundled fallback rows for all Baseten Model APIs available at release time. */
|
|
215
|
+
const BASETEN_MODEL_CATALOG = BASETEN_MANIFEST_CATALOG.models;
|
|
216
|
+
/** Whether Baseten requires chat-template thinking control for this model. */
|
|
217
|
+
function usesBasetenChatTemplateThinking(modelId) {
|
|
218
|
+
return CHAT_TEMPLATE_THINKING_MODEL_IDS.has(modelId.trim().toLowerCase());
|
|
219
|
+
}
|
|
220
|
+
function buildBasetenReasoningCompat(modelId) {
|
|
221
|
+
if (FULL_REASONING_EFFORT_MODEL_IDS.has(modelId)) return {
|
|
222
|
+
supportsReasoningEffort: true,
|
|
223
|
+
supportedReasoningEfforts: FULL_REASONING_EFFORTS,
|
|
224
|
+
reasoningEffortMap: {
|
|
225
|
+
off: "none",
|
|
226
|
+
none: "none",
|
|
227
|
+
adaptive: "max"
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
if (modelId === BASETEN_DEFAULT_MODEL_ID) return {
|
|
231
|
+
supportsReasoningEffort: true,
|
|
232
|
+
supportedReasoningEfforts: INKLING_REASONING_EFFORTS,
|
|
233
|
+
reasoningEffortMap: {
|
|
234
|
+
off: "none",
|
|
235
|
+
none: "none",
|
|
236
|
+
adaptive: "xhigh",
|
|
237
|
+
max: "xhigh"
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
if (modelId === "zai-org/GLM-5.2" || modelId === "zai-org/GLM-5.2-Fast") return {
|
|
241
|
+
supportsReasoningEffort: true,
|
|
242
|
+
supportedReasoningEfforts: [
|
|
243
|
+
"none",
|
|
244
|
+
"high",
|
|
245
|
+
"max"
|
|
246
|
+
],
|
|
247
|
+
reasoningEffortMap: {
|
|
248
|
+
off: "none",
|
|
249
|
+
none: "none",
|
|
250
|
+
minimal: "high",
|
|
251
|
+
low: "high",
|
|
252
|
+
medium: "high",
|
|
253
|
+
xhigh: "high",
|
|
254
|
+
adaptive: "max"
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
return {};
|
|
258
|
+
}
|
|
259
|
+
/** Complete OpenAI-compatible transport policy for one Baseten model. */
|
|
260
|
+
function buildBasetenModelCompat(modelId) {
|
|
261
|
+
return {
|
|
262
|
+
...BASE_COMPAT,
|
|
263
|
+
...buildBasetenReasoningCompat(modelId)
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
/** Builds the network-free fallback catalog. */
|
|
267
|
+
function buildStaticBasetenModels() {
|
|
268
|
+
return BASETEN_MODEL_CATALOG.map(buildManifestModelDefinition({
|
|
269
|
+
providerId: "baseten",
|
|
270
|
+
catalog: BASETEN_MANIFEST_CATALOG,
|
|
271
|
+
decorate: (normalized) => ({
|
|
272
|
+
...normalized,
|
|
273
|
+
compat: buildBasetenModelCompat(normalized.id)
|
|
274
|
+
})
|
|
275
|
+
}));
|
|
276
|
+
}
|
|
277
|
+
function readPositiveInteger(value) {
|
|
278
|
+
const number = typeof value === "number" ? value : Number(value);
|
|
279
|
+
return Number.isSafeInteger(number) && number > 0 ? number : void 0;
|
|
280
|
+
}
|
|
281
|
+
function readPerTokenPrice(value) {
|
|
282
|
+
if (typeof value !== "number" && (typeof value !== "string" || !value.trim())) return;
|
|
283
|
+
const number = typeof value === "number" ? value : Number(value);
|
|
284
|
+
return Number.isFinite(number) && number >= 0 ? Number((number * 1e6).toFixed(9)) : void 0;
|
|
285
|
+
}
|
|
286
|
+
function readStringArray(value) {
|
|
287
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
288
|
+
}
|
|
289
|
+
function applyLiveReasoningEffortCompat(fallbackCompat, supportsReasoningEffort) {
|
|
290
|
+
if (supportsReasoningEffort) return {
|
|
291
|
+
...fallbackCompat,
|
|
292
|
+
supportsReasoningEffort: true
|
|
293
|
+
};
|
|
294
|
+
const compat = { ...fallbackCompat };
|
|
295
|
+
delete compat.supportsReasoningEffort;
|
|
296
|
+
delete compat.supportedReasoningEfforts;
|
|
297
|
+
delete compat.reasoningEffortMap;
|
|
298
|
+
return compat;
|
|
299
|
+
}
|
|
300
|
+
function projectLiveModel(row, fallback) {
|
|
301
|
+
if (row.object !== void 0 && row.object !== "model") return;
|
|
302
|
+
const id = typeof row.id === "string" ? row.id.trim() : "";
|
|
303
|
+
if (!id) return;
|
|
304
|
+
const hasLiveFeatures = Array.isArray(row.supported_features);
|
|
305
|
+
const features = new Set(readStringArray(row.supported_features));
|
|
306
|
+
const pricing = row.pricing && typeof row.pricing === "object" && !Array.isArray(row.pricing) ? row.pricing : {};
|
|
307
|
+
const inputPrice = readPerTokenPrice(pricing.prompt);
|
|
308
|
+
const outputPrice = readPerTokenPrice(pricing.completion);
|
|
309
|
+
const cacheReadPrice = readPerTokenPrice(pricing.input_cache_read);
|
|
310
|
+
const supportsReasoningEffort = features.has("reasoning_effort");
|
|
311
|
+
const fallbackCompat = fallback?.compat ?? buildBasetenModelCompat(id);
|
|
312
|
+
const compat = hasLiveFeatures ? applyLiveReasoningEffortCompat(fallbackCompat, supportsReasoningEffort) : fallbackCompat;
|
|
313
|
+
return {
|
|
314
|
+
id,
|
|
315
|
+
name: typeof row.name === "string" && row.name.trim() ? row.name.trim() : fallback?.name ?? id,
|
|
316
|
+
reasoning: hasLiveFeatures ? features.has("reasoning") || supportsReasoningEffort : fallback?.reasoning ?? false,
|
|
317
|
+
input: hasLiveFeatures ? features.has("vision") ? ["text", "image"] : ["text"] : fallback?.input ?? ["text"],
|
|
318
|
+
cost: {
|
|
319
|
+
input: inputPrice ?? fallback?.cost.input ?? 0,
|
|
320
|
+
output: outputPrice ?? fallback?.cost.output ?? 0,
|
|
321
|
+
cacheRead: cacheReadPrice ?? fallback?.cost.cacheRead ?? 0,
|
|
322
|
+
cacheWrite: fallback?.cost.cacheWrite ?? 0
|
|
323
|
+
},
|
|
324
|
+
contextWindow: readPositiveInteger(row.context_length) ?? fallback?.contextWindow ?? DEFAULT_CONTEXT_WINDOW,
|
|
325
|
+
maxTokens: readPositiveInteger(row.max_completion_tokens) ?? fallback?.maxTokens ?? DEFAULT_MAX_TOKENS,
|
|
326
|
+
compat
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
/** Projects Baseten's authenticated `/models` response into OpenClaw model rows. */
|
|
330
|
+
function projectBasetenLiveModels(rows) {
|
|
331
|
+
const fallbacks = new Map(buildStaticBasetenModels().map((model) => [model.id, model]));
|
|
332
|
+
const seen = /* @__PURE__ */ new Set();
|
|
333
|
+
const models = [];
|
|
334
|
+
for (const row of rows) {
|
|
335
|
+
if (!row || typeof row !== "object" || Array.isArray(row)) continue;
|
|
336
|
+
const model = projectLiveModel(row, fallbacks.get(String(row.id)));
|
|
337
|
+
if (!model || seen.has(model.id)) continue;
|
|
338
|
+
seen.add(model.id);
|
|
339
|
+
models.push(model);
|
|
340
|
+
}
|
|
341
|
+
return models;
|
|
342
|
+
}
|
|
343
|
+
/** Resolves a forward-compatible Baseten model id not yet in the bundled catalog. */
|
|
344
|
+
function resolveBasetenDynamicModel(modelId) {
|
|
345
|
+
const id = modelId.trim();
|
|
346
|
+
if (!id || BASETEN_MODEL_CATALOG.some((model) => model.id === id)) return;
|
|
347
|
+
return {
|
|
348
|
+
id,
|
|
349
|
+
name: id,
|
|
350
|
+
provider: "baseten",
|
|
351
|
+
api: "openai-completions",
|
|
352
|
+
baseUrl: BASETEN_BASE_URL,
|
|
353
|
+
reasoning: false,
|
|
354
|
+
input: ["text"],
|
|
355
|
+
cost: {
|
|
356
|
+
input: 0,
|
|
357
|
+
output: 0,
|
|
358
|
+
cacheRead: 0,
|
|
359
|
+
cacheWrite: 0
|
|
360
|
+
},
|
|
361
|
+
contextWindow: DEFAULT_CONTEXT_WINDOW,
|
|
362
|
+
maxTokens: DEFAULT_MAX_TOKENS,
|
|
363
|
+
compat: buildBasetenModelCompat(id)
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
//#endregion
|
|
367
|
+
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
|
|
2
|
-
export { BASETEN_BASE_URL, BASETEN_DEFAULT_MODEL_ID, BASETEN_DEFAULT_MODEL_REF, BASETEN_MODEL_CATALOG, buildBasetenModelCompat,
|
|
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-B_KWtCCg.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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as buildStaticBasetenModels, r as BASETEN_DEFAULT_MODEL_REF, t as BASETEN_BASE_URL } from "./models-B_KWtCCg.js";
|
|
2
2
|
import { createModelCatalogPresetAppliers } from "openclaw/plugin-sdk/provider-onboard";
|
|
3
3
|
//#region extensions/baseten/onboard.ts
|
|
4
4
|
/** Baseten onboarding config helpers. */
|
package/dist/provider-catalog.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as buildStaticBasetenModels, t as BASETEN_BASE_URL } from "./models-B_KWtCCg.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 {
|
|
12
|
+
export { buildStaticBasetenProvider };
|
package/dist/stream.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createPayloadPatchStreamWrapper } from "openclaw/plugin-sdk/provider-stream-shared";
|
|
1
|
+
import { l as usesBasetenChatTemplateThinking } from "./models-B_KWtCCg.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))
|
|
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 {
|
|
1
|
+
import { l as usesBasetenChatTemplateThinking } from "./models-B_KWtCCg.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
|
package/openclaw.plugin.json
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
"onStartup": false
|
|
7
7
|
},
|
|
8
8
|
"enabledByDefault": true,
|
|
9
|
-
"providers": [
|
|
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": [
|
|
33
|
+
"input": [
|
|
34
|
+
"text"
|
|
35
|
+
],
|
|
31
36
|
"contextWindow": 262000,
|
|
32
37
|
"maxTokens": 262000,
|
|
33
38
|
"cost": {
|
|
@@ -41,7 +46,9 @@
|
|
|
41
46
|
"id": "zai-org/GLM-4.7",
|
|
42
47
|
"name": "GLM 4.7",
|
|
43
48
|
"reasoning": true,
|
|
44
|
-
"input": [
|
|
49
|
+
"input": [
|
|
50
|
+
"text"
|
|
51
|
+
],
|
|
45
52
|
"contextWindow": 200000,
|
|
46
53
|
"maxTokens": 200000,
|
|
47
54
|
"cost": {
|
|
@@ -52,44 +59,34 @@
|
|
|
52
59
|
}
|
|
53
60
|
},
|
|
54
61
|
{
|
|
55
|
-
"id": "zai-org/GLM-5",
|
|
56
|
-
"name": "GLM 5",
|
|
62
|
+
"id": "zai-org/GLM-5.2",
|
|
63
|
+
"name": "GLM 5.2",
|
|
57
64
|
"reasoning": true,
|
|
58
|
-
"input": [
|
|
59
|
-
|
|
60
|
-
|
|
65
|
+
"input": [
|
|
66
|
+
"text"
|
|
67
|
+
],
|
|
68
|
+
"contextWindow": 524000,
|
|
69
|
+
"maxTokens": 262000,
|
|
61
70
|
"cost": {
|
|
62
|
-
"input":
|
|
63
|
-
"output":
|
|
64
|
-
"cacheRead": 0.
|
|
71
|
+
"input": 1.4,
|
|
72
|
+
"output": 4.4,
|
|
73
|
+
"cacheRead": 0.14,
|
|
65
74
|
"cacheWrite": 0
|
|
66
75
|
}
|
|
67
76
|
},
|
|
68
77
|
{
|
|
69
|
-
"id": "zai-org/GLM-5.
|
|
70
|
-
"name": "GLM 5.
|
|
78
|
+
"id": "zai-org/GLM-5.2-Fast",
|
|
79
|
+
"name": "GLM 5.2 Fast",
|
|
71
80
|
"reasoning": true,
|
|
72
|
-
"input": [
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
"input": [
|
|
82
|
+
"text"
|
|
83
|
+
],
|
|
84
|
+
"contextWindow": 524000,
|
|
85
|
+
"maxTokens": 262000,
|
|
75
86
|
"cost": {
|
|
76
|
-
"input": 1
|
|
77
|
-
"output":
|
|
78
|
-
"cacheRead": 0.
|
|
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,
|
|
87
|
+
"input": 2.1,
|
|
88
|
+
"output": 6.6,
|
|
89
|
+
"cacheRead": 0.21,
|
|
93
90
|
"cacheWrite": 0
|
|
94
91
|
}
|
|
95
92
|
},
|
|
@@ -97,7 +94,10 @@
|
|
|
97
94
|
"id": "thinkingmachines/inkling",
|
|
98
95
|
"name": "Inkling",
|
|
99
96
|
"reasoning": true,
|
|
100
|
-
"input": [
|
|
97
|
+
"input": [
|
|
98
|
+
"text",
|
|
99
|
+
"image"
|
|
100
|
+
],
|
|
101
101
|
"contextWindow": 1048000,
|
|
102
102
|
"maxTokens": 32000,
|
|
103
103
|
"cost": {
|
|
@@ -107,25 +107,14 @@
|
|
|
107
107
|
"cacheWrite": 0
|
|
108
108
|
}
|
|
109
109
|
},
|
|
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
110
|
{
|
|
125
111
|
"id": "moonshotai/Kimi-K2.6",
|
|
126
112
|
"name": "Kimi K2.6",
|
|
127
113
|
"reasoning": true,
|
|
128
|
-
"input": [
|
|
114
|
+
"input": [
|
|
115
|
+
"text",
|
|
116
|
+
"image"
|
|
117
|
+
],
|
|
129
118
|
"contextWindow": 262000,
|
|
130
119
|
"maxTokens": 262000,
|
|
131
120
|
"cost": {
|
|
@@ -139,7 +128,10 @@
|
|
|
139
128
|
"id": "moonshotai/Kimi-K2.7-Code",
|
|
140
129
|
"name": "Kimi K2.7 Code",
|
|
141
130
|
"reasoning": true,
|
|
142
|
-
"input": [
|
|
131
|
+
"input": [
|
|
132
|
+
"text",
|
|
133
|
+
"image"
|
|
134
|
+
],
|
|
143
135
|
"contextWindow": 262000,
|
|
144
136
|
"maxTokens": 262000,
|
|
145
137
|
"cost": {
|
|
@@ -149,25 +141,13 @@
|
|
|
149
141
|
"cacheWrite": 0
|
|
150
142
|
}
|
|
151
143
|
},
|
|
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
144
|
{
|
|
167
145
|
"id": "nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B",
|
|
168
146
|
"name": "Nemotron Ultra",
|
|
169
147
|
"reasoning": true,
|
|
170
|
-
"input": [
|
|
148
|
+
"input": [
|
|
149
|
+
"text"
|
|
150
|
+
],
|
|
171
151
|
"contextWindow": 202000,
|
|
172
152
|
"maxTokens": 202000,
|
|
173
153
|
"cost": {
|
|
@@ -181,7 +161,9 @@
|
|
|
181
161
|
"id": "openai/gpt-oss-120b",
|
|
182
162
|
"name": "GPT OSS 120B",
|
|
183
163
|
"reasoning": true,
|
|
184
|
-
"input": [
|
|
164
|
+
"input": [
|
|
165
|
+
"text"
|
|
166
|
+
],
|
|
185
167
|
"contextWindow": 128000,
|
|
186
168
|
"maxTokens": 128000,
|
|
187
169
|
"cost": {
|
|
@@ -202,7 +184,9 @@
|
|
|
202
184
|
"providers": [
|
|
203
185
|
{
|
|
204
186
|
"id": "baseten",
|
|
205
|
-
"envVars": [
|
|
187
|
+
"envVars": [
|
|
188
|
+
"BASETEN_API_KEY"
|
|
189
|
+
]
|
|
206
190
|
}
|
|
207
191
|
]
|
|
208
192
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/baseten-provider",
|
|
3
|
-
"version": "2026.7.2-beta.
|
|
3
|
+
"version": "2026.7.2-beta.5",
|
|
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.
|
|
21
|
+
"pluginApi": ">=2026.7.2-beta.5"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.7.2-beta.
|
|
24
|
+
"openclawVersion": "2026.7.2-beta.5",
|
|
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.
|
|
41
|
+
"openclaw": ">=2026.7.2-beta.5"
|
|
43
42
|
},
|
|
44
43
|
"peerDependenciesMeta": {
|
|
45
44
|
"openclaw": {
|
package/dist/models-Dg5jGc7M.js
DELETED
|
@@ -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 };
|
package/npm-shrinkwrap.json
DELETED