mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:10:44 +00:00
feat: declare stepfun model catalogs
This commit is contained in:
@@ -6,6 +6,68 @@
|
||||
"enabledByDefault": true,
|
||||
"providers": ["stepfun", "stepfun-plan"],
|
||||
"autoEnableWhenConfiguredProviders": ["stepfun", "stepfun-plan"],
|
||||
"modelCatalog": {
|
||||
"providers": {
|
||||
"stepfun": {
|
||||
"baseUrl": "https://api.stepfun.ai/v1",
|
||||
"api": "openai-completions",
|
||||
"models": [
|
||||
{
|
||||
"id": "step-3.5-flash",
|
||||
"name": "Step 3.5 Flash",
|
||||
"reasoning": true,
|
||||
"input": ["text"],
|
||||
"contextWindow": 262144,
|
||||
"maxTokens": 65536,
|
||||
"cost": {
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"cacheRead": 0,
|
||||
"cacheWrite": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"stepfun-plan": {
|
||||
"baseUrl": "https://api.stepfun.ai/step_plan/v1",
|
||||
"api": "openai-completions",
|
||||
"models": [
|
||||
{
|
||||
"id": "step-3.5-flash",
|
||||
"name": "Step 3.5 Flash",
|
||||
"reasoning": true,
|
||||
"input": ["text"],
|
||||
"contextWindow": 262144,
|
||||
"maxTokens": 65536,
|
||||
"cost": {
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"cacheRead": 0,
|
||||
"cacheWrite": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "step-3.5-flash-2603",
|
||||
"name": "Step 3.5 Flash 2603",
|
||||
"reasoning": true,
|
||||
"input": ["text"],
|
||||
"contextWindow": 262144,
|
||||
"maxTokens": 65536,
|
||||
"cost": {
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"cacheRead": 0,
|
||||
"cacheWrite": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"discovery": {
|
||||
"stepfun": "static",
|
||||
"stepfun-plan": "static"
|
||||
}
|
||||
},
|
||||
"providerAuthEnvVars": {
|
||||
"stepfun": ["STEPFUN_API_KEY"],
|
||||
"stepfun-plan": ["STEPFUN_API_KEY"]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type {
|
||||
ModelDefinitionConfig,
|
||||
ModelProviderConfig,
|
||||
} from "openclaw/plugin-sdk/provider-model-shared";
|
||||
import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
|
||||
import type { ModelProviderConfig } from "openclaw/plugin-sdk/provider-model-shared";
|
||||
import manifest from "./openclaw.plugin.json" with { type: "json" };
|
||||
|
||||
export const STEPFUN_PROVIDER_ID = "stepfun";
|
||||
export const STEPFUN_PLAN_PROVIDER_ID = "stepfun-plan";
|
||||
@@ -16,54 +15,22 @@ export const STEPFUN_FLASH_2603_MODEL_ID = "step-3.5-flash-2603";
|
||||
export const STEPFUN_DEFAULT_MODEL_REF = `${STEPFUN_PROVIDER_ID}/${STEPFUN_DEFAULT_MODEL_ID}`;
|
||||
export const STEPFUN_PLAN_DEFAULT_MODEL_REF = `${STEPFUN_PLAN_PROVIDER_ID}/${STEPFUN_DEFAULT_MODEL_ID}`;
|
||||
|
||||
const STEPFUN_DEFAULT_COST = {
|
||||
input: 0,
|
||||
output: 0,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
} as const;
|
||||
|
||||
function buildStepFunModel(id: string, name: string): ModelDefinitionConfig {
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
reasoning: true,
|
||||
input: ["text"],
|
||||
cost: STEPFUN_DEFAULT_COST,
|
||||
contextWindow: 262_144,
|
||||
maxTokens: 65_536,
|
||||
};
|
||||
}
|
||||
|
||||
const STEPFUN_STANDARD_MODEL_CATALOG: ReadonlyArray<ModelDefinitionConfig> = [
|
||||
buildStepFunModel(STEPFUN_DEFAULT_MODEL_ID, "Step 3.5 Flash"),
|
||||
];
|
||||
|
||||
const STEPFUN_PLAN_MODEL_CATALOG: ReadonlyArray<ModelDefinitionConfig> = [
|
||||
buildStepFunModel(STEPFUN_DEFAULT_MODEL_ID, "Step 3.5 Flash"),
|
||||
buildStepFunModel(STEPFUN_FLASH_2603_MODEL_ID, "Step 3.5 Flash 2603"),
|
||||
];
|
||||
|
||||
function cloneCatalog(models: ReadonlyArray<ModelDefinitionConfig>): ModelDefinitionConfig[] {
|
||||
return models.map((model) => ({ ...model }));
|
||||
function buildStepFunManifestProvider(providerId: string, baseUrl: string): ModelProviderConfig {
|
||||
const provider = buildManifestModelProviderConfig({
|
||||
providerId,
|
||||
catalog: manifest.modelCatalog.providers[providerId],
|
||||
});
|
||||
return provider.baseUrl === baseUrl ? provider : { ...provider, baseUrl };
|
||||
}
|
||||
|
||||
export function buildStepFunProvider(
|
||||
baseUrl: string = STEPFUN_STANDARD_INTL_BASE_URL,
|
||||
): ModelProviderConfig {
|
||||
return {
|
||||
baseUrl,
|
||||
api: "openai-completions",
|
||||
models: cloneCatalog(STEPFUN_STANDARD_MODEL_CATALOG),
|
||||
};
|
||||
return buildStepFunManifestProvider(STEPFUN_PROVIDER_ID, baseUrl);
|
||||
}
|
||||
|
||||
export function buildStepFunPlanProvider(
|
||||
baseUrl: string = STEPFUN_PLAN_INTL_BASE_URL,
|
||||
): ModelProviderConfig {
|
||||
return {
|
||||
baseUrl,
|
||||
api: "openai-completions",
|
||||
models: cloneCatalog(STEPFUN_PLAN_MODEL_CATALOG),
|
||||
};
|
||||
return buildStepFunManifestProvider(STEPFUN_PLAN_PROVIDER_ID, baseUrl);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user