Files
openclaw/extensions/deepinfra/provider-catalog.ts
Georgi Atsev 9e7c2b356b fix(deepinfra): load all DeepInfra models when user wants to browse t… (#84549)
* fix(deepinfra): load all DeepInfra models when user wants to browse them during onboarding

* docs(deepinfra): align TTS default

* fix(deepinfra): refresh video fallbacks

* fix(deepinfra): share credential-aware catalog discovery

* test(deepinfra): narrow catalog regression types

* test(deepinfra): keep catalog narrowing across callback

* fix(deepinfra): preserve default model in live catalog

* fix(deepinfra): align default model pricing

* fix(deepinfra): keep pixverse as video default

* docs(deepinfra): match video fallback default

* fix(deepinfra): honor config api keys for live catalog

* test(e2e): wait for watchdog stdio close

* test(media): align live harness provider expectation

* fix(deepinfra): always augment custom catalogs

* test(e2e): resolve watchdog commands before spawning

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-05-27 10:43:37 +01:00

51 lines
1.4 KiB
TypeScript

import {
buildSingleProviderApiKeyCatalog,
type ProviderCatalogContext,
type ProviderCatalogResult,
} from "openclaw/plugin-sdk/provider-catalog-shared";
import { type ModelProviderConfig } from "openclaw/plugin-sdk/provider-model-shared";
import {
DEEPINFRA_BASE_URL,
DEEPINFRA_MODEL_CATALOG,
buildDeepInfraModelDefinition,
discoverDeepInfraModels,
} from "./provider-models.js";
export function buildStaticDeepInfraProvider(): ModelProviderConfig {
return {
baseUrl: DEEPINFRA_BASE_URL,
api: "openai-completions",
models: DEEPINFRA_MODEL_CATALOG.map(buildDeepInfraModelDefinition),
};
}
export async function buildDeepInfraProvider(options?: {
hasApiKey?: boolean;
env?: NodeJS.ProcessEnv;
agentDir?: string;
}): Promise<ModelProviderConfig> {
const models = await discoverDeepInfraModels(options);
return {
baseUrl: DEEPINFRA_BASE_URL,
api: "openai-completions",
models,
};
}
export function buildDeepInfraApiKeyCatalog(
ctx: ProviderCatalogContext,
): Promise<ProviderCatalogResult> {
return buildSingleProviderApiKeyCatalog({
ctx,
providerId: "deepinfra",
// The shared API-key helper already resolved env/profile credentials.
// Pass that fact into discovery so profile-only setups get the live catalog.
buildProvider: () =>
buildDeepInfraProvider({
hasApiKey: true,
env: ctx.env,
agentDir: ctx.agentDir,
}),
});
}