@openclaw/stepfun-provider 2026.9.5 → 2026.9.6
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/dist/index.js +72 -102
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -5,6 +5,38 @@ import { createProviderApiKeyAuthMethod } from "openclaw/plugin-sdk/provider-aut
|
|
|
5
5
|
import { buildOpenAICompatibleLiveProviderCatalog } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
|
|
6
6
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
//#region extensions/stepfun/index.ts
|
|
8
|
+
const STEPFUN_SURFACES = {
|
|
9
|
+
standard: {
|
|
10
|
+
providerId: STEPFUN_PROVIDER_ID,
|
|
11
|
+
label: "StepFun",
|
|
12
|
+
authLabel: "StepFun Standard",
|
|
13
|
+
defaultModel: STEPFUN_DEFAULT_MODEL_REF,
|
|
14
|
+
baseUrls: {
|
|
15
|
+
cn: STEPFUN_STANDARD_CN_BASE_URL,
|
|
16
|
+
intl: STEPFUN_STANDARD_INTL_BASE_URL
|
|
17
|
+
},
|
|
18
|
+
buildProvider: buildStepFunProvider,
|
|
19
|
+
applyConfig: {
|
|
20
|
+
cn: applyStepFunStandardConfigCn,
|
|
21
|
+
intl: applyStepFunStandardConfig
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
plan: {
|
|
25
|
+
providerId: STEPFUN_PLAN_PROVIDER_ID,
|
|
26
|
+
label: "StepFun Step Plan",
|
|
27
|
+
authLabel: "StepFun Step Plan",
|
|
28
|
+
defaultModel: STEPFUN_PLAN_DEFAULT_MODEL_REF,
|
|
29
|
+
baseUrls: {
|
|
30
|
+
cn: STEPFUN_PLAN_CN_BASE_URL,
|
|
31
|
+
intl: STEPFUN_PLAN_INTL_BASE_URL
|
|
32
|
+
},
|
|
33
|
+
buildProvider: buildStepFunPlanProvider,
|
|
34
|
+
applyConfig: {
|
|
35
|
+
cn: applyStepFunPlanConfigCn,
|
|
36
|
+
intl: applyStepFunPlanConfig
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
8
40
|
function trimExplicitBaseUrl(ctx, providerId) {
|
|
9
41
|
const explicitProvider = ctx.config.models?.providers?.[providerId];
|
|
10
42
|
return (typeof explicitProvider?.baseUrl === "string" ? explicitProvider.baseUrl.trim() : "") || void 0;
|
|
@@ -30,10 +62,6 @@ function inferRegionFromEnv(env) {
|
|
|
30
62
|
function inferRegionFromExplicitBaseUrls(ctx) {
|
|
31
63
|
return inferRegionFromBaseUrl(trimExplicitBaseUrl(ctx, "stepfun")) ?? inferRegionFromBaseUrl(trimExplicitBaseUrl(ctx, "stepfun-plan"));
|
|
32
64
|
}
|
|
33
|
-
function resolveDefaultBaseUrl(surface, region) {
|
|
34
|
-
if (surface === "plan") return region === "cn" ? STEPFUN_PLAN_CN_BASE_URL : STEPFUN_PLAN_INTL_BASE_URL;
|
|
35
|
-
return region === "cn" ? STEPFUN_STANDARD_CN_BASE_URL : STEPFUN_STANDARD_INTL_BASE_URL;
|
|
36
|
-
}
|
|
37
65
|
async function resolveStepFunCatalog(ctx, params) {
|
|
38
66
|
const profileAuth = ctx.resolveProviderAuth(params.providerId);
|
|
39
67
|
const auth = profileAuth.apiKey ? profileAuth : ctx.resolveProviderApiKey(params.providerId);
|
|
@@ -41,8 +69,9 @@ async function resolveStepFunCatalog(ctx, params) {
|
|
|
41
69
|
if (!apiKey) return null;
|
|
42
70
|
const explicitBaseUrl = trimExplicitBaseUrl(ctx, params.providerId);
|
|
43
71
|
const region = inferRegionFromBaseUrl(explicitBaseUrl) ?? inferRegionFromExplicitBaseUrls(ctx) ?? inferRegionFromProfileId(auth.profileId) ?? inferRegionFromEnv(ctx.env);
|
|
44
|
-
const
|
|
45
|
-
const
|
|
72
|
+
const provider = STEPFUN_SURFACES[params.surface];
|
|
73
|
+
const baseUrl = explicitBaseUrl ?? provider.baseUrls[region ?? "intl"];
|
|
74
|
+
const providerConfig = provider.buildProvider(baseUrl);
|
|
46
75
|
return await buildOpenAICompatibleLiveProviderCatalog({
|
|
47
76
|
discoveryMode: "strict",
|
|
48
77
|
providerId: params.providerId,
|
|
@@ -55,26 +84,30 @@ async function resolveStepFunCatalog(ctx, params) {
|
|
|
55
84
|
function resolveProfileIds(region) {
|
|
56
85
|
return region === "cn" ? ["stepfun:cn", "stepfun-plan:cn"] : ["stepfun:intl", "stepfun-plan:intl"];
|
|
57
86
|
}
|
|
58
|
-
function createStepFunApiKeyMethod(
|
|
87
|
+
function createStepFunApiKeyMethod(surface, region) {
|
|
88
|
+
const provider = STEPFUN_SURFACES[surface];
|
|
89
|
+
const methodId = `${surface}-api-key-${region}`;
|
|
90
|
+
const label = `${provider.authLabel} API key (${region === "cn" ? "China" : "Global/Intl"})`;
|
|
91
|
+
const hint = `Endpoint: ${provider.baseUrls[region].replace(/^https:\/\//u, "")}`;
|
|
59
92
|
return createProviderApiKeyAuthMethod({
|
|
60
|
-
providerId:
|
|
61
|
-
methodId
|
|
62
|
-
label
|
|
63
|
-
hint
|
|
93
|
+
providerId: provider.providerId,
|
|
94
|
+
methodId,
|
|
95
|
+
label,
|
|
96
|
+
hint,
|
|
64
97
|
optionKey: "stepfunApiKey",
|
|
65
98
|
flagName: "--stepfun-api-key",
|
|
66
99
|
envVar: "STEPFUN_API_KEY",
|
|
67
|
-
promptMessage:
|
|
68
|
-
profileIds: resolveProfileIds(
|
|
100
|
+
promptMessage: `Enter StepFun API key for ${region === "cn" ? "China" : "global"} endpoints`,
|
|
101
|
+
profileIds: resolveProfileIds(region),
|
|
69
102
|
allowProfile: false,
|
|
70
|
-
defaultModel:
|
|
103
|
+
defaultModel: provider.defaultModel,
|
|
71
104
|
preserveExistingPrimary: true,
|
|
72
105
|
expectedProviders: [STEPFUN_PROVIDER_ID, STEPFUN_PLAN_PROVIDER_ID],
|
|
73
|
-
applyConfig:
|
|
106
|
+
applyConfig: provider.applyConfig[region],
|
|
74
107
|
wizard: {
|
|
75
|
-
choiceId:
|
|
76
|
-
choiceLabel:
|
|
77
|
-
choiceHint:
|
|
108
|
+
choiceId: `stepfun-${methodId}`,
|
|
109
|
+
choiceLabel: label,
|
|
110
|
+
choiceHint: hint,
|
|
78
111
|
groupId: "stepfun",
|
|
79
112
|
groupLabel: "StepFun",
|
|
80
113
|
groupHint: "Standard / Step Plan (China / Global)"
|
|
@@ -86,90 +119,27 @@ var stepfun_default = definePluginEntry({
|
|
|
86
119
|
name: "StepFun",
|
|
87
120
|
description: "Bundled StepFun standard and Step Plan provider plugin",
|
|
88
121
|
register(api) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
hint: "Endpoint: api.stepfun.ai/v1",
|
|
111
|
-
region: "intl",
|
|
112
|
-
promptMessage: "Enter StepFun API key for global endpoints",
|
|
113
|
-
defaultModel: STEPFUN_DEFAULT_MODEL_REF,
|
|
114
|
-
choiceId: "stepfun-standard-api-key-intl",
|
|
115
|
-
choiceLabel: "StepFun Standard API key (Global/Intl)",
|
|
116
|
-
choiceHint: "Endpoint: api.stepfun.ai/v1",
|
|
117
|
-
applyConfig: applyStepFunStandardConfig
|
|
118
|
-
})],
|
|
119
|
-
catalog: {
|
|
120
|
-
order: "paired",
|
|
121
|
-
run: async (ctx) => resolveStepFunCatalog(ctx, {
|
|
122
|
-
providerId: STEPFUN_PROVIDER_ID,
|
|
123
|
-
surface: "standard"
|
|
124
|
-
})
|
|
125
|
-
},
|
|
126
|
-
staticCatalog: {
|
|
127
|
-
order: "paired",
|
|
128
|
-
run: async () => ({ provider: buildStepFunProvider() })
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
api.registerProvider({
|
|
132
|
-
id: STEPFUN_PLAN_PROVIDER_ID,
|
|
133
|
-
label: "StepFun Step Plan",
|
|
134
|
-
docsPath: "/providers/stepfun",
|
|
135
|
-
envVars: ["STEPFUN_API_KEY"],
|
|
136
|
-
auth: [createStepFunApiKeyMethod({
|
|
137
|
-
providerId: STEPFUN_PLAN_PROVIDER_ID,
|
|
138
|
-
methodId: "plan-api-key-cn",
|
|
139
|
-
label: "StepFun Step Plan API key (China)",
|
|
140
|
-
hint: "Endpoint: api.stepfun.com/step_plan/v1",
|
|
141
|
-
region: "cn",
|
|
142
|
-
promptMessage: "Enter StepFun API key for China endpoints",
|
|
143
|
-
defaultModel: STEPFUN_PLAN_DEFAULT_MODEL_REF,
|
|
144
|
-
choiceId: "stepfun-plan-api-key-cn",
|
|
145
|
-
choiceLabel: "StepFun Step Plan API key (China)",
|
|
146
|
-
choiceHint: "Endpoint: api.stepfun.com/step_plan/v1",
|
|
147
|
-
applyConfig: applyStepFunPlanConfigCn
|
|
148
|
-
}), createStepFunApiKeyMethod({
|
|
149
|
-
providerId: STEPFUN_PLAN_PROVIDER_ID,
|
|
150
|
-
methodId: "plan-api-key-intl",
|
|
151
|
-
label: "StepFun Step Plan API key (Global/Intl)",
|
|
152
|
-
hint: "Endpoint: api.stepfun.ai/step_plan/v1",
|
|
153
|
-
region: "intl",
|
|
154
|
-
promptMessage: "Enter StepFun API key for global endpoints",
|
|
155
|
-
defaultModel: STEPFUN_PLAN_DEFAULT_MODEL_REF,
|
|
156
|
-
choiceId: "stepfun-plan-api-key-intl",
|
|
157
|
-
choiceLabel: "StepFun Step Plan API key (Global/Intl)",
|
|
158
|
-
choiceHint: "Endpoint: api.stepfun.ai/step_plan/v1",
|
|
159
|
-
applyConfig: applyStepFunPlanConfig
|
|
160
|
-
})],
|
|
161
|
-
catalog: {
|
|
162
|
-
order: "paired",
|
|
163
|
-
run: async (ctx) => resolveStepFunCatalog(ctx, {
|
|
164
|
-
providerId: STEPFUN_PLAN_PROVIDER_ID,
|
|
165
|
-
surface: "plan"
|
|
166
|
-
})
|
|
167
|
-
},
|
|
168
|
-
staticCatalog: {
|
|
169
|
-
order: "paired",
|
|
170
|
-
run: async () => ({ provider: buildStepFunPlanProvider() })
|
|
171
|
-
}
|
|
172
|
-
});
|
|
122
|
+
for (const surface of ["standard", "plan"]) {
|
|
123
|
+
const provider = STEPFUN_SURFACES[surface];
|
|
124
|
+
api.registerProvider({
|
|
125
|
+
id: provider.providerId,
|
|
126
|
+
label: provider.label,
|
|
127
|
+
docsPath: "/providers/stepfun",
|
|
128
|
+
envVars: ["STEPFUN_API_KEY"],
|
|
129
|
+
auth: ["cn", "intl"].map((region) => createStepFunApiKeyMethod(surface, region)),
|
|
130
|
+
catalog: {
|
|
131
|
+
order: "paired",
|
|
132
|
+
run: async (ctx) => resolveStepFunCatalog(ctx, {
|
|
133
|
+
providerId: provider.providerId,
|
|
134
|
+
surface
|
|
135
|
+
})
|
|
136
|
+
},
|
|
137
|
+
staticCatalog: {
|
|
138
|
+
order: "paired",
|
|
139
|
+
run: async () => ({ provider: provider.buildProvider() })
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
173
143
|
}
|
|
174
144
|
});
|
|
175
145
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/stepfun-provider",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.6",
|
|
4
4
|
"description": "OpenClaw StepFun provider plugin.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"minHostVersion": ">=2026.6.9"
|
|
19
19
|
},
|
|
20
20
|
"compat": {
|
|
21
|
-
"pluginApi": ">=2026.9.
|
|
21
|
+
"pluginApi": ">=2026.9.6"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.9.
|
|
24
|
+
"openclawVersion": "2026.9.6",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"assets/activity.svg"
|
|
41
41
|
],
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"openclaw": ">=2026.9.
|
|
43
|
+
"openclaw": ">=2026.9.6"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"openclaw": {
|