@openclaw/deepinfra-provider 2026.9.1 → 2026.9.3

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,7 +1,7 @@
1
- import { DEEPINFRA_DEFAULT_MODEL_REF } from "./provider-models.js";
2
1
  import { deepinfraEmbeddingProviderAdapter } from "./embedding-adapter.js";
3
2
  import { buildDeepInfraImageGenerationProvider } from "./image-generation-provider.js";
4
3
  import { deepinfraMediaUnderstandingProvider } from "./media-understanding-provider.js";
4
+ import { DEEPINFRA_DEFAULT_MODEL_REF } from "./provider-models.js";
5
5
  import { applyDeepInfraConfig } from "./onboard.js";
6
6
  import { buildDeepInfraProvider, buildStaticDeepInfraProvider } from "./provider-catalog.js";
7
7
  import { buildDeepInfraSpeechProvider } from "./speech-provider.js";
@@ -1,9 +1,19 @@
1
- import { applyAnthropicEphemeralCacheControlMarkers, createPayloadPatchStreamWrapper } from "openclaw/plugin-sdk/provider-stream-shared";
1
+ import { applyAnthropicEphemeralCacheControlMarkers, applyCompletionsAnthropicCacheControl, createPayloadPatchStreamWrapper } from "openclaw/plugin-sdk/provider-stream-shared";
2
2
  //#region extensions/deepinfra/cache-wrapper.ts
3
- function createDeepInfraAnthropicCacheWrapper(baseStreamFn) {
4
- return createPayloadPatchStreamWrapper(baseStreamFn, ({ payload }) => {
5
- applyAnthropicEphemeralCacheControlMarkers(payload);
6
- }, { shouldPatch: ({ model }) => model.id.toLowerCase().startsWith("anthropic/") });
3
+ function createDeepInfraAnthropicCacheWrapper(baseStreamFn, extraParams) {
4
+ return (model, context, options) => {
5
+ if (!model.id.toLowerCase().startsWith("anthropic/")) return baseStreamFn(model, context, options);
6
+ const isCompletions = model.api === "openai-completions";
7
+ const configured = options?.cacheRetention ?? extraParams?.cacheRetention;
8
+ const cacheRetention = configured === "none" || configured === "long" ? configured : "short";
9
+ return createPayloadPatchStreamWrapper(baseStreamFn, ({ payload }) => {
10
+ if (isCompletions) applyCompletionsAnthropicCacheControl(payload, cacheRetention === "none" ? null : { type: "ephemeral" });
11
+ else applyAnthropicEphemeralCacheControlMarkers(payload);
12
+ })(model, context, isCompletions ? {
13
+ ...options,
14
+ cacheRetention
15
+ } : options);
16
+ };
7
17
  }
8
18
  //#endregion
9
19
  export { createDeepInfraAnthropicCacheWrapper };
@@ -0,0 +1,5 @@
1
+ import { buildDeepInfraSpeechProvider } from "./speech-provider.js";
2
+ //#region extensions/deepinfra/capability-catalog.ts
3
+ var capability_catalog_default = { speechProviders: [buildDeepInfraSpeechProvider()] };
4
+ //#endregion
5
+ export { capability_catalog_default as default };
@@ -1,4 +1,4 @@
1
- import { t as modelCatalog } from "./openclaw.plugin-CWb9nYB8.js";
1
+ import { t as modelCatalog } from "./openclaw.plugin-BRaVociw.js";
2
2
  import { asObjectRecord } from "openclaw/plugin-sdk/runtime-doctor-migrations";
3
3
  //#region extensions/deepinfra/doctor-contract-api.ts
4
4
  const PROVIDER_PATH = "models.providers.deepinfra";
@@ -1,4 +1,4 @@
1
- import { DEEPINFRA_BASE_URL } from "./provider-models.js";
1
+ import { DEEPINFRA_BASE_URL } from "./media-models.js";
2
2
  import { DEFAULT_DEEPINFRA_EMBEDDING_MODEL, createDeepInfraEmbeddingProvider } from "./embedding-provider.js";
3
3
  import { embeddingProviderOwnsDestination, sanitizeEmbeddingCacheHeaders } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
4
4
  //#region extensions/deepinfra/embedding-adapter.ts
@@ -1,5 +1,4 @@
1
- import { DEEPINFRA_BASE_URL } from "./provider-models.js";
2
- import { DEEPINFRA_EMBED_FALLBACK_MODELS, normalizeDeepInfraModelRef } from "./media-models.js";
1
+ import { DEEPINFRA_BASE_URL, DEEPINFRA_EMBED_FALLBACK_MODELS, normalizeDeepInfraModelRef } from "./media-models.js";
3
2
  import { createRemoteEmbeddingProvider, resolveRemoteEmbeddingClient } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
4
3
  //#region extensions/deepinfra/embedding-provider.ts
5
4
  const DEFAULT_DEEPINFRA_EMBEDDING_MODEL = DEEPINFRA_EMBED_FALLBACK_MODELS[0];
@@ -1,5 +1,4 @@
1
- import { DEEPINFRA_BASE_URL } from "./provider-models.js";
2
- import { DEEPINFRA_IMAGE_FALLBACK_MODELS, normalizeDeepInfraBaseUrl, normalizeDeepInfraModelRef } from "./media-models.js";
1
+ import { DEEPINFRA_BASE_URL, DEEPINFRA_IMAGE_FALLBACK_MODELS, normalizeDeepInfraBaseUrl, normalizeDeepInfraModelRef } from "./media-models.js";
3
2
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
3
  import { bufferToBlobPart } from "openclaw/plugin-sdk/blob-runtime";
5
4
  import { createOpenAiCompatibleImageGenerationProvider, imageSourceUploadFileName } from "openclaw/plugin-sdk/image-generation";
package/dist/index.js CHANGED
@@ -1,14 +1,13 @@
1
1
  import { createDeepInfraAnthropicCacheWrapper } from "./cache-wrapper.js";
2
- import { DEEPINFRA_DEFAULT_MODEL_REF, discoverDeepInfraModels, getDeepInfraSurfaceFallbackCatalog, hasDeepInfraApiKey } from "./provider-models.js";
3
2
  import { buildDeepInfraEmbeddingAdapter } from "./embedding-adapter.js";
4
3
  import { buildDeepInfraImageGenerationProvider } from "./image-generation-provider.js";
5
4
  import { buildDeepInfraMediaUnderstandingProvider } from "./media-understanding-provider.js";
5
+ import { DEEPINFRA_DEFAULT_MODEL_REF, getDeepInfraSurfaceFallbackCatalog } from "./provider-models.js";
6
6
  import { applyDeepInfraConfig } from "./onboard.js";
7
7
  import { buildDeepInfraApiKeyCatalog, buildStaticDeepInfraProvider } from "./provider-catalog.js";
8
8
  import { buildDeepInfraSpeechProvider } from "./speech-provider.js";
9
9
  import { listDeepInfraImageGenCatalog, listDeepInfraVideoGenCatalog } from "./surface-model-catalogs.js";
10
10
  import { buildDeepInfraVideoGenerationProvider } from "./video-generation-provider.js";
11
- import { readConfiguredProviderCatalogEntries } from "openclaw/plugin-sdk/provider-catalog-shared";
12
11
  import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
13
12
  import { buildProviderReplayFamilyHooks } from "openclaw/plugin-sdk/provider-model-shared";
14
13
  import { createOpenRouterWrapper, isProxyReasoningUnsupported } from "openclaw/plugin-sdk/provider-stream";
@@ -47,38 +46,6 @@ var deepinfra_default = defineSingleProviderPluginEntry({
47
46
  run: (ctx) => buildDeepInfraApiKeyCatalog(ctx),
48
47
  staticRun: async () => ({ provider: buildStaticDeepInfraProvider() })
49
48
  },
50
- augmentModelCatalog: async ({ config, env, agentDir }) => {
51
- const configured = readConfiguredProviderCatalogEntries({
52
- config,
53
- providerId: PROVIDER_ID
54
- });
55
- const hasApiKey = hasDeepInfraApiKey({
56
- env,
57
- agentDir,
58
- config
59
- });
60
- const seen = new Set(configured.map((entry) => entry.id));
61
- const discovered = await discoverDeepInfraModels({
62
- hasApiKey,
63
- env,
64
- agentDir
65
- });
66
- const merged = [...configured];
67
- for (const model of discovered) {
68
- if (seen.has(model.id)) continue;
69
- seen.add(model.id);
70
- const input = model.input;
71
- merged.push({
72
- provider: PROVIDER_ID,
73
- id: model.id,
74
- name: model.name ?? model.id,
75
- ...typeof model.contextWindow === "number" && model.contextWindow > 0 ? { contextWindow: model.contextWindow } : {},
76
- ...typeof model.reasoning === "boolean" ? { reasoning: model.reasoning } : {},
77
- ...input && input.length > 0 ? { input } : {}
78
- });
79
- }
80
- return merged;
81
- },
82
49
  normalizeConfig: ({ providerConfig }) => providerConfig,
83
50
  normalizeTransport: ({ api, baseUrl }) => baseUrl === "https://api.deepinfra.com/v1/openai" ? {
84
51
  api,
@@ -87,7 +54,7 @@ var deepinfra_default = defineSingleProviderPluginEntry({
87
54
  ...buildProviderReplayFamilyHooks({ family: "passthrough-gemini" }),
88
55
  wrapStreamFn: (ctx) => {
89
56
  const thinkingLevel = isProxyReasoningUnsupported(ctx.modelId) ? void 0 : ctx.thinkingLevel;
90
- return createDeepInfraAnthropicCacheWrapper(createOpenRouterWrapper(ctx.streamFn, thinkingLevel));
57
+ return createDeepInfraAnthropicCacheWrapper(createOpenRouterWrapper(ctx.streamFn, thinkingLevel), ctx.extraParams);
91
58
  },
92
59
  isModernModelRef: () => true,
93
60
  isCacheTtlEligible: (ctx) => ctx.modelId.toLowerCase().startsWith("anthropic/")
@@ -1,6 +1,7 @@
1
- import { DEEPINFRA_BASE_URL } from "./provider-models.js";
1
+ import { t as modelCatalog } from "./openclaw.plugin-BRaVociw.js";
2
2
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  //#region extensions/deepinfra/media-models.ts
4
+ const DEEPINFRA_BASE_URL = modelCatalog.providers.deepinfra.baseUrl;
4
5
  const DEFAULT_DEEPINFRA_IMAGE_SIZE = "1024x1024";
5
6
  const DEFAULT_DEEPINFRA_TTS_VOICE = "af_bella";
6
7
  const DEEPINFRA_VIDEO_ASPECT_RATIOS = [
@@ -17,12 +18,33 @@ const DEEPINFRA_IMAGE_FALLBACK_MODELS = [
17
18
  "Qwen/Qwen-Image-Max",
18
19
  "stabilityai/sdxl-turbo"
19
20
  ];
20
- const DEEPINFRA_TTS_FALLBACK_MODELS = [
21
- "hexgrad/Kokoro-82M",
22
- "Qwen/Qwen3-TTS",
23
- "ResembleAI/chatterbox-turbo",
24
- "sesame/csm-1b"
21
+ const DEEPINFRA_TTS_FALLBACK_CATALOG = [
22
+ {
23
+ id: "hexgrad/Kokoro-82M",
24
+ name: "hexgrad/Kokoro-82M",
25
+ tags: ["tts"],
26
+ pricing: { input_characters: .65 }
27
+ },
28
+ {
29
+ id: "Qwen/Qwen3-TTS",
30
+ name: "Qwen/Qwen3-TTS",
31
+ tags: ["tts"],
32
+ pricing: { input_characters: .65 }
33
+ },
34
+ {
35
+ id: "ResembleAI/chatterbox-turbo",
36
+ name: "ResembleAI/chatterbox-turbo",
37
+ tags: ["tts"],
38
+ pricing: { input_characters: 1 }
39
+ },
40
+ {
41
+ id: "sesame/csm-1b",
42
+ name: "sesame/csm-1b",
43
+ tags: ["tts"],
44
+ pricing: { input_characters: 7 }
45
+ }
25
46
  ];
47
+ const DEEPINFRA_TTS_FALLBACK_MODELS = DEEPINFRA_TTS_FALLBACK_CATALOG.map(({ id }) => id);
26
48
  const DEEPINFRA_VIDEO_FALLBACK_MODELS = [
27
49
  "Pixverse/Pixverse-T2V",
28
50
  "Pixverse/Pixverse-T2V-HD",
@@ -40,4 +62,4 @@ function normalizeDeepInfraBaseUrl(value, fallback = DEEPINFRA_BASE_URL) {
40
62
  return (normalizeOptionalString(value) ?? fallback).replace(/\/+$/u, "");
41
63
  }
42
64
  //#endregion
43
- export { DEEPINFRA_BASE_URL, DEEPINFRA_EMBED_FALLBACK_MODELS, DEEPINFRA_IMAGE_FALLBACK_MODELS, DEEPINFRA_STT_FALLBACK_MODELS, DEEPINFRA_TTS_FALLBACK_MODELS, DEEPINFRA_VIDEO_ASPECT_RATIOS, DEEPINFRA_VIDEO_DURATIONS, DEEPINFRA_VIDEO_FALLBACK_MODELS, DEEPINFRA_VLM_FALLBACK_MODELS, DEFAULT_DEEPINFRA_IMAGE_SIZE, DEFAULT_DEEPINFRA_TTS_VOICE, normalizeDeepInfraBaseUrl, normalizeDeepInfraModelRef };
65
+ export { DEEPINFRA_BASE_URL, DEEPINFRA_EMBED_FALLBACK_MODELS, DEEPINFRA_IMAGE_FALLBACK_MODELS, DEEPINFRA_STT_FALLBACK_MODELS, DEEPINFRA_TTS_FALLBACK_CATALOG, DEEPINFRA_TTS_FALLBACK_MODELS, DEEPINFRA_VIDEO_ASPECT_RATIOS, DEEPINFRA_VIDEO_DURATIONS, DEEPINFRA_VIDEO_FALLBACK_MODELS, DEEPINFRA_VLM_FALLBACK_MODELS, DEFAULT_DEEPINFRA_IMAGE_SIZE, DEFAULT_DEEPINFRA_TTS_VOICE, normalizeDeepInfraBaseUrl, normalizeDeepInfraModelRef };
@@ -1,5 +1,4 @@
1
- import { DEEPINFRA_BASE_URL } from "./provider-models.js";
2
- import { DEEPINFRA_STT_FALLBACK_MODELS, DEEPINFRA_VLM_FALLBACK_MODELS } from "./media-models.js";
1
+ import { DEEPINFRA_BASE_URL, DEEPINFRA_STT_FALLBACK_MODELS, DEEPINFRA_VLM_FALLBACK_MODELS } from "./media-models.js";
3
2
  import { describeImageWithModel, describeImagesWithModel, transcribeOpenAiCompatibleAudio } from "openclaw/plugin-sdk/media-understanding";
4
3
  //#region extensions/deepinfra/media-understanding-provider.ts
5
4
  function resolveDefault(surfaceModels, fallback) {
@@ -1,5 +1,6 @@
1
1
  //#region extensions/deepinfra/openclaw.plugin.json
2
2
  var modelCatalog = {
3
+ "modelsDev": { "deepinfra": "deepinfra" },
3
4
  "providers": { "deepinfra": {
4
5
  "baseUrl": "https://api.deepinfra.com/v1/openai",
5
6
  "api": "openai-completions",
@@ -1,4 +1,6 @@
1
- import { DEEPINFRA_BASE_URL, DEEPINFRA_MODEL_CATALOG, buildDeepInfraModelDefinition, discoverDeepInfraModels } from "./provider-models.js";
1
+ import { DEEPINFRA_BASE_URL } from "./media-models.js";
2
+ import { DEEPINFRA_MODEL_CATALOG, buildDeepInfraModelDefinition, discoverDeepInfraModels } from "./provider-models.js";
3
+ import { runLiveProviderCatalog } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
2
4
  import { buildSingleProviderApiKeyCatalog } from "openclaw/plugin-sdk/provider-catalog-shared";
3
5
  //#region extensions/deepinfra/provider-catalog.ts
4
6
  function buildStaticDeepInfraProvider() {
@@ -9,7 +11,10 @@ function buildStaticDeepInfraProvider() {
9
11
  };
10
12
  }
11
13
  async function buildDeepInfraProvider(options) {
12
- const models = await discoverDeepInfraModels(options);
14
+ const models = await discoverDeepInfraModels({
15
+ ...options,
16
+ discoveryMode: options?.discoveryMode ?? "advisory"
17
+ });
13
18
  return {
14
19
  baseUrl: DEEPINFRA_BASE_URL,
15
20
  api: "openai-completions",
@@ -17,13 +22,17 @@ async function buildDeepInfraProvider(options) {
17
22
  };
18
23
  }
19
24
  function buildDeepInfraApiKeyCatalog(ctx) {
20
- return buildSingleProviderApiKeyCatalog({
21
- ctx,
25
+ return runLiveProviderCatalog({
22
26
  providerId: "deepinfra",
23
- buildProvider: () => buildDeepInfraProvider({
24
- hasApiKey: true,
25
- env: ctx.env,
26
- agentDir: ctx.agentDir
27
+ run: () => buildSingleProviderApiKeyCatalog({
28
+ ctx,
29
+ providerId: "deepinfra",
30
+ buildProvider: () => buildDeepInfraProvider({
31
+ hasApiKey: true,
32
+ discoveryMode: "strict",
33
+ env: ctx.env,
34
+ agentDir: ctx.agentDir
35
+ })
27
36
  })
28
37
  });
29
38
  }
@@ -1,12 +1,12 @@
1
- import { t as modelCatalog } from "./openclaw.plugin-CWb9nYB8.js";
1
+ import { t as modelCatalog } from "./openclaw.plugin-BRaVociw.js";
2
+ import { DEEPINFRA_BASE_URL, DEEPINFRA_TTS_FALLBACK_CATALOG } from "./media-models.js";
2
3
  import { parseDeepInfraPricingCatalog } from "./pricing-api.js";
3
- import { buildManifestModelProviderConfig, getCachedLiveCatalogValue } from "openclaw/plugin-sdk/provider-catalog-shared";
4
- import { asPositiveSafeInteger } from "openclaw/plugin-sdk/string-coerce-runtime";
4
+ import { asPositiveSafeInteger, isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  import { withTrustedEnvProxyGuardedFetchMode } from "openclaw/plugin-sdk/fetch-runtime";
6
6
  import { isProviderApiKeyConfigured } from "openclaw/plugin-sdk/provider-auth";
7
- import { LiveModelCatalogHttpError, fetchLiveProviderModelRows, getCachedLiveProviderModelRows } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
7
+ import { fetchLiveProviderModelRows } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
8
+ import { buildManifestModelProviderConfig, getCachedLiveCatalogValue } from "openclaw/plugin-sdk/provider-catalog-shared";
8
9
  import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
9
- import { hasConfiguredSecretInput } from "openclaw/plugin-sdk/secret-input";
10
10
  import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
11
11
  //#region extensions/deepinfra/provider-models.ts
12
12
  const log = createSubsystemLogger("deepinfra-models");
@@ -14,7 +14,6 @@ const DEEPINFRA_MANIFEST_PROVIDER = buildManifestModelProviderConfig({
14
14
  providerId: "deepinfra",
15
15
  catalog: modelCatalog.providers.deepinfra
16
16
  });
17
- const DEEPINFRA_BASE_URL = DEEPINFRA_MANIFEST_PROVIDER.baseUrl;
18
17
  const DEEPINFRA_MODELS_URL = `${DEEPINFRA_BASE_URL}/models?sort_by=openclaw&filter=with_meta`;
19
18
  const DEEPINFRA_PRICING_URL = "https://api.deepinfra.com/models/list";
20
19
  const DEEPINFRA_DEFAULT_MODEL_REF = `deepinfra/deepseek-ai/DeepSeek-V4-Flash`;
@@ -36,14 +35,14 @@ function entryToSurfaceModel(entry) {
36
35
  const id = typeof entry?.id === "string" ? entry.id.trim() : "";
37
36
  if (!id) return null;
38
37
  const metadata = entry.metadata;
39
- if (!metadata) return null;
40
- const tags = Array.isArray(metadata.tags) ? metadata.tags.filter((t) => typeof t === "string") : [];
38
+ if (metadata === null) return null;
39
+ if (!isRecord(metadata) || !Array.isArray(metadata.tags) || metadata.tags.some((tag) => typeof tag !== "string")) throw new Error("DeepInfra model metadata discovery unavailable.");
41
40
  const pricing = metadata.pricing ?? {};
42
41
  return {
43
42
  id,
44
43
  name: id,
45
- description: metadata.description ?? void 0,
46
- tags,
44
+ description: typeof metadata.description === "string" ? metadata.description : void 0,
45
+ tags: metadata.tags,
47
46
  contextWindow: asPositiveSafeInteger(metadata.context_length),
48
47
  maxTokens: asPositiveSafeInteger(metadata.max_tokens),
49
48
  pricing,
@@ -84,9 +83,6 @@ function bucketBySurface(models) {
84
83
  }
85
84
  return catalog;
86
85
  }
87
- function hasDeepInfraSurfaceModelRows(rows) {
88
- return rows.some((entry) => entryToSurfaceModel(entry) !== null);
89
- }
90
86
  function manifestChatEntryToSurfaceModel(entry) {
91
87
  const cost = entry.cost ?? {};
92
88
  const pricing = {};
@@ -142,30 +138,7 @@ const STATIC_NON_CHAT_FALLBACK = [
142
138
  defaultHeight: 1024,
143
139
  defaultIterations: 4
144
140
  },
145
- {
146
- id: "hexgrad/Kokoro-82M",
147
- name: "hexgrad/Kokoro-82M",
148
- tags: ["tts"],
149
- pricing: { input_characters: .65 }
150
- },
151
- {
152
- id: "Qwen/Qwen3-TTS",
153
- name: "Qwen/Qwen3-TTS",
154
- tags: ["tts"],
155
- pricing: { input_characters: .65 }
156
- },
157
- {
158
- id: "ResembleAI/chatterbox-turbo",
159
- name: "ResembleAI/chatterbox-turbo",
160
- tags: ["tts"],
161
- pricing: { input_characters: 1 }
162
- },
163
- {
164
- id: "sesame/csm-1b",
165
- name: "sesame/csm-1b",
166
- tags: ["tts"],
167
- pricing: { input_characters: 7 }
168
- },
141
+ ...DEEPINFRA_TTS_FALLBACK_CATALOG,
169
142
  {
170
143
  id: "openai/whisper-large-v3-turbo",
171
144
  name: "openai/whisper-large-v3-turbo",
@@ -217,109 +190,99 @@ function chatSurfaceModelToModelDefinition(model) {
217
190
  maxTokens: model.maxTokens ?? DEEPINFRA_DEFAULT_MAX_TOKENS
218
191
  };
219
192
  }
220
- function hasDeepInfraApiKey(options) {
193
+ function canDiscoverDeepInfra(options) {
194
+ if (options?.hasApiKey !== void 0) return options.hasApiKey;
221
195
  const fromEnv = (options?.env ?? process.env).DEEPINFRA_API_KEY;
222
- if (typeof fromEnv === "string" && fromEnv.trim() !== "") return true;
223
- const providers = options?.config?.models?.providers;
224
- for (const [providerId, provider] of Object.entries(providers ?? {})) if (providerId.trim().toLowerCase() === "deepinfra" && hasConfiguredSecretInput(provider?.apiKey, options?.config?.secrets?.defaults)) return true;
225
- return isProviderApiKeyConfigured({
196
+ return typeof fromEnv === "string" && fromEnv.trim() !== "" || isProviderApiKeyConfigured({
226
197
  provider: "deepinfra",
227
198
  agentDir: options?.agentDir
228
199
  });
229
200
  }
230
- function canDiscoverDeepInfra(options) {
231
- const env = options?.env ?? process.env;
232
- if (env.NODE_ENV === "test" || env.VITEST) return false;
233
- return options?.hasApiKey ?? hasDeepInfraApiKey({
234
- env,
235
- agentDir: options?.agentDir
236
- });
237
- }
238
201
  async function discoverDeepInfraSurfaces(options) {
239
- return canDiscoverDeepInfra(options) ? loadDeepInfraSurfaces() : manifestFallbackCatalog();
202
+ if (canDiscoverDeepInfra(options)) try {
203
+ return await loadDeepInfraSurfaces();
204
+ } catch (error) {
205
+ log.warn(`Model metadata discovery unavailable: ${String(error)}`);
206
+ }
207
+ return manifestFallbackCatalog();
240
208
  }
241
209
  async function loadDeepInfraSurfaces() {
242
- try {
243
- const data = await getCachedLiveProviderModelRows({
244
- providerId: "deepinfra",
245
- endpoint: DEEPINFRA_MODELS_URL,
246
- timeoutMs: DISCOVERY_TIMEOUT_MS,
247
- ttlMs: DISCOVERY_CACHE_TTL_MS,
248
- buildRequestHeaders: () => ({ Accept: "application/json" }),
249
- auditContext: "deepinfra-model-discovery",
250
- shouldCacheRows: hasDeepInfraSurfaceModelRows,
251
- fetchGuard: (params) => fetchWithSsrFGuard(withTrustedEnvProxyGuardedFetchMode(params))
252
- });
253
- if (data.length === 0) {
254
- log.warn("No models found from DeepInfra agent-projection endpoint, using static catalog");
255
- return manifestFallbackCatalog();
256
- }
257
- const seenIds = /* @__PURE__ */ new Set();
258
- const surfaceModels = [];
259
- for (const entry of data) {
260
- const model = entryToSurfaceModel(entry);
261
- if (!model || seenIds.has(model.id)) continue;
262
- seenIds.add(model.id);
263
- surfaceModels.push(model);
264
- }
265
- if (surfaceModels.length === 0) return manifestFallbackCatalog();
266
- return bucketBySurface(surfaceModels);
267
- } catch (error) {
268
- if (error instanceof LiveModelCatalogHttpError) {
269
- log.warn(`Failed to discover models: HTTP ${error.status}, using static catalog`);
270
- return manifestFallbackCatalog();
210
+ return getCachedLiveCatalogValue({
211
+ keyParts: [
212
+ "deepinfra",
213
+ "surfaces",
214
+ DEEPINFRA_MODELS_URL
215
+ ],
216
+ ttlMs: DISCOVERY_CACHE_TTL_MS,
217
+ load: async () => {
218
+ const data = await fetchLiveProviderModelRows({
219
+ providerId: "deepinfra",
220
+ endpoint: DEEPINFRA_MODELS_URL,
221
+ timeoutMs: DISCOVERY_TIMEOUT_MS,
222
+ buildRequestHeaders: () => ({ Accept: "application/json" }),
223
+ auditContext: "deepinfra-model-discovery",
224
+ fetchGuard: (params) => fetchWithSsrFGuard(withTrustedEnvProxyGuardedFetchMode(params))
225
+ });
226
+ const seenIds = /* @__PURE__ */ new Set();
227
+ const surfaceModels = [];
228
+ for (const entry of data) {
229
+ const model = entryToSurfaceModel(entry);
230
+ if (!model || seenIds.has(model.id)) continue;
231
+ seenIds.add(model.id);
232
+ surfaceModels.push(model);
233
+ }
234
+ if (data.length > 0 && surfaceModels.length === 0) throw new Error("DeepInfra model metadata discovery unavailable.");
235
+ return bucketBySurface(surfaceModels);
271
236
  }
272
- log.warn(`Discovery failed: ${String(error)}, using static catalog`);
273
- return manifestFallbackCatalog();
274
- }
237
+ });
275
238
  }
276
239
  async function discoverDeepInfraPricing() {
277
- try {
278
- return await getCachedLiveCatalogValue({
279
- keyParts: [
280
- "deepinfra",
281
- "native-pricing",
282
- DEEPINFRA_PRICING_URL
283
- ],
284
- ttlMs: DISCOVERY_CACHE_TTL_MS,
285
- load: async () => {
286
- const rows = await fetchLiveProviderModelRows({
287
- providerId: "deepinfra",
288
- endpoint: DEEPINFRA_PRICING_URL,
289
- timeoutMs: DISCOVERY_TIMEOUT_MS,
290
- buildRequestHeaders: () => ({ Accept: "application/json" }),
291
- auditContext: "deepinfra-pricing-discovery",
292
- fetchGuard: (params) => fetchWithSsrFGuard(withTrustedEnvProxyGuardedFetchMode(params)),
293
- readRows: (body) => {
294
- if (!Array.isArray(body)) throw new Error("Native DeepInfra pricing response must be an array");
295
- return body;
296
- }
297
- });
298
- const prices = parseDeepInfraPricingCatalog(rows);
299
- if (!prices) throw new Error("Native DeepInfra pricing is malformed or has no usable schedules");
300
- return prices;
301
- }
302
- });
303
- } catch (error) {
304
- log.warn(`Native pricing unavailable: ${String(error)}. Keeping model metadata with unknown estimates; retry discovery or configure explicit model costs.`);
305
- return;
306
- }
240
+ return await getCachedLiveCatalogValue({
241
+ keyParts: [
242
+ "deepinfra",
243
+ "native-pricing",
244
+ DEEPINFRA_PRICING_URL
245
+ ],
246
+ ttlMs: DISCOVERY_CACHE_TTL_MS,
247
+ load: async () => {
248
+ const rows = await fetchLiveProviderModelRows({
249
+ providerId: "deepinfra",
250
+ endpoint: DEEPINFRA_PRICING_URL,
251
+ timeoutMs: DISCOVERY_TIMEOUT_MS,
252
+ buildRequestHeaders: () => ({ Accept: "application/json" }),
253
+ auditContext: "deepinfra-pricing-discovery",
254
+ fetchGuard: (params) => fetchWithSsrFGuard(withTrustedEnvProxyGuardedFetchMode(params)),
255
+ readRows: (body) => {
256
+ if (!Array.isArray(body)) throw new Error("Native DeepInfra pricing response must be an array");
257
+ return body;
258
+ }
259
+ });
260
+ const prices = parseDeepInfraPricingCatalog(rows);
261
+ if (!prices) throw new Error("Native DeepInfra pricing is malformed or has no usable schedules");
262
+ return prices;
263
+ }
264
+ });
307
265
  }
308
266
  async function discoverDeepInfraModels(options) {
309
267
  if (!canDiscoverDeepInfra(options)) return DEEPINFRA_MODEL_CATALOG.map(buildDeepInfraModelDefinition);
310
- const [catalog, prices] = await Promise.all([loadDeepInfraSurfaces(), discoverDeepInfraPricing()]);
311
- if (!catalog.live && !prices) return DEEPINFRA_MODEL_CATALOG.map(buildDeepInfraModelDefinition);
312
- const chatModels = catalog.chat.length > 0 ? catalog.chat : [...catalog.chat, ...catalog.vlm];
313
- const liveModels = catalog.live ? chatModels.map(chatSurfaceModelToModelDefinition) : [];
314
- const seen = new Set(liveModels.map((model) => model.id));
315
- const manifestModels = DEEPINFRA_MODEL_CATALOG.filter((model) => {
316
- const unseen = !seen.has(model.id);
317
- seen.add(model.id);
318
- return unseen;
319
- });
320
- const models = [...liveModels, ...manifestModels];
268
+ const strict = options?.discoveryMode !== "advisory";
269
+ const [metadata, pricing] = await Promise.allSettled([loadDeepInfraSurfaces(), discoverDeepInfraPricing()]);
270
+ if (metadata.status === "rejected") {
271
+ if (strict) throw metadata.reason;
272
+ if (pricing.status === "rejected") return DEEPINFRA_MODEL_CATALOG.map(buildDeepInfraModelDefinition);
273
+ }
274
+ const catalog = metadata.status === "fulfilled" ? metadata.value : void 0;
275
+ const chatModels = catalog ? catalog.chat.length > 0 ? catalog.chat : catalog.vlm : [];
276
+ if (strict && chatModels.length === 0) return [];
277
+ if (strict && pricing.status === "rejected") throw pricing.reason;
278
+ const prices = pricing.status === "fulfilled" ? pricing.value : void 0;
279
+ const models = chatModels.map(chatSurfaceModelToModelDefinition);
280
+ if (!strict) {
281
+ const discovered = new Set(models.map((model) => model.id));
282
+ models.push(...DEEPINFRA_MODEL_CATALOG.filter((model) => !discovered.has(model.id)));
283
+ }
321
284
  const unknownPrices = models.filter((model) => !prices?.has(model.id)).length;
322
- if (prices && unknownPrices > 0) log.warn(`Native pricing unavailable or qualified for ${unknownPrices} models; keeping metadata with unknown estimates. Configure explicit model costs if needed.`);
285
+ if (unknownPrices > 0) log.warn(`Native pricing unavailable or qualified for ${unknownPrices} models; keeping metadata with unknown estimates. Configure explicit model costs if needed.`);
323
286
  return models.map((model) => buildDeepInfraModelDefinition({
324
287
  ...model,
325
288
  cost: prices?.get(model.id) ?? {
@@ -331,4 +294,4 @@ async function discoverDeepInfraModels(options) {
331
294
  }));
332
295
  }
333
296
  //#endregion
334
- export { DEEPINFRA_BASE_URL, DEEPINFRA_DEFAULT_MODEL_REF, DEEPINFRA_MODEL_CATALOG, buildDeepInfraModelDefinition, discoverDeepInfraModels, discoverDeepInfraSurfaces, getDeepInfraSurfaceFallbackCatalog, hasDeepInfraApiKey };
297
+ export { DEEPINFRA_DEFAULT_MODEL_REF, DEEPINFRA_MODEL_CATALOG, buildDeepInfraModelDefinition, discoverDeepInfraModels, discoverDeepInfraSurfaces, getDeepInfraSurfaceFallbackCatalog };
@@ -1,7 +1,6 @@
1
- import { DEEPINFRA_BASE_URL } from "./provider-models.js";
2
- import { DEEPINFRA_TTS_FALLBACK_MODELS, DEFAULT_DEEPINFRA_TTS_VOICE, normalizeDeepInfraModelRef } from "./media-models.js";
1
+ import { DEEPINFRA_BASE_URL, DEEPINFRA_TTS_FALLBACK_CATALOG, DEEPINFRA_TTS_FALLBACK_MODELS, DEFAULT_DEEPINFRA_TTS_VOICE, normalizeDeepInfraModelRef } from "./media-models.js";
3
2
  import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
4
- import { createOpenAiCompatibleSpeechProvider } from "openclaw/plugin-sdk/speech";
3
+ import { createOpenAiCompatibleSpeechProvider } from "openclaw/plugin-sdk/speech-provider";
5
4
  //#region extensions/deepinfra/speech-provider.ts
6
5
  const DEEPINFRA_TTS_RESPONSE_FORMATS = [
7
6
  "mp3",
@@ -12,7 +11,7 @@ const DEEPINFRA_TTS_RESPONSE_FORMATS = [
12
11
  ];
13
12
  function buildDeepInfraSpeechProvider(options) {
14
13
  const ids = options?.ttsModels && options.ttsModels.length > 0 ? options.ttsModels.map((model) => model.id) : [...DEEPINFRA_TTS_FALLBACK_MODELS];
15
- const defaultModel = ids[0] ?? DEEPINFRA_TTS_FALLBACK_MODELS[0];
14
+ const defaultModel = ids[0] ?? DEEPINFRA_TTS_FALLBACK_CATALOG[0].id;
16
15
  return createOpenAiCompatibleSpeechProvider({
17
16
  id: "deepinfra",
18
17
  label: "DeepInfra",
@@ -1,5 +1,5 @@
1
- import { discoverDeepInfraSurfaces } from "./provider-models.js";
2
1
  import { DEEPINFRA_VIDEO_ASPECT_RATIOS, DEEPINFRA_VIDEO_DURATIONS } from "./media-models.js";
2
+ import { discoverDeepInfraSurfaces } from "./provider-models.js";
3
3
  //#region extensions/deepinfra/surface-model-catalogs.ts
4
4
  const PROVIDER_ID = "deepinfra";
5
5
  function surfaceModelToImageGenEntry(model) {
@@ -1,5 +1,4 @@
1
- import { DEEPINFRA_BASE_URL } from "./provider-models.js";
2
- import { DEEPINFRA_VIDEO_ASPECT_RATIOS, DEEPINFRA_VIDEO_DURATIONS, DEEPINFRA_VIDEO_FALLBACK_MODELS, normalizeDeepInfraBaseUrl, normalizeDeepInfraModelRef } from "./media-models.js";
1
+ import { DEEPINFRA_BASE_URL, DEEPINFRA_VIDEO_ASPECT_RATIOS, DEEPINFRA_VIDEO_DURATIONS, DEEPINFRA_VIDEO_FALLBACK_MODELS, normalizeDeepInfraBaseUrl, normalizeDeepInfraModelRef } from "./media-models.js";
3
2
  import { resolveDeepInfraVideoModelCapabilities } from "./surface-model-catalogs.js";
4
3
  import { asSafeIntegerInRange, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
4
  import { isProviderApiKeyConfigured } from "openclaw/plugin-sdk/provider-auth";
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "id": "deepinfra",
3
+ "capabilityCatalogEntry": "./dist/capability-catalog.js",
3
4
  "doctorContract": {
4
5
  "configRepair": true
5
6
  },
@@ -7,12 +8,16 @@
7
8
  "onStartup": false
8
9
  },
9
10
  "enabledByDefault": true,
10
- "providers": ["deepinfra"],
11
- "providerCatalogEntry": "./provider-discovery.ts",
11
+ "providers": [
12
+ "deepinfra"
13
+ ],
14
+ "providerCatalogEntry": "./dist/provider-discovery.js",
12
15
  "providerEndpoints": [
13
16
  {
14
17
  "endpointClass": "deepinfra-native",
15
- "hosts": ["api.deepinfra.com"]
18
+ "hosts": [
19
+ "api.deepinfra.com"
20
+ ]
16
21
  }
17
22
  ],
18
23
  "providerRequest": {
@@ -26,12 +31,19 @@
26
31
  "providers": [
27
32
  {
28
33
  "id": "deepinfra",
29
- "authMethods": ["api-key"],
30
- "envVars": ["DEEPINFRA_API_KEY"]
34
+ "authMethods": [
35
+ "api-key"
36
+ ],
37
+ "envVars": [
38
+ "DEEPINFRA_API_KEY"
39
+ ]
31
40
  }
32
41
  ]
33
42
  },
34
43
  "modelCatalog": {
44
+ "modelsDev": {
45
+ "deepinfra": "deepinfra"
46
+ },
35
47
  "providers": {
36
48
  "deepinfra": {
37
49
  "baseUrl": "https://api.deepinfra.com/v1/openai",
@@ -41,7 +53,9 @@
41
53
  "id": "deepseek-ai/DeepSeek-V4-Flash",
42
54
  "name": "DeepSeek V4 Flash",
43
55
  "reasoning": true,
44
- "input": ["text"],
56
+ "input": [
57
+ "text"
58
+ ],
45
59
  "contextWindow": 1048576,
46
60
  "maxTokens": 1048576,
47
61
  "cost": {
@@ -59,7 +73,9 @@
59
73
  "id": "deepseek-ai/DeepSeek-V4-Pro",
60
74
  "name": "DeepSeek V4 Pro",
61
75
  "reasoning": true,
62
- "input": ["text"],
76
+ "input": [
77
+ "text"
78
+ ],
63
79
  "contextWindow": 1048576,
64
80
  "maxTokens": 1048576,
65
81
  "cost": {
@@ -77,7 +93,9 @@
77
93
  "id": "zai-org/GLM-5.2",
78
94
  "name": "GLM-5.2",
79
95
  "reasoning": true,
80
- "input": ["text"],
96
+ "input": [
97
+ "text"
98
+ ],
81
99
  "contextWindow": 1048576,
82
100
  "maxTokens": 1048576,
83
101
  "cost": {
@@ -95,7 +113,10 @@
95
113
  "id": "stepfun-ai/Step-3.7-Flash",
96
114
  "name": "Step 3.7 Flash",
97
115
  "reasoning": true,
98
- "input": ["text", "image"],
116
+ "input": [
117
+ "text",
118
+ "image"
119
+ ],
99
120
  "contextWindow": 262144,
100
121
  "maxTokens": 262144,
101
122
  "cost": {
@@ -112,7 +133,10 @@
112
133
  "id": "moonshotai/Kimi-K2.7-Code",
113
134
  "name": "Kimi K2.7 Code",
114
135
  "reasoning": true,
115
- "input": ["text", "image"],
136
+ "input": [
137
+ "text",
138
+ "image"
139
+ ],
116
140
  "contextWindow": 262144,
117
141
  "maxTokens": 262144,
118
142
  "cost": {
@@ -129,7 +153,10 @@
129
153
  "id": "moonshotai/Kimi-K2.6",
130
154
  "name": "Kimi K2.6",
131
155
  "reasoning": true,
132
- "input": ["text", "image"],
156
+ "input": [
157
+ "text",
158
+ "image"
159
+ ],
133
160
  "contextWindow": 262144,
134
161
  "maxTokens": 262144,
135
162
  "cost": {
@@ -146,7 +173,10 @@
146
173
  "id": "nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B",
147
174
  "name": "NVIDIA Nemotron 3 Ultra 550B A55B",
148
175
  "reasoning": true,
149
- "input": ["text", "image"],
176
+ "input": [
177
+ "text",
178
+ "image"
179
+ ],
150
180
  "contextWindow": 262144,
151
181
  "maxTokens": 262144,
152
182
  "cost": {
@@ -163,7 +193,9 @@
163
193
  "id": "nvidia/NVIDIA-Nemotron-3-Super-120B-A12B",
164
194
  "name": "NVIDIA Nemotron 3 Super 120B A12B",
165
195
  "reasoning": true,
166
- "input": ["text"],
196
+ "input": [
197
+ "text"
198
+ ],
167
199
  "contextWindow": 262144,
168
200
  "maxTokens": 262144,
169
201
  "cost": {
@@ -182,7 +214,9 @@
182
214
  "status": "deprecated",
183
215
  "replacedBy": "deepseek-ai/DeepSeek-V4-Pro",
184
216
  "reasoning": false,
185
- "input": ["text"],
217
+ "input": [
218
+ "text"
219
+ ],
186
220
  "contextWindow": 163840,
187
221
  "maxTokens": 163840,
188
222
  "cost": {
@@ -201,7 +235,9 @@
201
235
  "status": "deprecated",
202
236
  "replacedBy": "zai-org/GLM-5.2",
203
237
  "reasoning": true,
204
- "input": ["text"],
238
+ "input": [
239
+ "text"
240
+ ],
205
241
  "contextWindow": 202752,
206
242
  "maxTokens": 202752,
207
243
  "cost": {
@@ -221,7 +257,9 @@
221
257
  "status": "deprecated",
222
258
  "replacedBy": "stepfun-ai/Step-3.7-Flash",
223
259
  "reasoning": true,
224
- "input": ["text"],
260
+ "input": [
261
+ "text"
262
+ ],
225
263
  "contextWindow": 262144,
226
264
  "maxTokens": 262144,
227
265
  "cost": {
@@ -240,7 +278,10 @@
240
278
  "status": "deprecated",
241
279
  "replacedBy": "moonshotai/Kimi-K2.6",
242
280
  "reasoning": true,
243
- "input": ["text", "image"],
281
+ "input": [
282
+ "text",
283
+ "image"
284
+ ],
244
285
  "contextWindow": 262144,
245
286
  "maxTokens": 262144,
246
287
  "cost": {
@@ -262,7 +303,11 @@
262
303
  },
263
304
  "modelPricing": {
264
305
  "providers": {
265
- "deepinfra": { "deepinfra": { "provider": "deepinfra" } }
306
+ "deepinfra": {
307
+ "deepinfra": {
308
+ "provider": "deepinfra"
309
+ }
310
+ }
266
311
  }
267
312
  },
268
313
  "providerAuthChoices": [
@@ -283,15 +328,28 @@
283
328
  }
284
329
  ],
285
330
  "contracts": {
286
- "mediaUnderstandingProviders": ["deepinfra"],
287
- "embeddingProviders": ["deepinfra"],
288
- "imageGenerationProviders": ["deepinfra"],
289
- "speechProviders": ["deepinfra"],
290
- "videoGenerationProviders": ["deepinfra"]
331
+ "mediaUnderstandingProviders": [
332
+ "deepinfra"
333
+ ],
334
+ "embeddingProviders": [
335
+ "deepinfra"
336
+ ],
337
+ "imageGenerationProviders": [
338
+ "deepinfra"
339
+ ],
340
+ "speechProviders": [
341
+ "deepinfra"
342
+ ],
343
+ "videoGenerationProviders": [
344
+ "deepinfra"
345
+ ]
291
346
  },
292
347
  "mediaUnderstandingProviderMetadata": {
293
348
  "deepinfra": {
294
- "capabilities": ["image", "audio"],
349
+ "capabilities": [
350
+ "image",
351
+ "audio"
352
+ ],
295
353
  "defaultModels": {
296
354
  "image": "moonshotai/Kimi-K2.5",
297
355
  "audio": "openai/whisper-large-v3-turbo"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/deepinfra-provider",
3
- "version": "2026.9.1",
3
+ "version": "2026.9.3",
4
4
  "description": "OpenClaw DeepInfra provider plugin.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,10 +18,10 @@
18
18
  "minHostVersion": ">=2026.6.8"
19
19
  },
20
20
  "compat": {
21
- "pluginApi": ">=2026.9.1"
21
+ "pluginApi": ">=2026.9.3"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.9.1",
24
+ "openclawVersion": "2026.9.3",
25
25
  "bundledDist": false
26
26
  },
27
27
  "release": {
@@ -38,7 +38,7 @@
38
38
  "README.md"
39
39
  ],
40
40
  "peerDependencies": {
41
- "openclaw": ">=2026.9.1"
41
+ "openclaw": ">=2026.9.3"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "openclaw": {