@openclaw/deepinfra-provider 2026.9.1-beta.1 → 2026.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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";
@@ -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-DomWf43f.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
@@ -8,19 +8,6 @@ const EXCLUDED_EMBEDDING_HEADERS = [
8
8
  "x-api-key",
9
9
  "api-key"
10
10
  ];
11
- function textFromEmbeddingInput(input) {
12
- return typeof input === "string" ? input : input.text;
13
- }
14
- function adaptMemoryEmbeddingProvider(provider) {
15
- return {
16
- id: provider.id,
17
- model: provider.model,
18
- ...typeof provider.maxInputTokens === "number" ? { maxInputTokens: provider.maxInputTokens } : {},
19
- embed: async (input, options) => await provider.embedQuery(textFromEmbeddingInput(input), { signal: options?.signal }),
20
- embedBatch: async (inputs, options) => await provider.embedBatch(inputs.map(textFromEmbeddingInput), { signal: options?.signal }),
21
- ...provider.close ? { close: async () => await provider.close?.() } : {}
22
- };
23
- }
24
11
  function buildDeepInfraEmbeddingAdapter(options) {
25
12
  const defaultModel = options?.embedModels?.[0]?.id ?? DEFAULT_DEEPINFRA_EMBEDDING_MODEL;
26
13
  return {
@@ -29,13 +16,9 @@ function buildDeepInfraEmbeddingAdapter(options) {
29
16
  transport: "remote",
30
17
  authProviderId: "deepinfra",
31
18
  create: async (createOptions) => {
32
- const { dimensions, ...memoryOptions } = createOptions;
33
19
  const { provider, client } = await createDeepInfraEmbeddingProvider({
34
- ...memoryOptions,
20
+ ...createOptions,
35
21
  provider: "deepinfra",
36
- fallback: "none",
37
- outputDimensionality: dimensions,
38
- taskType: createOptions.taskType,
39
22
  defaultModel
40
23
  });
41
24
  const headers = sanitizeEmbeddingCacheHeaders(client.headers, EXCLUDED_EMBEDDING_HEADERS);
@@ -44,7 +27,7 @@ function buildDeepInfraEmbeddingAdapter(options) {
44
27
  providerBaseUrl: DEEPINFRA_BASE_URL
45
28
  });
46
29
  return {
47
- provider: provider ? adaptMemoryEmbeddingProvider(provider) : null,
30
+ provider,
48
31
  runtime: {
49
32
  id: "deepinfra",
50
33
  cacheKeyData: {
@@ -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];
@@ -18,7 +17,8 @@ async function createDeepInfraEmbeddingProvider(options) {
18
17
  provider: createRemoteEmbeddingProvider({
19
18
  id: "deepinfra",
20
19
  client,
21
- errorPrefix: "DeepInfra embeddings API error"
20
+ errorPrefix: "DeepInfra embeddings API error",
21
+ batchQueryInputs: true
22
22
  }),
23
23
  client
24
24
  };
@@ -1,6 +1,6 @@
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";
3
+ import { bufferToBlobPart } from "openclaw/plugin-sdk/blob-runtime";
4
4
  import { createOpenAiCompatibleImageGenerationProvider, imageSourceUploadFileName } from "openclaw/plugin-sdk/image-generation";
5
5
  //#region extensions/deepinfra/image-generation-provider.ts
6
6
  const DEEPINFRA_IMAGE_SIZES = [
@@ -12,10 +12,11 @@ const DEEPINFRA_IMAGE_SIZES = [
12
12
  const MAX_DEEPINFRA_INPUT_IMAGES = 1;
13
13
  function buildDeepInfraImageGenerationProvider(options) {
14
14
  const ids = options?.imageGenModels && options.imageGenModels.length > 0 ? options.imageGenModels.map((model) => model.id) : [...DEEPINFRA_IMAGE_FALLBACK_MODELS];
15
+ const defaultModel = ids[0] ?? DEEPINFRA_IMAGE_FALLBACK_MODELS[0];
15
16
  return createOpenAiCompatibleImageGenerationProvider({
16
17
  id: "deepinfra",
17
18
  label: "DeepInfra",
18
- defaultModel: ids[0] ?? DEEPINFRA_IMAGE_FALLBACK_MODELS[0],
19
+ defaultModel,
19
20
  models: ids,
20
21
  capabilities: {
21
22
  generate: {
@@ -60,7 +61,7 @@ function buildDeepInfraImageGenerationProvider(options) {
60
61
  form.set("size", normalizeOptionalString(req.size) ?? "1024x1024");
61
62
  form.set("response_format", "b64_json");
62
63
  const mimeType = normalizeOptionalString(image.mimeType) ?? "image/png";
63
- form.append("image", new Blob([new Uint8Array(image.buffer)], { type: mimeType }), imageSourceUploadFileName({
64
+ form.append("image", new Blob([bufferToBlobPart(image.buffer)], { type: mimeType }), imageSourceUploadFileName({
64
65
  image,
65
66
  index: 0
66
67
  }));
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
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, discoverDeepInfraModels, getDeepInfraSurfaceFallbackCatalog, hasDeepInfraApiKey } 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";
@@ -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",
@@ -48,9 +49,9 @@ var modelCatalog = {
48
49
  "contextWindow": 1048576,
49
50
  "maxTokens": 1048576,
50
51
  "cost": {
51
- "input": .93,
52
- "output": 3,
53
- "cacheRead": .18,
52
+ "input": .4875,
53
+ "output": 1.56,
54
+ "cacheRead": .091000001625,
54
55
  "cacheWrite": 0
55
56
  },
56
57
  "compat": {
@@ -81,9 +82,9 @@ var modelCatalog = {
81
82
  "contextWindow": 262144,
82
83
  "maxTokens": 262144,
83
84
  "cost": {
84
- "input": .74,
85
- "output": 3.5,
86
- "cacheRead": .15,
85
+ "input": .68,
86
+ "output": 3.4,
87
+ "cacheRead": .136,
87
88
  "cacheWrite": 0
88
89
  },
89
90
  "compat": { "supportsUsageInStreaming": true }
@@ -180,9 +181,9 @@ var modelCatalog = {
180
181
  "contextWindow": 262144,
181
182
  "maxTokens": 262144,
182
183
  "cost": {
183
- "input": .1,
184
+ "input": .09,
184
185
  "output": .3,
185
- "cacheRead": .02,
186
+ "cacheRead": .0199999998,
186
187
  "cacheWrite": 0
187
188
  },
188
189
  "compat": { "supportsUsageInStreaming": true }
@@ -0,0 +1,51 @@
1
+ import { asFiniteNumberInRange, asOptionalRecord, asPositiveSafeInteger } from "openclaw/plugin-sdk/string-coerce-runtime";
2
+ import { normalizeModelPricingCatalog } from "openclaw/plugin-sdk/model-catalog-pricing";
3
+ //#region extensions/deepinfra/pricing-api.ts
4
+ function normalizeDeepInfraTokenPricing(value) {
5
+ const row = asOptionalRecord(value);
6
+ if (!row || row.type !== void 0 && row.type !== "tokens") return;
7
+ const discount = asFiniteNumberInRange(row.discount ?? 0, {
8
+ min: 0,
9
+ max: 1
10
+ });
11
+ const inputCents = asFiniteNumberInRange(row.cents_per_input_token, { min: 0 });
12
+ const outputCents = asFiniteNumberInRange(row.cents_per_output_token, { min: 0 });
13
+ const cacheRatio = asFiniteNumberInRange(row.rate_per_input_token_cached ?? 0, { min: 0 });
14
+ const table = row.table == null ? void 0 : asOptionalRecord(row.table);
15
+ const explicitWrites = row.rate_per_explicit_cache_write_token;
16
+ const writeRates = explicitWrites == null ? void 0 : asOptionalRecord(explicitWrites);
17
+ if (discount === void 0 || inputCents === void 0 || outputCents === void 0 || cacheRatio === void 0 || row.full != null && typeof row.full !== "string" || row.table != null && !table || row.discount_ends_at != null && !Number.isSafeInteger(row.discount_ends_at) || [
18
+ "rate_per_input_token_cache_write",
19
+ "rate_per_service_tier_priority",
20
+ "rate_per_service_tier_flex"
21
+ ].some((key) => row[key] != null && asFiniteNumberInRange(row[key], { min: 0 }) === void 0) || explicitWrites != null && (!writeRates || Object.values(writeRates).some((rate) => asFiniteNumberInRange(rate, { min: 0 }) === void 0)) || row.explicit_cache_granularity_tokens != null && asPositiveSafeInteger(row.explicit_cache_granularity_tokens) === void 0) return;
22
+ const input = inputCents * 1e4 * (1 - discount);
23
+ const output = outputCents * 1e4 * (1 - discount);
24
+ const cacheRead = input * cacheRatio;
25
+ return [
26
+ input,
27
+ output,
28
+ cacheRead
29
+ ].every(Number.isFinite) ? {
30
+ input,
31
+ output,
32
+ cacheRead,
33
+ cacheWrite: 0
34
+ } : void 0;
35
+ }
36
+ /** Pure native price owner shared by hosted publication and chat discovery. */
37
+ function parseDeepInfraPricingCatalog(payload) {
38
+ return normalizeModelPricingCatalog(payload, normalizeDeepInfraTokenPricing, {
39
+ readModelId: (model) => model.model_name,
40
+ readPricing: (model) => {
41
+ const pricing = asOptionalRecord(model.pricing);
42
+ return typeof pricing?.type === "string" && pricing.type !== "tokens" ? void 0 : model.pricing;
43
+ },
44
+ isSupportedPricing: (value) => {
45
+ const row = asOptionalRecord(value);
46
+ return row !== void 0 && !row.full && Object.keys(asOptionalRecord(row.table) ?? {}).length === 0 && row.discount_ends_at == null && row.rate_per_input_token_cache_write == null;
47
+ }
48
+ });
49
+ }
50
+ //#endregion
51
+ export { parseDeepInfraPricingCatalog };
@@ -1,4 +1,5 @@
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";
2
3
  import { buildSingleProviderApiKeyCatalog } from "openclaw/plugin-sdk/provider-catalog-shared";
3
4
  //#region extensions/deepinfra/provider-catalog.ts
4
5
  function buildStaticDeepInfraProvider() {
@@ -9,10 +10,11 @@ function buildStaticDeepInfraProvider() {
9
10
  };
10
11
  }
11
12
  async function buildDeepInfraProvider(options) {
13
+ const models = await discoverDeepInfraModels(options);
12
14
  return {
13
15
  baseUrl: DEEPINFRA_BASE_URL,
14
16
  api: "openai-completions",
15
- models: await discoverDeepInfraModels(options)
17
+ models
16
18
  };
17
19
  }
18
20
  function buildDeepInfraApiKeyCatalog(ctx) {
@@ -1,9 +1,11 @@
1
- import { t as modelCatalog } from "./openclaw.plugin-DomWf43f.js";
2
- import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
1
+ import { t as modelCatalog } from "./openclaw.plugin-BRaVociw.js";
2
+ import { DEEPINFRA_BASE_URL, DEEPINFRA_TTS_FALLBACK_CATALOG } from "./media-models.js";
3
+ import { parseDeepInfraPricingCatalog } from "./pricing-api.js";
4
+ import { buildManifestModelProviderConfig, getCachedLiveCatalogValue } from "openclaw/plugin-sdk/provider-catalog-shared";
3
5
  import { asPositiveSafeInteger } from "openclaw/plugin-sdk/string-coerce-runtime";
4
6
  import { withTrustedEnvProxyGuardedFetchMode } from "openclaw/plugin-sdk/fetch-runtime";
5
7
  import { isProviderApiKeyConfigured } from "openclaw/plugin-sdk/provider-auth";
6
- import { LiveModelCatalogHttpError, getCachedLiveProviderModelRows } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
8
+ import { LiveModelCatalogHttpError, fetchLiveProviderModelRows, getCachedLiveProviderModelRows } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
7
9
  import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
8
10
  import { hasConfiguredSecretInput } from "openclaw/plugin-sdk/secret-input";
9
11
  import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
@@ -13,14 +15,14 @@ const DEEPINFRA_MANIFEST_PROVIDER = buildManifestModelProviderConfig({
13
15
  providerId: "deepinfra",
14
16
  catalog: modelCatalog.providers.deepinfra
15
17
  });
16
- const DEEPINFRA_BASE_URL = DEEPINFRA_MANIFEST_PROVIDER.baseUrl;
17
18
  const DEEPINFRA_MODELS_URL = `${DEEPINFRA_BASE_URL}/models?sort_by=openclaw&filter=with_meta`;
19
+ const DEEPINFRA_PRICING_URL = "https://api.deepinfra.com/models/list";
18
20
  const DEEPINFRA_DEFAULT_MODEL_REF = `deepinfra/deepseek-ai/DeepSeek-V4-Flash`;
19
21
  const DEEPINFRA_DEFAULT_CONTEXT_WINDOW = 128e3;
20
22
  const DEEPINFRA_DEFAULT_MAX_TOKENS = 8192;
21
23
  const DEEPINFRA_MODEL_CATALOG = DEEPINFRA_MANIFEST_PROVIDER.models;
22
24
  const DISCOVERY_TIMEOUT_MS = 5e3;
23
- const DISCOVERY_CACHE_TTL_MS = 300 * 1e3;
25
+ const DISCOVERY_CACHE_TTL_MS = 3e5;
24
26
  const SURFACE_FOR_TAG = {
25
27
  chat: "chat",
26
28
  vlm: "vlm",
@@ -140,30 +142,7 @@ const STATIC_NON_CHAT_FALLBACK = [
140
142
  defaultHeight: 1024,
141
143
  defaultIterations: 4
142
144
  },
143
- {
144
- id: "hexgrad/Kokoro-82M",
145
- name: "hexgrad/Kokoro-82M",
146
- tags: ["tts"],
147
- pricing: { input_characters: .65 }
148
- },
149
- {
150
- id: "Qwen/Qwen3-TTS",
151
- name: "Qwen/Qwen3-TTS",
152
- tags: ["tts"],
153
- pricing: { input_characters: .65 }
154
- },
155
- {
156
- id: "ResembleAI/chatterbox-turbo",
157
- name: "ResembleAI/chatterbox-turbo",
158
- tags: ["tts"],
159
- pricing: { input_characters: 1 }
160
- },
161
- {
162
- id: "sesame/csm-1b",
163
- name: "sesame/csm-1b",
164
- tags: ["tts"],
165
- pricing: { input_characters: 7 }
166
- },
145
+ ...DEEPINFRA_TTS_FALLBACK_CATALOG,
167
146
  {
168
147
  id: "openai/whisper-large-v3-turbo",
169
148
  name: "openai/whisper-large-v3-turbo",
@@ -205,21 +184,15 @@ function chatSurfaceModelToModelDefinition(model) {
205
184
  const manifestModel = DEEPINFRA_MODEL_CATALOG.find((entry) => entry.id === model.id);
206
185
  const input = model.tags.includes("vlm") ? ["text", "image"] : ["text"];
207
186
  const reasoning = model.tags.includes("reasoning") || model.tags.includes("reasoning_effort");
208
- return buildDeepInfraModelDefinition({
187
+ return {
209
188
  id: model.id,
210
189
  name: model.name,
211
190
  reasoning: manifestModel?.reasoning ?? reasoning,
212
191
  input,
213
192
  ...manifestModel?.compat ? { compat: manifestModel.compat } : {},
214
193
  contextWindow: model.contextWindow ?? DEEPINFRA_DEFAULT_CONTEXT_WINDOW,
215
- maxTokens: model.maxTokens ?? DEEPINFRA_DEFAULT_MAX_TOKENS,
216
- cost: {
217
- input: model.pricing.input_tokens ?? 0,
218
- output: model.pricing.output_tokens ?? 0,
219
- cacheRead: model.pricing.cache_read_tokens ?? 0,
220
- cacheWrite: 0
221
- }
222
- });
194
+ maxTokens: model.maxTokens ?? DEEPINFRA_DEFAULT_MAX_TOKENS
195
+ };
223
196
  }
224
197
  function hasDeepInfraApiKey(options) {
225
198
  const fromEnv = (options?.env ?? process.env).DEEPINFRA_API_KEY;
@@ -231,13 +204,18 @@ function hasDeepInfraApiKey(options) {
231
204
  agentDir: options?.agentDir
232
205
  });
233
206
  }
234
- async function discoverDeepInfraSurfaces(options) {
207
+ function canDiscoverDeepInfra(options) {
235
208
  const env = options?.env ?? process.env;
236
- if (env.NODE_ENV === "test" || env.VITEST) return manifestFallbackCatalog();
237
- if (!(options?.hasApiKey ?? hasDeepInfraApiKey({
209
+ if (env.NODE_ENV === "test" || env.VITEST) return false;
210
+ return options?.hasApiKey ?? hasDeepInfraApiKey({
238
211
  env,
239
212
  agentDir: options?.agentDir
240
- }))) return manifestFallbackCatalog();
213
+ });
214
+ }
215
+ async function discoverDeepInfraSurfaces(options) {
216
+ return canDiscoverDeepInfra(options) ? loadDeepInfraSurfaces() : manifestFallbackCatalog();
217
+ }
218
+ async function loadDeepInfraSurfaces() {
241
219
  try {
242
220
  const data = await getCachedLiveProviderModelRows({
243
221
  providerId: "deepinfra",
@@ -272,19 +250,62 @@ async function discoverDeepInfraSurfaces(options) {
272
250
  return manifestFallbackCatalog();
273
251
  }
274
252
  }
253
+ async function discoverDeepInfraPricing() {
254
+ try {
255
+ return await getCachedLiveCatalogValue({
256
+ keyParts: [
257
+ "deepinfra",
258
+ "native-pricing",
259
+ DEEPINFRA_PRICING_URL
260
+ ],
261
+ ttlMs: DISCOVERY_CACHE_TTL_MS,
262
+ load: async () => {
263
+ const rows = await fetchLiveProviderModelRows({
264
+ providerId: "deepinfra",
265
+ endpoint: DEEPINFRA_PRICING_URL,
266
+ timeoutMs: DISCOVERY_TIMEOUT_MS,
267
+ buildRequestHeaders: () => ({ Accept: "application/json" }),
268
+ auditContext: "deepinfra-pricing-discovery",
269
+ fetchGuard: (params) => fetchWithSsrFGuard(withTrustedEnvProxyGuardedFetchMode(params)),
270
+ readRows: (body) => {
271
+ if (!Array.isArray(body)) throw new Error("Native DeepInfra pricing response must be an array");
272
+ return body;
273
+ }
274
+ });
275
+ const prices = parseDeepInfraPricingCatalog(rows);
276
+ if (!prices) throw new Error("Native DeepInfra pricing is malformed or has no usable schedules");
277
+ return prices;
278
+ }
279
+ });
280
+ } catch (error) {
281
+ log.warn(`Native pricing unavailable: ${String(error)}. Keeping model metadata with unknown estimates; retry discovery or configure explicit model costs.`);
282
+ return;
283
+ }
284
+ }
275
285
  async function discoverDeepInfraModels(options) {
276
- const catalog = await discoverDeepInfraSurfaces(options);
277
- if (!catalog.live) return DEEPINFRA_MODEL_CATALOG.map(buildDeepInfraModelDefinition);
286
+ if (!canDiscoverDeepInfra(options)) return DEEPINFRA_MODEL_CATALOG.map(buildDeepInfraModelDefinition);
287
+ const [catalog, prices] = await Promise.all([loadDeepInfraSurfaces(), discoverDeepInfraPricing()]);
288
+ if (!catalog.live && !prices) return DEEPINFRA_MODEL_CATALOG.map(buildDeepInfraModelDefinition);
278
289
  const chatModels = catalog.chat.length > 0 ? catalog.chat : [...catalog.chat, ...catalog.vlm];
279
- if (chatModels.length === 0) return DEEPINFRA_MODEL_CATALOG.map(buildDeepInfraModelDefinition);
280
- const liveModels = chatModels.map(chatSurfaceModelToModelDefinition);
290
+ const liveModels = catalog.live ? chatModels.map(chatSurfaceModelToModelDefinition) : [];
281
291
  const seen = new Set(liveModels.map((model) => model.id));
282
292
  const manifestModels = DEEPINFRA_MODEL_CATALOG.filter((model) => {
283
293
  const unseen = !seen.has(model.id);
284
294
  seen.add(model.id);
285
295
  return unseen;
286
- }).map(buildDeepInfraModelDefinition);
287
- return [...liveModels, ...manifestModels];
296
+ });
297
+ const models = [...liveModels, ...manifestModels];
298
+ const unknownPrices = models.filter((model) => !prices?.has(model.id)).length;
299
+ 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.`);
300
+ return models.map((model) => buildDeepInfraModelDefinition({
301
+ ...model,
302
+ cost: prices?.get(model.id) ?? {
303
+ input: 0,
304
+ output: 0,
305
+ cacheRead: 0,
306
+ cacheWrite: 0
307
+ }
308
+ }));
288
309
  }
289
310
  //#endregion
290
- export { DEEPINFRA_BASE_URL, DEEPINFRA_DEFAULT_MODEL_REF, DEEPINFRA_MODEL_CATALOG, buildDeepInfraModelDefinition, discoverDeepInfraModels, discoverDeepInfraSurfaces, getDeepInfraSurfaceFallbackCatalog, hasDeepInfraApiKey };
311
+ export { DEEPINFRA_DEFAULT_MODEL_REF, DEEPINFRA_MODEL_CATALOG, buildDeepInfraModelDefinition, discoverDeepInfraModels, discoverDeepInfraSurfaces, getDeepInfraSurfaceFallbackCatalog, hasDeepInfraApiKey };
@@ -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,12 +1,11 @@
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";
6
5
  import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
7
6
  import { canonicalizeBase64 } from "openclaw/plugin-sdk/media-runtime";
8
7
  import { resolveApiKeyForProvider } from "openclaw/plugin-sdk/provider-auth-runtime";
9
- import { assertOkOrThrowHttpError, createProviderOperationDeadline, pollProviderOperationJson, postJsonRequest, readProviderJsonResponse, resolveProviderHttpRequestConfig, resolveProviderOperationTimeoutMs } from "openclaw/plugin-sdk/provider-http";
8
+ import { assertOkOrThrowHttpError, createProviderOperationDeadline, pollProviderOperationJson, postJsonRequest, readProviderJsonResponse, resolveProviderHttpRequestConfig, resolveProviderOperationTimeoutMs, sanitizeConfiguredModelProviderRequest } from "openclaw/plugin-sdk/provider-http";
10
9
  //#region extensions/deepinfra/video-generation-provider.ts
11
10
  const DEFAULT_HTTP_TIMEOUT_MS = 6e4;
12
11
  const POLL_INTERVAL_MS = 5e3;
@@ -128,14 +127,14 @@ function buildDeepInfraVideoGenerationProvider(options) {
128
127
  const { baseUrl, allowPrivateNetwork, headers, dispatcherPolicy } = resolveProviderHttpRequestConfig({
129
128
  baseUrl: resolveDeepInfraVideoBaseUrl(req),
130
129
  defaultBaseUrl: DEEPINFRA_BASE_URL,
131
- allowPrivateNetwork: false,
132
130
  defaultHeaders: {
133
131
  Authorization: `Bearer ${auth.apiKey}`,
134
132
  "Content-Type": "application/json"
135
133
  },
136
134
  provider: "deepinfra",
137
135
  capability: "video",
138
- transport: "http"
136
+ transport: "http",
137
+ request: sanitizeConfiguredModelProviderRequest(req.cfg?.models?.providers?.deepinfra?.request)
139
138
  });
140
139
  const { response, release } = await postJsonRequest({
141
140
  url: `${baseUrl}/videos`,
@@ -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,13 +93,15 @@
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": {
84
- "input": 0.93,
85
- "output": 3,
86
- "cacheRead": 0.18,
102
+ "input": 0.4875,
103
+ "output": 1.56,
104
+ "cacheRead": 0.091000001625,
87
105
  "cacheWrite": 0
88
106
  },
89
107
  "compat": {
@@ -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,13 +133,16 @@
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": {
119
- "input": 0.74,
120
- "output": 3.5,
121
- "cacheRead": 0.15,
143
+ "input": 0.68,
144
+ "output": 3.4,
145
+ "cacheRead": 0.136,
122
146
  "cacheWrite": 0
123
147
  },
124
148
  "compat": {
@@ -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,13 +257,15 @@
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": {
228
- "input": 0.1,
266
+ "input": 0.09,
229
267
  "output": 0.3,
230
- "cacheRead": 0.02,
268
+ "cacheRead": 0.0199999998,
231
269
  "cacheWrite": 0
232
270
  },
233
271
  "compat": {
@@ -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": {
@@ -260,6 +301,15 @@
260
301
  "deepinfra": "refreshable"
261
302
  }
262
303
  },
304
+ "modelPricing": {
305
+ "providers": {
306
+ "deepinfra": {
307
+ "deepinfra": {
308
+ "provider": "deepinfra"
309
+ }
310
+ }
311
+ }
312
+ },
263
313
  "providerAuthChoices": [
264
314
  {
265
315
  "provider": "deepinfra",
@@ -278,15 +328,28 @@
278
328
  }
279
329
  ],
280
330
  "contracts": {
281
- "mediaUnderstandingProviders": ["deepinfra"],
282
- "embeddingProviders": ["deepinfra"],
283
- "imageGenerationProviders": ["deepinfra"],
284
- "speechProviders": ["deepinfra"],
285
- "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
+ ]
286
346
  },
287
347
  "mediaUnderstandingProviderMetadata": {
288
348
  "deepinfra": {
289
- "capabilities": ["image", "audio"],
349
+ "capabilities": [
350
+ "image",
351
+ "audio"
352
+ ],
290
353
  "defaultModels": {
291
354
  "image": "moonshotai/Kimi-K2.5",
292
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-beta.1",
3
+ "version": "2026.9.2",
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-beta.1"
21
+ "pluginApi": ">=2026.9.2"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.9.1-beta.1",
24
+ "openclawVersion": "2026.9.2",
25
25
  "bundledDist": false
26
26
  },
27
27
  "release": {
@@ -38,7 +38,7 @@
38
38
  "README.md"
39
39
  ],
40
40
  "peerDependencies": {
41
- "openclaw": ">=2026.9.1-beta.1"
41
+ "openclaw": ">=2026.9.2"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "openclaw": {