@openclaw/deepinfra-provider 2026.8.1-beta.3 → 2026.8.1
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,33 +1,13 @@
|
|
|
1
|
+
import { DEEPINFRA_BASE_URL } from "./provider-models.js";
|
|
1
2
|
import { DEFAULT_DEEPINFRA_EMBEDDING_MODEL, createDeepInfraEmbeddingProvider } from "./embedding-provider.js";
|
|
3
|
+
import { embeddingProviderOwnsDestination, sanitizeEmbeddingCacheHeaders } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
|
|
2
4
|
//#region extensions/deepinfra/embedding-adapter.ts
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
model: provider.model,
|
|
10
|
-
...typeof provider.maxInputTokens === "number" ? { maxInputTokens: provider.maxInputTokens } : {},
|
|
11
|
-
embed: async (input, options) => await provider.embedQuery(textFromEmbeddingInput(input), { signal: options?.signal }),
|
|
12
|
-
embedBatch: async (inputs, options) => await provider.embedBatch(inputs.map(textFromEmbeddingInput), { signal: options?.signal }),
|
|
13
|
-
...provider.close ? { close: async () => await provider.close?.() } : {}
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function buildMemoryCreateOptions(options) {
|
|
17
|
-
return {
|
|
18
|
-
config: options.config,
|
|
19
|
-
agentDir: options.agentDir,
|
|
20
|
-
provider: "deepinfra",
|
|
21
|
-
fallback: "none",
|
|
22
|
-
remote: options.remote,
|
|
23
|
-
model: options.model,
|
|
24
|
-
inputType: options.inputType,
|
|
25
|
-
queryInputType: options.queryInputType,
|
|
26
|
-
documentInputType: options.documentInputType,
|
|
27
|
-
outputDimensionality: options.dimensions,
|
|
28
|
-
taskType: options.taskType
|
|
29
|
-
};
|
|
30
|
-
}
|
|
5
|
+
const EXCLUDED_EMBEDDING_HEADERS = [
|
|
6
|
+
"authorization",
|
|
7
|
+
"content-type",
|
|
8
|
+
"x-api-key",
|
|
9
|
+
"api-key"
|
|
10
|
+
];
|
|
31
11
|
function buildDeepInfraEmbeddingAdapter(options) {
|
|
32
12
|
const defaultModel = options?.embedModels?.[0]?.id ?? DEFAULT_DEEPINFRA_EMBEDDING_MODEL;
|
|
33
13
|
return {
|
|
@@ -37,16 +17,26 @@ function buildDeepInfraEmbeddingAdapter(options) {
|
|
|
37
17
|
authProviderId: "deepinfra",
|
|
38
18
|
create: async (createOptions) => {
|
|
39
19
|
const { provider, client } = await createDeepInfraEmbeddingProvider({
|
|
40
|
-
...
|
|
20
|
+
...createOptions,
|
|
21
|
+
provider: "deepinfra",
|
|
41
22
|
defaultModel
|
|
42
23
|
});
|
|
24
|
+
const headers = sanitizeEmbeddingCacheHeaders(client.headers, EXCLUDED_EMBEDDING_HEADERS);
|
|
25
|
+
const usesDefaultIdentity = headers.length === 0 && embeddingProviderOwnsDestination({
|
|
26
|
+
baseUrl: client.baseUrl,
|
|
27
|
+
providerBaseUrl: DEEPINFRA_BASE_URL
|
|
28
|
+
});
|
|
43
29
|
return {
|
|
44
|
-
provider
|
|
30
|
+
provider,
|
|
45
31
|
runtime: {
|
|
46
32
|
id: "deepinfra",
|
|
47
33
|
cacheKeyData: {
|
|
48
34
|
provider: "deepinfra",
|
|
49
|
-
model: client.model
|
|
35
|
+
model: client.model,
|
|
36
|
+
...usesDefaultIdentity ? {} : {
|
|
37
|
+
baseUrl: client.baseUrl,
|
|
38
|
+
headers
|
|
39
|
+
}
|
|
50
40
|
}
|
|
51
41
|
}
|
|
52
42
|
};
|
|
@@ -18,7 +18,8 @@ async function createDeepInfraEmbeddingProvider(options) {
|
|
|
18
18
|
provider: createRemoteEmbeddingProvider({
|
|
19
19
|
id: "deepinfra",
|
|
20
20
|
client,
|
|
21
|
-
errorPrefix: "DeepInfra embeddings API error"
|
|
21
|
+
errorPrefix: "DeepInfra embeddings API error",
|
|
22
|
+
batchQueryInputs: true
|
|
22
23
|
}),
|
|
23
24
|
client
|
|
24
25
|
};
|
package/dist/provider-models.js
CHANGED
|
@@ -202,13 +202,15 @@ function buildDeepInfraModelDefinition(model) {
|
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
204
|
function chatSurfaceModelToModelDefinition(model) {
|
|
205
|
+
const manifestModel = DEEPINFRA_MODEL_CATALOG.find((entry) => entry.id === model.id);
|
|
205
206
|
const input = model.tags.includes("vlm") ? ["text", "image"] : ["text"];
|
|
206
207
|
const reasoning = model.tags.includes("reasoning") || model.tags.includes("reasoning_effort");
|
|
207
208
|
return buildDeepInfraModelDefinition({
|
|
208
209
|
id: model.id,
|
|
209
210
|
name: model.name,
|
|
210
|
-
reasoning,
|
|
211
|
+
reasoning: manifestModel?.reasoning ?? reasoning,
|
|
211
212
|
input,
|
|
213
|
+
...manifestModel?.compat ? { compat: manifestModel.compat } : {},
|
|
212
214
|
contextWindow: model.contextWindow ?? DEEPINFRA_DEFAULT_CONTEXT_WINDOW,
|
|
213
215
|
maxTokens: model.maxTokens ?? DEEPINFRA_DEFAULT_MAX_TOKENS,
|
|
214
216
|
cost: {
|
|
@@ -277,11 +279,11 @@ async function discoverDeepInfraModels(options) {
|
|
|
277
279
|
if (chatModels.length === 0) return DEEPINFRA_MODEL_CATALOG.map(buildDeepInfraModelDefinition);
|
|
278
280
|
const liveModels = chatModels.map(chatSurfaceModelToModelDefinition);
|
|
279
281
|
const seen = new Set(liveModels.map((model) => model.id));
|
|
280
|
-
const manifestModels = DEEPINFRA_MODEL_CATALOG.
|
|
281
|
-
|
|
282
|
+
const manifestModels = DEEPINFRA_MODEL_CATALOG.filter((model) => {
|
|
283
|
+
const unseen = !seen.has(model.id);
|
|
282
284
|
seen.add(model.id);
|
|
283
|
-
return
|
|
284
|
-
});
|
|
285
|
+
return unseen;
|
|
286
|
+
}).map(buildDeepInfraModelDefinition);
|
|
285
287
|
return [...liveModels, ...manifestModels];
|
|
286
288
|
}
|
|
287
289
|
//#endregion
|
|
@@ -6,7 +6,7 @@ import { isProviderApiKeyConfigured } from "openclaw/plugin-sdk/provider-auth";
|
|
|
6
6
|
import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
|
|
7
7
|
import { canonicalizeBase64 } from "openclaw/plugin-sdk/media-runtime";
|
|
8
8
|
import { resolveApiKeyForProvider } from "openclaw/plugin-sdk/provider-auth-runtime";
|
|
9
|
-
import { assertOkOrThrowHttpError, createProviderOperationDeadline, pollProviderOperationJson, postJsonRequest, readProviderJsonResponse, resolveProviderHttpRequestConfig, resolveProviderOperationTimeoutMs } from "openclaw/plugin-sdk/provider-http";
|
|
9
|
+
import { assertOkOrThrowHttpError, createProviderOperationDeadline, pollProviderOperationJson, postJsonRequest, readProviderJsonResponse, resolveProviderHttpRequestConfig, resolveProviderOperationTimeoutMs, sanitizeConfiguredModelProviderRequest } from "openclaw/plugin-sdk/provider-http";
|
|
10
10
|
//#region extensions/deepinfra/video-generation-provider.ts
|
|
11
11
|
const DEFAULT_HTTP_TIMEOUT_MS = 6e4;
|
|
12
12
|
const POLL_INTERVAL_MS = 5e3;
|
|
@@ -128,14 +128,14 @@ function buildDeepInfraVideoGenerationProvider(options) {
|
|
|
128
128
|
const { baseUrl, allowPrivateNetwork, headers, dispatcherPolicy } = resolveProviderHttpRequestConfig({
|
|
129
129
|
baseUrl: resolveDeepInfraVideoBaseUrl(req),
|
|
130
130
|
defaultBaseUrl: DEEPINFRA_BASE_URL,
|
|
131
|
-
allowPrivateNetwork: false,
|
|
132
131
|
defaultHeaders: {
|
|
133
132
|
Authorization: `Bearer ${auth.apiKey}`,
|
|
134
133
|
"Content-Type": "application/json"
|
|
135
134
|
},
|
|
136
135
|
provider: "deepinfra",
|
|
137
136
|
capability: "video",
|
|
138
|
-
transport: "http"
|
|
137
|
+
transport: "http",
|
|
138
|
+
request: sanitizeConfiguredModelProviderRequest(req.cfg?.models?.providers?.deepinfra?.request)
|
|
139
139
|
});
|
|
140
140
|
const { response, release } = await postJsonRequest({
|
|
141
141
|
url: `${baseUrl}/videos`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/deepinfra-provider",
|
|
3
|
-
"version": "2026.8.1
|
|
3
|
+
"version": "2026.8.1",
|
|
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.8.1
|
|
21
|
+
"pluginApi": ">=2026.8.1"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.8.1
|
|
24
|
+
"openclawVersion": "2026.8.1",
|
|
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.8.1
|
|
41
|
+
"openclaw": ">=2026.8.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"openclaw": {
|