refactor: derive deepinfra catalog from manifest

This commit is contained in:
Shakker
2026-05-01 13:21:24 +01:00
parent 4de2e7487a
commit a6e79d42cf

View File

@@ -1,10 +1,17 @@
import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
import { fetchWithTimeout } from "openclaw/plugin-sdk/provider-http";
import type { ModelDefinitionConfig } from "openclaw/plugin-sdk/provider-model-shared";
import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
import manifest from "./openclaw.plugin.json" with { type: "json" };
const log = createSubsystemLogger("deepinfra-models");
export const DEEPINFRA_BASE_URL = "https://api.deepinfra.com/v1/openai";
const DEEPINFRA_MANIFEST_PROVIDER = buildManifestModelProviderConfig({
providerId: "deepinfra",
catalog: manifest.modelCatalog.providers.deepinfra,
});
export const DEEPINFRA_BASE_URL = DEEPINFRA_MANIFEST_PROVIDER.baseUrl;
export const DEEPINFRA_MODELS_URL = `${DEEPINFRA_BASE_URL}/models?sort_by=openclaw&filter=with_meta`;
export const DEEPINFRA_DEFAULT_MODEL_ID = "deepseek-ai/DeepSeek-V3.2";
@@ -13,71 +20,7 @@ export const DEEPINFRA_DEFAULT_MODEL_REF = `deepinfra/${DEEPINFRA_DEFAULT_MODEL_
const DEEPINFRA_DEFAULT_CONTEXT_WINDOW = 128000;
const DEEPINFRA_DEFAULT_MAX_TOKENS = 8192;
export const DEEPINFRA_MODEL_CATALOG: ModelDefinitionConfig[] = [
{
id: "deepseek-ai/DeepSeek-V3.2",
name: "DeepSeek V3.2",
reasoning: false,
input: ["text"],
contextWindow: 163840,
maxTokens: 163840,
cost: { input: 0.26, output: 0.38, cacheRead: 0.13, cacheWrite: 0 },
},
{
id: "zai-org/GLM-5.1",
name: "GLM-5.1",
reasoning: true,
input: ["text"],
contextWindow: 202752,
maxTokens: 202752,
cost: { input: 1.05, output: 3.5, cacheRead: 0.205000005, cacheWrite: 0 },
},
{
id: "stepfun-ai/Step-3.5-Flash",
name: "Step 3.5 Flash",
reasoning: false,
input: ["text"],
contextWindow: 262144,
maxTokens: 262144,
cost: { input: 0.1, output: 0.3, cacheRead: 0.02, cacheWrite: 0 },
},
{
id: "MiniMaxAI/MiniMax-M2.5",
name: "MiniMax M2.5",
reasoning: true,
input: ["text"],
contextWindow: 196608,
maxTokens: 196608,
cost: { input: 0.15, output: 1.15, cacheRead: 0.03, cacheWrite: 0 },
},
{
id: "moonshotai/Kimi-K2.5",
name: "Kimi K2.5",
reasoning: true,
input: ["text", "image"],
contextWindow: 262144,
maxTokens: 262144,
cost: { input: 0.45, output: 2.25, cacheRead: 0.070000002, cacheWrite: 0 },
},
{
id: "nvidia/NVIDIA-Nemotron-3-Super-120B-A12B",
name: "NVIDIA Nemotron 3 Super 120B A12B",
reasoning: true,
input: ["text"],
contextWindow: 262144,
maxTokens: 262144,
cost: { input: 0.1, output: 0.5, cacheRead: 0, cacheWrite: 0 },
},
{
id: "meta-llama/Llama-3.3-70B-Instruct-Turbo",
name: "Llama 3.3 70B Instruct Turbo",
reasoning: false,
input: ["text"],
contextWindow: 131072,
maxTokens: 131072,
cost: { input: 0.1, output: 0.32, cacheRead: 0, cacheWrite: 0 },
},
];
export const DEEPINFRA_MODEL_CATALOG: ModelDefinitionConfig[] = DEEPINFRA_MANIFEST_PROVIDER.models;
const DISCOVERY_TIMEOUT_MS = 5000;
const DISCOVERY_CACHE_TTL_MS = 5 * 60 * 1000;