@openclaw/deepinfra-provider 0.0.0 → 2026.6.9-beta.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.
- package/README.md +11 -2
- package/dist/api.js +9 -0
- package/dist/cache-wrapper.js +13 -0
- package/dist/embedding-provider.js +27 -0
- package/dist/image-generation-provider.js +86 -0
- package/dist/index.js +118 -0
- package/dist/media-models.js +45 -0
- package/dist/media-understanding-provider.js +35 -0
- package/dist/memory-embedding-adapter.js +36 -0
- package/dist/onboard.js +25 -0
- package/dist/provider-catalog.js +30 -0
- package/dist/provider-discovery.js +18 -0
- package/dist/provider-models-BLNlFB8o.js +413 -0
- package/dist/provider-models.js +2 -0
- package/dist/provider-policy-api.js +19 -0
- package/dist/speech-provider.js +40 -0
- package/dist/surface-model-catalogs.js +72 -0
- package/dist/video-generation-provider.js +179 -0
- package/npm-shrinkwrap.json +12 -0
- package/openclaw.plugin.json +224 -0
- package/package.json +44 -8
package/README.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# OpenClaw DeepInfra Provider
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Official OpenClaw provider plugin for DeepInfra.
|
|
4
|
+
|
|
5
|
+
Install from OpenClaw:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
openclaw plugins install @openclaw/deepinfra-provider
|
|
9
|
+
openclaw gateway restart
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
See <https://docs.openclaw.ai/providers/deepinfra> for setup and configuration.
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { r as DEEPINFRA_DEFAULT_MODEL_REF } from "./provider-models-BLNlFB8o.js";
|
|
2
|
+
import { buildDeepInfraImageGenerationProvider } from "./image-generation-provider.js";
|
|
3
|
+
import { deepinfraMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
4
|
+
import { deepinfraMemoryEmbeddingProviderAdapter } from "./memory-embedding-adapter.js";
|
|
5
|
+
import { applyDeepInfraConfig } from "./onboard.js";
|
|
6
|
+
import { buildDeepInfraProvider, buildStaticDeepInfraProvider } from "./provider-catalog.js";
|
|
7
|
+
import { buildDeepInfraSpeechProvider } from "./speech-provider.js";
|
|
8
|
+
import { buildDeepInfraVideoGenerationProvider } from "./video-generation-provider.js";
|
|
9
|
+
export { DEEPINFRA_DEFAULT_MODEL_REF, applyDeepInfraConfig, buildDeepInfraImageGenerationProvider, buildDeepInfraProvider, buildDeepInfraSpeechProvider, buildDeepInfraVideoGenerationProvider, buildStaticDeepInfraProvider, deepinfraMediaUnderstandingProvider, deepinfraMemoryEmbeddingProviderAdapter };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyAnthropicEphemeralCacheControlMarkers, streamWithPayloadPatch } from "openclaw/plugin-sdk/provider-stream";
|
|
2
|
+
//#region extensions/deepinfra/cache-wrapper.ts
|
|
3
|
+
function createDeepInfraAnthropicCacheWrapper(baseStreamFn) {
|
|
4
|
+
return ((model, context, options) => {
|
|
5
|
+
const modelIdRaw = model.id;
|
|
6
|
+
if (!(typeof modelIdRaw === "string" ? modelIdRaw.toLowerCase() : "").startsWith("anthropic/")) return baseStreamFn(model, context, options);
|
|
7
|
+
return streamWithPayloadPatch(baseStreamFn, model, context, options, (payload) => {
|
|
8
|
+
applyAnthropicEphemeralCacheControlMarkers(payload);
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { createDeepInfraAnthropicCacheWrapper };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { t as DEEPINFRA_BASE_URL } from "./provider-models-BLNlFB8o.js";
|
|
2
|
+
import { DEEPINFRA_EMBED_FALLBACK_MODELS, normalizeDeepInfraModelRef } from "./media-models.js";
|
|
3
|
+
import { createRemoteEmbeddingProvider, resolveRemoteEmbeddingClient } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
|
|
4
|
+
//#region extensions/deepinfra/embedding-provider.ts
|
|
5
|
+
const DEFAULT_DEEPINFRA_EMBEDDING_MODEL = DEEPINFRA_EMBED_FALLBACK_MODELS[0];
|
|
6
|
+
async function createDeepInfraEmbeddingProvider(options) {
|
|
7
|
+
const defaultModel = options.defaultModel ?? DEFAULT_DEEPINFRA_EMBEDDING_MODEL;
|
|
8
|
+
const client = await resolveRemoteEmbeddingClient({
|
|
9
|
+
provider: "deepinfra",
|
|
10
|
+
options: {
|
|
11
|
+
...options,
|
|
12
|
+
model: normalizeDeepInfraModelRef(options.model, defaultModel)
|
|
13
|
+
},
|
|
14
|
+
defaultBaseUrl: DEEPINFRA_BASE_URL,
|
|
15
|
+
normalizeModel: (model) => normalizeDeepInfraModelRef(model, defaultModel)
|
|
16
|
+
});
|
|
17
|
+
return {
|
|
18
|
+
provider: createRemoteEmbeddingProvider({
|
|
19
|
+
id: "deepinfra",
|
|
20
|
+
client,
|
|
21
|
+
errorPrefix: "DeepInfra embeddings API error"
|
|
22
|
+
}),
|
|
23
|
+
client
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { DEFAULT_DEEPINFRA_EMBEDDING_MODEL, createDeepInfraEmbeddingProvider };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { t as DEEPINFRA_BASE_URL } from "./provider-models-BLNlFB8o.js";
|
|
2
|
+
import { DEEPINFRA_IMAGE_FALLBACK_MODELS, normalizeDeepInfraBaseUrl, normalizeDeepInfraModelRef } from "./media-models.js";
|
|
3
|
+
import { createOpenAiCompatibleImageGenerationProvider, imageSourceUploadFileName } from "openclaw/plugin-sdk/image-generation";
|
|
4
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
|
+
//#region extensions/deepinfra/image-generation-provider.ts
|
|
6
|
+
const DEEPINFRA_IMAGE_SIZES = [
|
|
7
|
+
"512x512",
|
|
8
|
+
"1024x1024",
|
|
9
|
+
"1024x1792",
|
|
10
|
+
"1792x1024"
|
|
11
|
+
];
|
|
12
|
+
const MAX_DEEPINFRA_INPUT_IMAGES = 1;
|
|
13
|
+
function buildDeepInfraImageGenerationProvider(options) {
|
|
14
|
+
const ids = options?.imageGenModels && options.imageGenModels.length > 0 ? options.imageGenModels.map((model) => model.id) : [...DEEPINFRA_IMAGE_FALLBACK_MODELS];
|
|
15
|
+
return createOpenAiCompatibleImageGenerationProvider({
|
|
16
|
+
id: "deepinfra",
|
|
17
|
+
label: "DeepInfra",
|
|
18
|
+
defaultModel: ids[0] ?? DEEPINFRA_IMAGE_FALLBACK_MODELS[0],
|
|
19
|
+
models: ids,
|
|
20
|
+
capabilities: {
|
|
21
|
+
generate: {
|
|
22
|
+
maxCount: 4,
|
|
23
|
+
supportsSize: true,
|
|
24
|
+
supportsAspectRatio: false,
|
|
25
|
+
supportsResolution: false
|
|
26
|
+
},
|
|
27
|
+
edit: {
|
|
28
|
+
enabled: true,
|
|
29
|
+
maxCount: 1,
|
|
30
|
+
maxInputImages: MAX_DEEPINFRA_INPUT_IMAGES,
|
|
31
|
+
supportsSize: true,
|
|
32
|
+
supportsAspectRatio: false,
|
|
33
|
+
supportsResolution: false
|
|
34
|
+
},
|
|
35
|
+
geometry: { sizes: [...DEEPINFRA_IMAGE_SIZES] }
|
|
36
|
+
},
|
|
37
|
+
defaultBaseUrl: DEEPINFRA_BASE_URL,
|
|
38
|
+
normalizeModel: normalizeDeepInfraModelRef,
|
|
39
|
+
resolveBaseUrl: ({ providerConfig }) => normalizeDeepInfraBaseUrl(providerConfig?.baseUrl, DEEPINFRA_BASE_URL),
|
|
40
|
+
resolveAllowPrivateNetwork: () => false,
|
|
41
|
+
useConfiguredRequest: true,
|
|
42
|
+
resolveCount: ({ req, mode }) => mode === "edit" ? 1 : req.count ?? 1,
|
|
43
|
+
buildGenerateRequest: ({ req, model, count }) => ({
|
|
44
|
+
kind: "json",
|
|
45
|
+
body: {
|
|
46
|
+
model,
|
|
47
|
+
prompt: req.prompt,
|
|
48
|
+
n: count,
|
|
49
|
+
size: normalizeOptionalString(req.size) ?? "1024x1024",
|
|
50
|
+
response_format: "b64_json"
|
|
51
|
+
}
|
|
52
|
+
}),
|
|
53
|
+
buildEditRequest: ({ req, inputImages, model, count }) => {
|
|
54
|
+
const image = inputImages[0];
|
|
55
|
+
if (!image) throw new Error("DeepInfra image edit missing reference image.");
|
|
56
|
+
const form = new FormData();
|
|
57
|
+
form.set("model", model);
|
|
58
|
+
form.set("prompt", req.prompt);
|
|
59
|
+
form.set("n", String(count));
|
|
60
|
+
form.set("size", normalizeOptionalString(req.size) ?? "1024x1024");
|
|
61
|
+
form.set("response_format", "b64_json");
|
|
62
|
+
const mimeType = normalizeOptionalString(image.mimeType) ?? "image/png";
|
|
63
|
+
form.append("image", new Blob([new Uint8Array(image.buffer)], { type: mimeType }), imageSourceUploadFileName({
|
|
64
|
+
image,
|
|
65
|
+
index: 0
|
|
66
|
+
}));
|
|
67
|
+
return {
|
|
68
|
+
kind: "multipart",
|
|
69
|
+
form
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
response: {
|
|
73
|
+
defaultMimeType: "image/jpeg",
|
|
74
|
+
sniffMimeType: true
|
|
75
|
+
},
|
|
76
|
+
tooManyInputImagesError: "DeepInfra image editing supports one reference image.",
|
|
77
|
+
missingApiKeyError: "DeepInfra API key missing",
|
|
78
|
+
emptyResponseError: "DeepInfra image response did not include generated image data",
|
|
79
|
+
failureLabels: {
|
|
80
|
+
generate: "DeepInfra image generation failed",
|
|
81
|
+
edit: "DeepInfra image edit failed"
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
86
|
+
export { buildDeepInfraImageGenerationProvider };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { createDeepInfraAnthropicCacheWrapper } from "./cache-wrapper.js";
|
|
2
|
+
import { l as getDeepInfraSurfaceFallbackCatalog, r as DEEPINFRA_DEFAULT_MODEL_REF, s as discoverDeepInfraModels, u as hasDeepInfraApiKey } from "./provider-models-BLNlFB8o.js";
|
|
3
|
+
import { buildDeepInfraImageGenerationProvider } from "./image-generation-provider.js";
|
|
4
|
+
import { buildDeepInfraMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
5
|
+
import { buildDeepInfraMemoryEmbeddingAdapter } from "./memory-embedding-adapter.js";
|
|
6
|
+
import { applyDeepInfraConfig } from "./onboard.js";
|
|
7
|
+
import { buildDeepInfraApiKeyCatalog, buildStaticDeepInfraProvider } from "./provider-catalog.js";
|
|
8
|
+
import { buildDeepInfraSpeechProvider } from "./speech-provider.js";
|
|
9
|
+
import { listDeepInfraImageGenCatalog, listDeepInfraVideoGenCatalog } from "./surface-model-catalogs.js";
|
|
10
|
+
import { buildDeepInfraVideoGenerationProvider } from "./video-generation-provider.js";
|
|
11
|
+
import { readConfiguredProviderCatalogEntries } from "openclaw/plugin-sdk/provider-catalog-shared";
|
|
12
|
+
import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
|
|
13
|
+
import { PASSTHROUGH_GEMINI_REPLAY_HOOKS } from "openclaw/plugin-sdk/provider-model-shared";
|
|
14
|
+
import { createOpenRouterWrapper, isProxyReasoningUnsupported } from "openclaw/plugin-sdk/provider-stream";
|
|
15
|
+
//#region extensions/deepinfra/index.ts
|
|
16
|
+
const PROVIDER_ID = "deepinfra";
|
|
17
|
+
var deepinfra_default = defineSingleProviderPluginEntry({
|
|
18
|
+
id: PROVIDER_ID,
|
|
19
|
+
name: "DeepInfra Provider",
|
|
20
|
+
description: "Bundled DeepInfra provider plugin",
|
|
21
|
+
provider: {
|
|
22
|
+
label: "DeepInfra",
|
|
23
|
+
docsPath: "/providers/deepinfra",
|
|
24
|
+
auth: [{
|
|
25
|
+
methodId: "api-key",
|
|
26
|
+
label: "DeepInfra API key",
|
|
27
|
+
hint: "Unified API for open source models",
|
|
28
|
+
optionKey: "deepinfraApiKey",
|
|
29
|
+
flagName: "--deepinfra-api-key",
|
|
30
|
+
envVar: "DEEPINFRA_API_KEY",
|
|
31
|
+
promptMessage: "Enter DeepInfra API key",
|
|
32
|
+
noteTitle: "DeepInfra",
|
|
33
|
+
noteMessage: ["DeepInfra provides an OpenAI-compatible API for open source and frontier models.", "Get your API key at: https://deepinfra.com/dash/api_keys"].join("\n"),
|
|
34
|
+
defaultModel: DEEPINFRA_DEFAULT_MODEL_REF,
|
|
35
|
+
applyConfig: (cfg) => applyDeepInfraConfig(cfg),
|
|
36
|
+
wizard: {
|
|
37
|
+
choiceId: "deepinfra-api-key",
|
|
38
|
+
choiceLabel: "DeepInfra API key",
|
|
39
|
+
choiceHint: "Unified API for open source models",
|
|
40
|
+
groupId: PROVIDER_ID,
|
|
41
|
+
groupLabel: "DeepInfra",
|
|
42
|
+
groupHint: "Unified API for open source models"
|
|
43
|
+
}
|
|
44
|
+
}],
|
|
45
|
+
catalog: {
|
|
46
|
+
order: "simple",
|
|
47
|
+
run: (ctx) => buildDeepInfraApiKeyCatalog(ctx),
|
|
48
|
+
staticRun: async () => ({ provider: buildStaticDeepInfraProvider() })
|
|
49
|
+
},
|
|
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
|
+
normalizeConfig: ({ providerConfig }) => providerConfig,
|
|
83
|
+
normalizeTransport: ({ api, baseUrl }) => baseUrl === "https://api.deepinfra.com/v1/openai" ? {
|
|
84
|
+
api,
|
|
85
|
+
baseUrl
|
|
86
|
+
} : void 0,
|
|
87
|
+
...PASSTHROUGH_GEMINI_REPLAY_HOOKS,
|
|
88
|
+
wrapStreamFn: (ctx) => {
|
|
89
|
+
const thinkingLevel = isProxyReasoningUnsupported(ctx.modelId) ? void 0 : ctx.thinkingLevel;
|
|
90
|
+
return createDeepInfraAnthropicCacheWrapper(createOpenRouterWrapper(ctx.streamFn, thinkingLevel));
|
|
91
|
+
},
|
|
92
|
+
isModernModelRef: () => true,
|
|
93
|
+
isCacheTtlEligible: (ctx) => ctx.modelId.toLowerCase().startsWith("anthropic/")
|
|
94
|
+
},
|
|
95
|
+
register(api) {
|
|
96
|
+
const catalog = getDeepInfraSurfaceFallbackCatalog();
|
|
97
|
+
api.registerImageGenerationProvider(buildDeepInfraImageGenerationProvider({ imageGenModels: catalog.imageGen }));
|
|
98
|
+
api.registerModelCatalogProvider({
|
|
99
|
+
provider: PROVIDER_ID,
|
|
100
|
+
kinds: ["image_generation"],
|
|
101
|
+
liveCatalog: listDeepInfraImageGenCatalog
|
|
102
|
+
});
|
|
103
|
+
api.registerMediaUnderstandingProvider(buildDeepInfraMediaUnderstandingProvider({
|
|
104
|
+
vlmModels: catalog.vlm,
|
|
105
|
+
sttModels: catalog.stt
|
|
106
|
+
}));
|
|
107
|
+
api.registerMemoryEmbeddingProvider(buildDeepInfraMemoryEmbeddingAdapter({ embedModels: catalog.embed }));
|
|
108
|
+
api.registerSpeechProvider(buildDeepInfraSpeechProvider({ ttsModels: catalog.tts }));
|
|
109
|
+
api.registerVideoGenerationProvider(buildDeepInfraVideoGenerationProvider({ videoGenModels: catalog.videoGen }));
|
|
110
|
+
api.registerModelCatalogProvider({
|
|
111
|
+
provider: PROVIDER_ID,
|
|
112
|
+
kinds: ["video_generation"],
|
|
113
|
+
liveCatalog: listDeepInfraVideoGenCatalog
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
//#endregion
|
|
118
|
+
export { deepinfra_default as default };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { t as DEEPINFRA_BASE_URL } from "./provider-models-BLNlFB8o.js";
|
|
2
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
+
//#region extensions/deepinfra/media-models.ts
|
|
4
|
+
const DEEPINFRA_NATIVE_BASE_URL = "https://api.deepinfra.com/v1/inference";
|
|
5
|
+
const DEFAULT_DEEPINFRA_IMAGE_SIZE = "1024x1024";
|
|
6
|
+
const DEFAULT_DEEPINFRA_TTS_VOICE = "af_bella";
|
|
7
|
+
const DEEPINFRA_VIDEO_ASPECT_RATIOS = [
|
|
8
|
+
"16:9",
|
|
9
|
+
"4:3",
|
|
10
|
+
"1:1",
|
|
11
|
+
"3:4",
|
|
12
|
+
"9:16"
|
|
13
|
+
];
|
|
14
|
+
const DEEPINFRA_VIDEO_DURATIONS = [5, 8];
|
|
15
|
+
const DEEPINFRA_IMAGE_FALLBACK_MODELS = [
|
|
16
|
+
"black-forest-labs/FLUX-1-schnell",
|
|
17
|
+
"run-diffusion/Juggernaut-Lightning-Flux",
|
|
18
|
+
"black-forest-labs/FLUX-1-dev",
|
|
19
|
+
"Qwen/Qwen-Image-Max",
|
|
20
|
+
"stabilityai/sdxl-turbo"
|
|
21
|
+
];
|
|
22
|
+
const DEEPINFRA_TTS_FALLBACK_MODELS = [
|
|
23
|
+
"hexgrad/Kokoro-82M",
|
|
24
|
+
"Qwen/Qwen3-TTS",
|
|
25
|
+
"ResembleAI/chatterbox-turbo",
|
|
26
|
+
"sesame/csm-1b"
|
|
27
|
+
];
|
|
28
|
+
const DEEPINFRA_VIDEO_FALLBACK_MODELS = [
|
|
29
|
+
"Pixverse/Pixverse-T2V",
|
|
30
|
+
"Pixverse/Pixverse-T2V-HD",
|
|
31
|
+
"Wan-AI/Wan2.6-T2V",
|
|
32
|
+
"google/veo-3.1-fast"
|
|
33
|
+
];
|
|
34
|
+
const DEEPINFRA_STT_FALLBACK_MODELS = ["openai/whisper-large-v3-turbo", "openai/whisper-large-v3"];
|
|
35
|
+
const DEEPINFRA_EMBED_FALLBACK_MODELS = ["BAAI/bge-m3"];
|
|
36
|
+
const DEEPINFRA_VLM_FALLBACK_MODELS = ["moonshotai/Kimi-K2.5"];
|
|
37
|
+
function normalizeDeepInfraModelRef(model, fallback) {
|
|
38
|
+
const value = normalizeOptionalString(model) ?? fallback;
|
|
39
|
+
return value.startsWith("deepinfra/") ? value.slice(10) : value;
|
|
40
|
+
}
|
|
41
|
+
function normalizeDeepInfraBaseUrl(value, fallback = DEEPINFRA_BASE_URL) {
|
|
42
|
+
return (normalizeOptionalString(value) ?? fallback).replace(/\/+$/u, "");
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { DEEPINFRA_BASE_URL, DEEPINFRA_EMBED_FALLBACK_MODELS, DEEPINFRA_IMAGE_FALLBACK_MODELS, DEEPINFRA_NATIVE_BASE_URL, 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 };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { t as DEEPINFRA_BASE_URL } from "./provider-models-BLNlFB8o.js";
|
|
2
|
+
import { DEEPINFRA_STT_FALLBACK_MODELS, DEEPINFRA_VLM_FALLBACK_MODELS } from "./media-models.js";
|
|
3
|
+
import { describeImageWithModel, describeImagesWithModel, transcribeOpenAiCompatibleAudio } from "openclaw/plugin-sdk/media-understanding";
|
|
4
|
+
//#region extensions/deepinfra/media-understanding-provider.ts
|
|
5
|
+
function resolveDefault(surfaceModels, fallback) {
|
|
6
|
+
return surfaceModels?.[0]?.id ?? fallback[0] ?? "";
|
|
7
|
+
}
|
|
8
|
+
async function transcribeDeepInfraAudio(params) {
|
|
9
|
+
return await transcribeOpenAiCompatibleAudio({
|
|
10
|
+
...params,
|
|
11
|
+
provider: "deepinfra",
|
|
12
|
+
defaultBaseUrl: DEEPINFRA_BASE_URL,
|
|
13
|
+
defaultModel: resolveDefault(void 0, DEEPINFRA_STT_FALLBACK_MODELS)
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function buildDeepInfraMediaUnderstandingProvider(options) {
|
|
17
|
+
return {
|
|
18
|
+
id: "deepinfra",
|
|
19
|
+
capabilities: ["image", "audio"],
|
|
20
|
+
defaultModels: {
|
|
21
|
+
image: resolveDefault(options?.vlmModels, DEEPINFRA_VLM_FALLBACK_MODELS),
|
|
22
|
+
audio: resolveDefault(options?.sttModels, DEEPINFRA_STT_FALLBACK_MODELS)
|
|
23
|
+
},
|
|
24
|
+
autoPriority: {
|
|
25
|
+
image: 45,
|
|
26
|
+
audio: 45
|
|
27
|
+
},
|
|
28
|
+
transcribeAudio: transcribeDeepInfraAudio,
|
|
29
|
+
describeImage: describeImageWithModel,
|
|
30
|
+
describeImages: describeImagesWithModel
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const deepinfraMediaUnderstandingProvider = buildDeepInfraMediaUnderstandingProvider();
|
|
34
|
+
//#endregion
|
|
35
|
+
export { buildDeepInfraMediaUnderstandingProvider, deepinfraMediaUnderstandingProvider, transcribeDeepInfraAudio };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { DEFAULT_DEEPINFRA_EMBEDDING_MODEL, createDeepInfraEmbeddingProvider } from "./embedding-provider.js";
|
|
2
|
+
import { isMissingEmbeddingApiKeyError } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
|
|
3
|
+
//#region extensions/deepinfra/memory-embedding-adapter.ts
|
|
4
|
+
function buildDeepInfraMemoryEmbeddingAdapter(options) {
|
|
5
|
+
const defaultModel = options?.embedModels?.[0]?.id ?? DEFAULT_DEEPINFRA_EMBEDDING_MODEL;
|
|
6
|
+
return {
|
|
7
|
+
id: "deepinfra",
|
|
8
|
+
defaultModel,
|
|
9
|
+
transport: "remote",
|
|
10
|
+
authProviderId: "deepinfra",
|
|
11
|
+
autoSelectPriority: 55,
|
|
12
|
+
allowExplicitWhenConfiguredAuto: true,
|
|
13
|
+
shouldContinueAutoSelection: isMissingEmbeddingApiKeyError,
|
|
14
|
+
create: async (createOptions) => {
|
|
15
|
+
const { provider, client } = await createDeepInfraEmbeddingProvider({
|
|
16
|
+
...createOptions,
|
|
17
|
+
provider: "deepinfra",
|
|
18
|
+
fallback: "none",
|
|
19
|
+
defaultModel
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
provider,
|
|
23
|
+
runtime: {
|
|
24
|
+
id: "deepinfra",
|
|
25
|
+
cacheKeyData: {
|
|
26
|
+
provider: "deepinfra",
|
|
27
|
+
model: client.model
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const deepinfraMemoryEmbeddingProviderAdapter = buildDeepInfraMemoryEmbeddingAdapter();
|
|
35
|
+
//#endregion
|
|
36
|
+
export { buildDeepInfraMemoryEmbeddingAdapter, deepinfraMemoryEmbeddingProviderAdapter };
|
package/dist/onboard.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { r as DEEPINFRA_DEFAULT_MODEL_REF, t as DEEPINFRA_BASE_URL } from "./provider-models-BLNlFB8o.js";
|
|
2
|
+
import { applyAgentDefaultModelPrimary } from "openclaw/plugin-sdk/provider-onboard";
|
|
3
|
+
//#region extensions/deepinfra/onboard.ts
|
|
4
|
+
function applyDeepInfraProviderConfig(cfg, modelRef = DEEPINFRA_DEFAULT_MODEL_REF) {
|
|
5
|
+
const models = { ...cfg.agents?.defaults?.models };
|
|
6
|
+
models[modelRef] = {
|
|
7
|
+
...models[modelRef],
|
|
8
|
+
alias: models[modelRef]?.alias ?? "DeepInfra"
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
...cfg,
|
|
12
|
+
agents: {
|
|
13
|
+
...cfg.agents,
|
|
14
|
+
defaults: {
|
|
15
|
+
...cfg.agents?.defaults,
|
|
16
|
+
models
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function applyDeepInfraConfig(cfg, modelRef = DEEPINFRA_DEFAULT_MODEL_REF) {
|
|
22
|
+
return applyAgentDefaultModelPrimary(applyDeepInfraProviderConfig(cfg, modelRef), modelRef);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { DEEPINFRA_BASE_URL, DEEPINFRA_DEFAULT_MODEL_REF, applyDeepInfraConfig, applyDeepInfraProviderConfig };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { a as DEEPINFRA_MODEL_CATALOG, o as buildDeepInfraModelDefinition, s as discoverDeepInfraModels, t as DEEPINFRA_BASE_URL } from "./provider-models-BLNlFB8o.js";
|
|
2
|
+
import { buildSingleProviderApiKeyCatalog } from "openclaw/plugin-sdk/provider-catalog-shared";
|
|
3
|
+
//#region extensions/deepinfra/provider-catalog.ts
|
|
4
|
+
function buildStaticDeepInfraProvider() {
|
|
5
|
+
return {
|
|
6
|
+
baseUrl: DEEPINFRA_BASE_URL,
|
|
7
|
+
api: "openai-completions",
|
|
8
|
+
models: DEEPINFRA_MODEL_CATALOG.map(buildDeepInfraModelDefinition)
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
async function buildDeepInfraProvider(options) {
|
|
12
|
+
return {
|
|
13
|
+
baseUrl: DEEPINFRA_BASE_URL,
|
|
14
|
+
api: "openai-completions",
|
|
15
|
+
models: await discoverDeepInfraModels(options)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function buildDeepInfraApiKeyCatalog(ctx) {
|
|
19
|
+
return buildSingleProviderApiKeyCatalog({
|
|
20
|
+
ctx,
|
|
21
|
+
providerId: "deepinfra",
|
|
22
|
+
buildProvider: () => buildDeepInfraProvider({
|
|
23
|
+
hasApiKey: true,
|
|
24
|
+
env: ctx.env,
|
|
25
|
+
agentDir: ctx.agentDir
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { buildDeepInfraApiKeyCatalog, buildDeepInfraProvider, buildStaticDeepInfraProvider };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { buildDeepInfraApiKeyCatalog, buildStaticDeepInfraProvider } from "./provider-catalog.js";
|
|
2
|
+
//#region extensions/deepinfra/provider-discovery.ts
|
|
3
|
+
const deepinfraProviderDiscovery = {
|
|
4
|
+
id: "deepinfra",
|
|
5
|
+
label: "DeepInfra",
|
|
6
|
+
docsPath: "/providers/deepinfra",
|
|
7
|
+
auth: [],
|
|
8
|
+
catalog: {
|
|
9
|
+
order: "simple",
|
|
10
|
+
run: (ctx) => buildDeepInfraApiKeyCatalog(ctx)
|
|
11
|
+
},
|
|
12
|
+
staticCatalog: {
|
|
13
|
+
order: "simple",
|
|
14
|
+
run: async () => ({ provider: buildStaticDeepInfraProvider() })
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { deepinfraProviderDiscovery as default };
|