@openclaw/deepinfra-provider 2026.7.2-beta.3 → 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.
@@ -1,409 +0,0 @@
1
- import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
2
- import { asPositiveSafeInteger } from "openclaw/plugin-sdk/string-coerce-runtime";
3
- import { isProviderApiKeyConfigured } from "openclaw/plugin-sdk/provider-auth";
4
- import { LiveModelCatalogHttpError, getCachedLiveProviderModelRows } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
5
- import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
6
- import { hasConfiguredSecretInput } from "openclaw/plugin-sdk/secret-input";
7
- //#region extensions/deepinfra/openclaw.plugin.json
8
- var modelCatalog = {
9
- "providers": { "deepinfra": {
10
- "baseUrl": "https://api.deepinfra.com/v1/openai",
11
- "api": "openai-completions",
12
- "models": [
13
- {
14
- "id": "deepseek-ai/DeepSeek-V4-Flash",
15
- "name": "DeepSeek V4 Flash",
16
- "reasoning": true,
17
- "input": ["text"],
18
- "contextWindow": 1048576,
19
- "maxTokens": 1048576,
20
- "cost": {
21
- "input": .1,
22
- "output": .2,
23
- "cacheRead": .02,
24
- "cacheWrite": 0
25
- },
26
- "compat": { "supportsUsageInStreaming": true }
27
- },
28
- {
29
- "id": "deepseek-ai/DeepSeek-V3.2",
30
- "name": "DeepSeek V3.2",
31
- "reasoning": false,
32
- "input": ["text"],
33
- "contextWindow": 163840,
34
- "maxTokens": 163840,
35
- "cost": {
36
- "input": .26,
37
- "output": .38,
38
- "cacheRead": .13,
39
- "cacheWrite": 0
40
- },
41
- "compat": { "supportsUsageInStreaming": true }
42
- },
43
- {
44
- "id": "zai-org/GLM-5.1",
45
- "name": "GLM-5.1",
46
- "reasoning": true,
47
- "input": ["text"],
48
- "contextWindow": 202752,
49
- "maxTokens": 202752,
50
- "cost": {
51
- "input": 1.05,
52
- "output": 3.5,
53
- "cacheRead": .205000005,
54
- "cacheWrite": 0
55
- },
56
- "compat": { "supportsUsageInStreaming": true }
57
- },
58
- {
59
- "id": "stepfun-ai/Step-3.5-Flash",
60
- "name": "Step 3.5 Flash",
61
- "reasoning": false,
62
- "input": ["text"],
63
- "contextWindow": 262144,
64
- "maxTokens": 262144,
65
- "cost": {
66
- "input": .1,
67
- "output": .3,
68
- "cacheRead": .02,
69
- "cacheWrite": 0
70
- },
71
- "compat": { "supportsUsageInStreaming": true }
72
- },
73
- {
74
- "id": "MiniMaxAI/MiniMax-M2.5",
75
- "name": "MiniMax M2.5",
76
- "reasoning": true,
77
- "input": ["text"],
78
- "contextWindow": 196608,
79
- "maxTokens": 196608,
80
- "cost": {
81
- "input": .15,
82
- "output": 1.15,
83
- "cacheRead": .03,
84
- "cacheWrite": 0
85
- },
86
- "compat": { "supportsUsageInStreaming": true }
87
- },
88
- {
89
- "id": "moonshotai/Kimi-K2.5",
90
- "name": "Kimi K2.5",
91
- "reasoning": true,
92
- "input": ["text", "image"],
93
- "contextWindow": 262144,
94
- "maxTokens": 262144,
95
- "cost": {
96
- "input": .45,
97
- "output": 2.25,
98
- "cacheRead": .070000002,
99
- "cacheWrite": 0
100
- },
101
- "compat": { "supportsUsageInStreaming": true }
102
- },
103
- {
104
- "id": "nvidia/NVIDIA-Nemotron-3-Super-120B-A12B",
105
- "name": "NVIDIA Nemotron 3 Super 120B A12B",
106
- "reasoning": true,
107
- "input": ["text"],
108
- "contextWindow": 262144,
109
- "maxTokens": 262144,
110
- "cost": {
111
- "input": .1,
112
- "output": .5,
113
- "cacheRead": 0,
114
- "cacheWrite": 0
115
- },
116
- "compat": { "supportsUsageInStreaming": true }
117
- },
118
- {
119
- "id": "meta-llama/Llama-3.3-70B-Instruct-Turbo",
120
- "name": "Llama 3.3 70B Instruct Turbo",
121
- "reasoning": false,
122
- "input": ["text"],
123
- "contextWindow": 131072,
124
- "maxTokens": 131072,
125
- "cost": {
126
- "input": .1,
127
- "output": .32,
128
- "cacheRead": 0,
129
- "cacheWrite": 0
130
- },
131
- "compat": { "supportsUsageInStreaming": true }
132
- }
133
- ]
134
- } },
135
- "discovery": { "deepinfra": "refreshable" }
136
- };
137
- //#endregion
138
- //#region extensions/deepinfra/provider-models.ts
139
- const log = createSubsystemLogger("deepinfra-models");
140
- const DEEPINFRA_MANIFEST_PROVIDER = buildManifestModelProviderConfig({
141
- providerId: "deepinfra",
142
- catalog: modelCatalog.providers.deepinfra
143
- });
144
- const DEEPINFRA_BASE_URL = DEEPINFRA_MANIFEST_PROVIDER.baseUrl;
145
- const DEEPINFRA_MODELS_URL = `${DEEPINFRA_BASE_URL}/models?sort_by=openclaw&filter=with_meta`;
146
- const DEEPINFRA_DEFAULT_MODEL_REF = `deepinfra/deepseek-ai/DeepSeek-V4-Flash`;
147
- const DEEPINFRA_DEFAULT_CONTEXT_WINDOW = 128e3;
148
- const DEEPINFRA_DEFAULT_MAX_TOKENS = 8192;
149
- const DEEPINFRA_MODEL_CATALOG = DEEPINFRA_MANIFEST_PROVIDER.models;
150
- const DISCOVERY_TIMEOUT_MS = 5e3;
151
- const DISCOVERY_CACHE_TTL_MS = 300 * 1e3;
152
- const SURFACE_FOR_TAG = {
153
- chat: "chat",
154
- vlm: "vlm",
155
- embed: "embed",
156
- "image-gen": "image-gen",
157
- "video-gen": "video-gen",
158
- tts: "tts",
159
- stt: "stt"
160
- };
161
- function entryToSurfaceModel(entry) {
162
- const id = typeof entry?.id === "string" ? entry.id.trim() : "";
163
- if (!id) return null;
164
- const metadata = entry.metadata;
165
- if (!metadata) return null;
166
- const tags = Array.isArray(metadata.tags) ? metadata.tags.filter((t) => typeof t === "string") : [];
167
- const pricing = metadata.pricing ?? {};
168
- return {
169
- id,
170
- name: id,
171
- description: metadata.description ?? void 0,
172
- tags,
173
- contextWindow: asPositiveSafeInteger(metadata.context_length),
174
- maxTokens: asPositiveSafeInteger(metadata.max_tokens),
175
- pricing,
176
- defaultWidth: asPositiveSafeInteger(metadata.default_width),
177
- defaultHeight: asPositiveSafeInteger(metadata.default_height),
178
- defaultIterations: asPositiveSafeInteger(metadata.default_iterations)
179
- };
180
- }
181
- function bucketBySurface(models) {
182
- const catalog = {
183
- chat: [],
184
- vlm: [],
185
- embed: [],
186
- imageGen: [],
187
- videoGen: [],
188
- tts: [],
189
- stt: [],
190
- live: true
191
- };
192
- const buckets = {
193
- chat: catalog.chat,
194
- vlm: catalog.vlm,
195
- embed: catalog.embed,
196
- "image-gen": catalog.imageGen,
197
- "video-gen": catalog.videoGen,
198
- tts: catalog.tts,
199
- stt: catalog.stt
200
- };
201
- for (const model of models) {
202
- const seen = /* @__PURE__ */ new Set();
203
- for (const tag of model.tags) {
204
- const surface = SURFACE_FOR_TAG[tag];
205
- if (surface && !seen.has(surface)) {
206
- seen.add(surface);
207
- buckets[surface].push(model);
208
- }
209
- }
210
- }
211
- return catalog;
212
- }
213
- function hasDeepInfraSurfaceModelRows(rows) {
214
- return rows.some((entry) => entryToSurfaceModel(entry) !== null);
215
- }
216
- function manifestChatEntryToSurfaceModel(entry) {
217
- const cost = entry.cost ?? {};
218
- const pricing = {};
219
- if (typeof cost.input === "number") pricing.input_tokens = cost.input;
220
- if (typeof cost.output === "number") pricing.output_tokens = cost.output;
221
- if (typeof cost.cacheRead === "number" && cost.cacheRead > 0) pricing.cache_read_tokens = cost.cacheRead;
222
- const tags = ["chat"];
223
- if (entry.input?.includes("image")) tags.push("vlm");
224
- if (entry.reasoning) tags.push("reasoning");
225
- return {
226
- id: entry.id,
227
- name: entry.name ?? entry.id,
228
- tags,
229
- contextWindow: entry.contextWindow,
230
- maxTokens: entry.maxTokens,
231
- pricing
232
- };
233
- }
234
- const STATIC_NON_CHAT_FALLBACK = [
235
- {
236
- id: "black-forest-labs/FLUX-1-schnell",
237
- name: "black-forest-labs/FLUX-1-schnell",
238
- tags: ["image-gen"],
239
- pricing: { per_image_unit: .003 },
240
- defaultWidth: 1024,
241
- defaultHeight: 1024,
242
- defaultIterations: 4
243
- },
244
- {
245
- id: "black-forest-labs/FLUX-1-dev",
246
- name: "black-forest-labs/FLUX-1-dev",
247
- tags: ["image-gen"],
248
- pricing: { per_image_unit: .025 },
249
- defaultWidth: 1024,
250
- defaultHeight: 1024,
251
- defaultIterations: 28
252
- },
253
- {
254
- id: "Qwen/Qwen-Image-Max",
255
- name: "Qwen/Qwen-Image-Max",
256
- tags: ["image-gen"],
257
- pricing: { per_image_unit: .075 },
258
- defaultWidth: 1024,
259
- defaultHeight: 1024,
260
- defaultIterations: 28
261
- },
262
- {
263
- id: "stabilityai/sdxl-turbo",
264
- name: "stabilityai/sdxl-turbo",
265
- tags: ["image-gen"],
266
- pricing: { per_image_unit: 2e-4 },
267
- defaultWidth: 1024,
268
- defaultHeight: 1024,
269
- defaultIterations: 4
270
- },
271
- {
272
- id: "hexgrad/Kokoro-82M",
273
- name: "hexgrad/Kokoro-82M",
274
- tags: ["tts"],
275
- pricing: { input_characters: .65 }
276
- },
277
- {
278
- id: "Qwen/Qwen3-TTS",
279
- name: "Qwen/Qwen3-TTS",
280
- tags: ["tts"],
281
- pricing: { input_characters: .65 }
282
- },
283
- {
284
- id: "ResembleAI/chatterbox-turbo",
285
- name: "ResembleAI/chatterbox-turbo",
286
- tags: ["tts"],
287
- pricing: { input_characters: 1 }
288
- },
289
- {
290
- id: "sesame/csm-1b",
291
- name: "sesame/csm-1b",
292
- tags: ["tts"],
293
- pricing: { input_characters: 7 }
294
- },
295
- {
296
- id: "openai/whisper-large-v3-turbo",
297
- name: "openai/whisper-large-v3-turbo",
298
- tags: ["stt"],
299
- pricing: { input_seconds: 4e-5 }
300
- },
301
- {
302
- id: "BAAI/bge-m3",
303
- name: "BAAI/bge-m3",
304
- tags: ["embed"],
305
- pricing: { input_tokens: .01 },
306
- maxTokens: 8192,
307
- contextWindow: 8192
308
- }
309
- ];
310
- function manifestFallbackCatalog() {
311
- const catalog = bucketBySurface([...(modelCatalog.providers.deepinfra.models ?? []).map(manifestChatEntryToSurfaceModel), ...STATIC_NON_CHAT_FALLBACK]);
312
- catalog.live = false;
313
- return catalog;
314
- }
315
- function getDeepInfraSurfaceFallbackCatalog() {
316
- return manifestFallbackCatalog();
317
- }
318
- function buildDeepInfraModelDefinition(model) {
319
- return {
320
- ...model,
321
- compat: {
322
- ...model.compat,
323
- supportsUsageInStreaming: model.compat?.supportsUsageInStreaming ?? true
324
- }
325
- };
326
- }
327
- function chatSurfaceModelToModelDefinition(model) {
328
- const input = model.tags.includes("vlm") ? ["text", "image"] : ["text"];
329
- const reasoning = model.tags.includes("reasoning") || model.tags.includes("reasoning_effort");
330
- return buildDeepInfraModelDefinition({
331
- id: model.id,
332
- name: model.name,
333
- reasoning,
334
- input,
335
- contextWindow: model.contextWindow ?? DEEPINFRA_DEFAULT_CONTEXT_WINDOW,
336
- maxTokens: model.maxTokens ?? DEEPINFRA_DEFAULT_MAX_TOKENS,
337
- cost: {
338
- input: model.pricing.input_tokens ?? 0,
339
- output: model.pricing.output_tokens ?? 0,
340
- cacheRead: model.pricing.cache_read_tokens ?? 0,
341
- cacheWrite: 0
342
- }
343
- });
344
- }
345
- function hasDeepInfraApiKey(options) {
346
- const fromEnv = (options?.env ?? process.env).DEEPINFRA_API_KEY;
347
- if (typeof fromEnv === "string" && fromEnv.trim() !== "") return true;
348
- const providers = options?.config?.models?.providers;
349
- for (const [providerId, provider] of Object.entries(providers ?? {})) if (providerId.trim().toLowerCase() === "deepinfra" && hasConfiguredSecretInput(provider?.apiKey, options?.config?.secrets?.defaults)) return true;
350
- return isProviderApiKeyConfigured({
351
- provider: "deepinfra",
352
- agentDir: options?.agentDir
353
- });
354
- }
355
- async function discoverDeepInfraSurfaces(options) {
356
- if (process.env.VITEST) return manifestFallbackCatalog();
357
- const env = options?.env ?? process.env;
358
- if (!(options?.hasApiKey ?? hasDeepInfraApiKey({
359
- env,
360
- agentDir: options?.agentDir
361
- }))) return manifestFallbackCatalog();
362
- try {
363
- const data = await getCachedLiveProviderModelRows({
364
- providerId: "deepinfra",
365
- endpoint: DEEPINFRA_MODELS_URL,
366
- timeoutMs: DISCOVERY_TIMEOUT_MS,
367
- ttlMs: DISCOVERY_CACHE_TTL_MS,
368
- buildRequestHeaders: () => ({ Accept: "application/json" }),
369
- auditContext: "deepinfra-model-discovery",
370
- shouldCacheRows: hasDeepInfraSurfaceModelRows
371
- });
372
- if (data.length === 0) {
373
- log.warn("No models found from DeepInfra agent-projection endpoint, using static catalog");
374
- return manifestFallbackCatalog();
375
- }
376
- const seenIds = /* @__PURE__ */ new Set();
377
- const surfaceModels = [];
378
- for (const entry of data) {
379
- const model = entryToSurfaceModel(entry);
380
- if (!model || seenIds.has(model.id)) continue;
381
- seenIds.add(model.id);
382
- surfaceModels.push(model);
383
- }
384
- if (surfaceModels.length === 0) return manifestFallbackCatalog();
385
- return bucketBySurface(surfaceModels);
386
- } catch (error) {
387
- if (error instanceof LiveModelCatalogHttpError) {
388
- log.warn(`Failed to discover models: HTTP ${error.status}, using static catalog`);
389
- return manifestFallbackCatalog();
390
- }
391
- log.warn(`Discovery failed: ${String(error)}, using static catalog`);
392
- return manifestFallbackCatalog();
393
- }
394
- }
395
- async function discoverDeepInfraModels(options) {
396
- const catalog = await discoverDeepInfraSurfaces(options);
397
- const chatModels = catalog.chat.length > 0 ? catalog.chat : [...catalog.chat, ...catalog.vlm];
398
- if (chatModels.length === 0) return DEEPINFRA_MODEL_CATALOG.map(buildDeepInfraModelDefinition);
399
- const liveModels = chatModels.map(chatSurfaceModelToModelDefinition);
400
- const seen = new Set(liveModels.map((model) => model.id));
401
- const manifestModels = DEEPINFRA_MODEL_CATALOG.map(buildDeepInfraModelDefinition).filter((model) => {
402
- if (seen.has(model.id)) return false;
403
- seen.add(model.id);
404
- return true;
405
- });
406
- return [...liveModels, ...manifestModels];
407
- }
408
- //#endregion
409
- export { discoverDeepInfraModels as a, hasDeepInfraApiKey as c, buildDeepInfraModelDefinition as i, DEEPINFRA_DEFAULT_MODEL_REF as n, discoverDeepInfraSurfaces as o, DEEPINFRA_MODEL_CATALOG as r, getDeepInfraSurfaceFallbackCatalog as s, DEEPINFRA_BASE_URL as t };
@@ -1,12 +0,0 @@
1
- {
2
- "name": "@openclaw/deepinfra-provider",
3
- "version": "2026.7.2-beta.3",
4
- "lockfileVersion": 3,
5
- "requires": true,
6
- "packages": {
7
- "": {
8
- "name": "@openclaw/deepinfra-provider",
9
- "version": "2026.7.2-beta.3"
10
- }
11
- }
12
- }