diff --git a/extensions/deepinfra/onboard.ts b/extensions/deepinfra/onboard.ts index 248eac4ba4c..b19a7d6b1a2 100644 --- a/extensions/deepinfra/onboard.ts +++ b/extensions/deepinfra/onboard.ts @@ -4,10 +4,8 @@ import { } from "openclaw/plugin-sdk/provider-models"; import { applyAgentDefaultModelPrimary, - applyProviderConfigWithModelCatalog, type OpenClawConfig, } from "openclaw/plugin-sdk/provider-onboard"; -import { buildDeepInfraStaticProvider } from "./provider-catalog.js"; export { DEEPINFRA_BASE_URL, DEEPINFRA_DEFAULT_MODEL_REF }; @@ -18,13 +16,16 @@ export function applyDeepInfraProviderConfig(cfg: OpenClawConfig): OpenClawConfi alias: models[DEEPINFRA_DEFAULT_MODEL_REF]?.alias ?? "DeepInfra", }; - return applyProviderConfigWithModelCatalog(cfg, { - agentModels: models, - providerId: "deepinfra", - api: "openai-completions", - baseUrl: DEEPINFRA_BASE_URL, - catalogModels: buildDeepInfraStaticProvider().models ?? [], - }); + return { + ...cfg, + agents: { + ...cfg.agents, + defaults: { + ...cfg.agents?.defaults, + models, + }, + }, + }; } export function applyDeepInfraConfig(cfg: OpenClawConfig): OpenClawConfig { diff --git a/extensions/deepinfra/provider-catalog.ts b/extensions/deepinfra/provider-catalog.ts index bedfc5d7fdc..6e3ba6c12b8 100644 --- a/extensions/deepinfra/provider-catalog.ts +++ b/extensions/deepinfra/provider-catalog.ts @@ -1,7 +1,6 @@ import { type ModelProviderConfig, discoverDeepInfraModels, - buildDeepInfraStaticCatalog, DEEPINFRA_BASE_URL, } from "openclaw/plugin-sdk/provider-models"; @@ -13,11 +12,3 @@ export async function buildDeepInfraProviderWithDiscovery(): Promise { }); it("should build deepinfra provider with correct configuration", () => { - const provider = buildDeepInfraStaticProvider(); - expect(provider.baseUrl).toBe("https://api.deepinfra.com/v1/openai/"); - expect(provider.api).toBe("openai-completions"); - expect(provider.models).toBeDefined(); - expect(provider.models.length).toBeGreaterThan(0); + const models = buildStaticCatalog(); + expect(models).toBeDefined(); + expect(models.length).toBeGreaterThan(0); }); it("should include the default deepinfra model", () => { - const provider = buildDeepInfraStaticProvider(); - const modelIds = provider.models.map((m) => m.id); + const models = buildStaticCatalog(); + const modelIds = models.map((m) => m.id); expect(modelIds).toContain("openai/gpt-oss-120b"); }); it("should include the static fallback catalog", () => { - const provider = buildDeepInfraStaticProvider(); - const modelIds = provider.models.map((m) => m.id); + const models = buildStaticCatalog(); + const modelIds = models.map((m) => m.id); for (const modelId of DEEPINFRA_MODEL_IDS) { expect(modelIds).toContain(modelId); } - expect(provider.models).toHaveLength(DEEPINFRA_MODEL_IDS.length); + expect(models).toHaveLength(DEEPINFRA_MODEL_IDS.length); }); }); diff --git a/src/agents/models-config.providers.static.ts b/src/agents/models-config.providers.static.ts index d1cd2f51310..71184e12286 100644 --- a/src/agents/models-config.providers.static.ts +++ b/src/agents/models-config.providers.static.ts @@ -4,7 +4,6 @@ export { } from "../../extensions/byteplus/provider-catalog.js"; export { buildKimiCodingProvider } from "../../extensions/kimi-coding/provider-catalog.js"; export { buildKilocodeProvider } from "../../extensions/kilocode/provider-catalog.js"; -export { buildDeepInfraStaticProvider } from "../../extensions/deepinfra/provider-catalog.js"; export { buildMinimaxPortalProvider, buildMinimaxProvider, diff --git a/src/agents/models-config.providers.ts b/src/agents/models-config.providers.ts index 1fa7289ef54..af9c3d6e34a 100644 --- a/src/agents/models-config.providers.ts +++ b/src/agents/models-config.providers.ts @@ -11,7 +11,6 @@ import { ensureAuthProfileStore, listProfilesForProvider } from "./auth-profiles import { discoverBedrockModels } from "./bedrock-discovery.js"; import { normalizeGoogleModelId } from "./model-id-normalization.js"; import { resolveOllamaApiBase } from "./models-config.providers.discovery.js"; -export { buildDeepInfraStaticProvider } from "../../extensions/deepinfra/provider-catalog.js"; export { buildKimiCodingProvider } from "../../extensions/kimi-coding/provider-catalog.js"; export { buildKilocodeProvider } from "../../extensions/kilocode/provider-catalog.js"; export { diff --git a/src/commands/onboard-auth.config-core.deepinfra.test.ts b/src/commands/onboard-auth.config-core.deepinfra.test.ts index b80b2a4544f..4cf04c3cc48 100644 --- a/src/commands/onboard-auth.config-core.deepinfra.test.ts +++ b/src/commands/onboard-auth.config-core.deepinfra.test.ts @@ -16,12 +16,10 @@ import { DEEPINFRA_DEFAULT_MODEL_ID, DEEPINFRA_DEFAULT_MODEL_REF, DEEPINFRA_DEFAULT_MAX_TOKENS, - DEEPINFRA_MODEL_CATALOG, } from "../providers/deepinfra-shared.js"; import { captureEnv } from "../test-utils/env.js"; const emptyCfg: OpenClawConfig = {}; -const DEEPINFRA_MODEL_IDS = DEEPINFRA_MODEL_CATALOG.map((m) => m.id); describe("DeepInfra provider config", () => { describe("constants", () => { @@ -56,48 +54,9 @@ describe("DeepInfra provider config", () => { }); describe("applyDeepInfraProviderConfig", () => { - it("registers deepinfra provider with correct baseUrl and api", () => { + it("does not persist a provider block (discovery populates models at runtime)", () => { const result = applyDeepInfraProviderConfig(emptyCfg); - const provider = result.models?.providers?.deepinfra; - expect(provider).toBeDefined(); - expect(provider?.baseUrl).toBe(DEEPINFRA_BASE_URL); - expect(provider?.api).toBe("openai-completions"); - }); - - it("includes the default model in the provider model list", () => { - const result = applyDeepInfraProviderConfig(emptyCfg); - const provider = result.models?.providers?.deepinfra; - const models = provider?.models; - expect(Array.isArray(models)).toBe(true); - const modelIds = models?.map((m) => m.id) ?? []; - expect(modelIds).toContain(DEEPINFRA_DEFAULT_MODEL_ID); - }); - - it("surfaces the full DeepInfra model catalog", () => { - const result = applyDeepInfraProviderConfig(emptyCfg); - const provider = result.models?.providers?.deepinfra; - const modelIds = provider?.models?.map((m) => m.id) ?? []; - for (const modelId of DEEPINFRA_MODEL_IDS) { - expect(modelIds).toContain(modelId); - } - }); - - it("appends missing catalog models to existing DeepInfra provider config", () => { - const result = applyDeepInfraProviderConfig({ - models: { - providers: { - deepinfra: { - baseUrl: DEEPINFRA_BASE_URL, - api: "openai-completions", - models: [{ ...DEEPINFRA_MODEL_CATALOG[0], cost: DEEPINFRA_DEFAULT_COST }], - }, - }, - }, - }); - const modelIds = result.models?.providers?.deepinfra?.models?.map((m) => m.id) ?? []; - for (const modelId of DEEPINFRA_MODEL_IDS) { - expect(modelIds).toContain(modelId); - } + expect(result.models?.providers?.deepinfra).toBeUndefined(); }); it("sets DeepInfra alias in agent default models", () => { @@ -143,11 +102,9 @@ describe("DeepInfra provider config", () => { ); }); - it("also registers the provider", () => { + it("does not persist a provider block (discovery populates models at runtime)", () => { const result = applyDeepInfraConfig(emptyCfg); - const provider = result.models?.providers?.deepinfra; - expect(provider).toBeDefined(); - expect(provider?.baseUrl).toBe(DEEPINFRA_BASE_URL); + expect(result.models?.providers?.deepinfra).toBeUndefined(); }); }); diff --git a/src/plugin-sdk/provider-models.ts b/src/plugin-sdk/provider-models.ts index b2d033ae138..4ee1c9d27f1 100644 --- a/src/plugin-sdk/provider-models.ts +++ b/src/plugin-sdk/provider-models.ts @@ -106,10 +106,7 @@ export { VERCEL_AI_GATEWAY_BASE_URL, } from "../agents/vercel-ai-gateway.js"; export { DEEPINFRA_BASE_URL, DEEPINFRA_DEFAULT_MODEL_REF } from "../providers/deepinfra-shared.js"; -export { - buildStaticCatalog as buildDeepInfraStaticCatalog, - discoverDeepInfraModels, -} from "../agents/deepinfra-models.js"; +export { discoverDeepInfraModels } from "../agents/deepinfra-models.js"; export function buildKilocodeModelDefinition(): ModelDefinitionConfig { return {