@openclaw/qwen-provider 2026.7.2-beta.7 → 2026.7.34
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/api.js +3 -3
- package/dist/index.js +50 -105
- package/dist/media-understanding-provider.js +7 -7
- package/dist/models.js +64 -115
- package/dist/onboard.js +14 -14
- package/dist/provider-catalog.js +5 -5
- package/dist/stream.js +38 -149
- package/dist/video-generation-provider.js +6 -6
- package/openclaw.plugin.json +140 -97
- package/package.json +4 -4
package/dist/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MODELSTUDIO_BASE_URL, MODELSTUDIO_CN_BASE_URL, MODELSTUDIO_DEFAULT_COST, MODELSTUDIO_DEFAULT_MODEL_ID, MODELSTUDIO_DEFAULT_MODEL_REF, MODELSTUDIO_GLOBAL_BASE_URL, MODELSTUDIO_MODEL_CATALOG, MODELSTUDIO_STANDARD_CN_BASE_URL, MODELSTUDIO_STANDARD_GLOBAL_BASE_URL,
|
|
2
|
-
import { buildModelStudioProvider, buildQwenProvider
|
|
1
|
+
import { MODELSTUDIO_BASE_URL, MODELSTUDIO_CN_BASE_URL, MODELSTUDIO_DEFAULT_COST, MODELSTUDIO_DEFAULT_MODEL_ID, MODELSTUDIO_DEFAULT_MODEL_REF, MODELSTUDIO_GLOBAL_BASE_URL, MODELSTUDIO_MODEL_CATALOG, MODELSTUDIO_STANDARD_CN_BASE_URL, MODELSTUDIO_STANDARD_GLOBAL_BASE_URL, QWEN_36_PLUS_MODEL_ID, QWEN_BASE_URL, QWEN_CN_BASE_URL, QWEN_DEFAULT_COST, QWEN_DEFAULT_MODEL_ID, QWEN_DEFAULT_MODEL_REF, QWEN_GLOBAL_BASE_URL, QWEN_MODEL_CATALOG, QWEN_STANDARD_CN_BASE_URL, QWEN_STANDARD_GLOBAL_BASE_URL, applyModelStudioNativeStreamingUsageCompat, applyQwenNativeStreamingUsageCompat, buildModelStudioDefaultModelDefinition, buildModelStudioModelDefinition, buildQwenDefaultModelDefinition, buildQwenModelCatalogForBaseUrl, buildQwenModelDefinition, isNativeModelStudioBaseUrl, isNativeQwenBaseUrl, isQwen36PlusSupportedBaseUrl, isQwenCodingPlanBaseUrl } from "./models.js";
|
|
2
|
+
import { buildModelStudioProvider, buildQwenProvider } from "./provider-catalog.js";
|
|
3
3
|
import { createQwenThinkingWrapper, wrapQwenProviderStream } from "./stream.js";
|
|
4
|
-
export { MODELSTUDIO_BASE_URL, MODELSTUDIO_CN_BASE_URL, MODELSTUDIO_DEFAULT_COST, MODELSTUDIO_DEFAULT_MODEL_ID, MODELSTUDIO_DEFAULT_MODEL_REF, MODELSTUDIO_GLOBAL_BASE_URL, MODELSTUDIO_MODEL_CATALOG, MODELSTUDIO_STANDARD_CN_BASE_URL, MODELSTUDIO_STANDARD_GLOBAL_BASE_URL,
|
|
4
|
+
export { MODELSTUDIO_BASE_URL, MODELSTUDIO_CN_BASE_URL, MODELSTUDIO_DEFAULT_COST, MODELSTUDIO_DEFAULT_MODEL_ID, MODELSTUDIO_DEFAULT_MODEL_REF, MODELSTUDIO_GLOBAL_BASE_URL, MODELSTUDIO_MODEL_CATALOG, MODELSTUDIO_STANDARD_CN_BASE_URL, MODELSTUDIO_STANDARD_GLOBAL_BASE_URL, QWEN_36_PLUS_MODEL_ID, QWEN_BASE_URL, QWEN_CN_BASE_URL, QWEN_DEFAULT_COST, QWEN_DEFAULT_MODEL_ID, QWEN_DEFAULT_MODEL_REF, QWEN_GLOBAL_BASE_URL, QWEN_MODEL_CATALOG, QWEN_STANDARD_CN_BASE_URL, QWEN_STANDARD_GLOBAL_BASE_URL, applyModelStudioNativeStreamingUsageCompat, applyQwenNativeStreamingUsageCompat, buildModelStudioDefaultModelDefinition, buildModelStudioModelDefinition, buildModelStudioProvider, buildQwenDefaultModelDefinition, buildQwenModelCatalogForBaseUrl, buildQwenModelDefinition, buildQwenProvider, createQwenThinkingWrapper, isNativeModelStudioBaseUrl, isNativeQwenBaseUrl, isQwen36PlusSupportedBaseUrl, isQwenCodingPlanBaseUrl, wrapQwenProviderStream };
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
import { QWEN_DEFAULT_MODEL_REF,
|
|
2
|
-
import {
|
|
1
|
+
import { QWEN_DEFAULT_MODEL_REF, QWEN_OAUTH_DEFAULT_MODEL_REF, QWEN_OAUTH_PROVIDER_ID, applyQwenNativeStreamingUsageCompat, isQwenCodingPlanBaseUrl } from "./models.js";
|
|
2
|
+
import { buildQwenOAuthProvider, buildQwenProvider } from "./provider-catalog.js";
|
|
3
3
|
import { wrapQwenProviderStream } from "./stream.js";
|
|
4
4
|
import "./api.js";
|
|
5
5
|
import { buildQwenMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
6
|
-
import { applyQwenConfig, applyQwenConfigCn, applyQwenStandardConfig, applyQwenStandardConfigCn
|
|
6
|
+
import { applyQwenConfig, applyQwenConfigCn, applyQwenOAuthConfig, applyQwenStandardConfig, applyQwenStandardConfigCn } from "./onboard.js";
|
|
7
7
|
import { buildQwenVideoGenerationProvider } from "./video-generation-provider.js";
|
|
8
8
|
import { createProviderApiKeyAuthMethod } from "openclaw/plugin-sdk/provider-auth-api-key";
|
|
9
|
-
import { buildOpenAICompatibleLiveModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
|
|
10
9
|
import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
|
|
11
10
|
//#region extensions/qwen/index.ts
|
|
12
11
|
const PROVIDER_ID = "qwen";
|
|
13
12
|
const LEGACY_PROVIDER_ID = "modelstudio";
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"medium",
|
|
19
|
-
"high",
|
|
20
|
-
"xhigh",
|
|
21
|
-
"max"
|
|
13
|
+
const QWEN_OAUTH_AUTH_PROVIDER_IDS = [
|
|
14
|
+
QWEN_OAUTH_PROVIDER_ID,
|
|
15
|
+
"qwen-portal",
|
|
16
|
+
"qwen-cli"
|
|
22
17
|
];
|
|
23
|
-
const QWEN_TOKEN_PLAN_GLM_NO_MAX_THINKING_LEVEL_IDS = QWEN_TOKEN_PLAN_THINKING_LEVEL_IDS.filter((id) => id !== "max");
|
|
24
18
|
function normalizeProviderId(value) {
|
|
25
19
|
return value.trim().toLowerCase();
|
|
26
20
|
}
|
|
@@ -34,58 +28,6 @@ function resolveConfiguredQwenBaseUrl(config) {
|
|
|
34
28
|
if (baseUrl) return baseUrl;
|
|
35
29
|
}
|
|
36
30
|
}
|
|
37
|
-
function resolveConfiguredQwenTokenPlanBaseUrl(config) {
|
|
38
|
-
const providers = config?.models?.providers;
|
|
39
|
-
if (!providers) return;
|
|
40
|
-
for (const [providerId, provider] of Object.entries(providers)) {
|
|
41
|
-
if (normalizeProviderId(providerId) !== "qwen-token-plan") continue;
|
|
42
|
-
const baseUrl = provider?.baseUrl?.trim();
|
|
43
|
-
if (baseUrl) return baseUrl;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function createQwenTokenPlanAuthMethod(region) {
|
|
47
|
-
const isCn = region === "cn";
|
|
48
|
-
const regionLabel = isCn ? "China" : "Global/Intl";
|
|
49
|
-
const host = isCn ? "token-plan.cn-beijing.maas.aliyuncs.com" : "token-plan.ap-southeast-1.maas.aliyuncs.com";
|
|
50
|
-
return createProviderApiKeyAuthMethod({
|
|
51
|
-
providerId: QWEN_TOKEN_PLAN_PROVIDER_ID,
|
|
52
|
-
methodId: isCn ? "api-key-cn" : "api-key",
|
|
53
|
-
label: `Qwen Token Plan API Key for ${regionLabel} (subscription)`,
|
|
54
|
-
hint: `Endpoint: ${host}`,
|
|
55
|
-
optionKey: isCn ? "qwenTokenPlanApiKeyCn" : "qwenTokenPlanApiKey",
|
|
56
|
-
flagName: isCn ? "--qwen-token-plan-api-key-cn" : "--qwen-token-plan-api-key",
|
|
57
|
-
envVar: "QWEN_TOKEN_PLAN_API_KEY",
|
|
58
|
-
promptMessage: `Enter Alibaba Qwen Token Plan API key (${regionLabel}, sk-sp-...)`,
|
|
59
|
-
defaultModel: QWEN_TOKEN_PLAN_DEFAULT_MODEL_REF,
|
|
60
|
-
applyConfig: (cfg) => applyQwenTokenPlanConfig(cfg, region),
|
|
61
|
-
wizard: {
|
|
62
|
-
choiceId: isCn ? "qwen-token-plan-cn" : "qwen-token-plan",
|
|
63
|
-
choiceLabel: `Qwen Token Plan (${regionLabel})`,
|
|
64
|
-
choiceHint: `Endpoint: ${host}`,
|
|
65
|
-
groupId: "qwen",
|
|
66
|
-
groupLabel: "Qwen Cloud",
|
|
67
|
-
groupHint: "Standard / Coding Plan / Token Plan"
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
function resolveQwenTokenPlanThinkingProfile(modelId) {
|
|
72
|
-
if (isQwenTokenPlanThinkingOnlyModelId(modelId)) return {
|
|
73
|
-
levels: [{
|
|
74
|
-
id: "low",
|
|
75
|
-
label: "on"
|
|
76
|
-
}],
|
|
77
|
-
defaultLevel: "low",
|
|
78
|
-
preserveWhenCatalogReasoningFalse: true
|
|
79
|
-
};
|
|
80
|
-
if (isQwenTokenPlanDeepSeekV4ModelId(modelId)) return {
|
|
81
|
-
levels: QWEN_TOKEN_PLAN_THINKING_LEVEL_IDS.map((id) => ({ id })),
|
|
82
|
-
defaultLevel: "high"
|
|
83
|
-
};
|
|
84
|
-
if (isQwenTokenPlanGlmModelId(modelId)) return {
|
|
85
|
-
levels: (supportsQwenTokenPlanGlmMaxThinking(modelId) ? QWEN_TOKEN_PLAN_THINKING_LEVEL_IDS : QWEN_TOKEN_PLAN_GLM_NO_MAX_THINKING_LEVEL_IDS).map((id) => ({ id })),
|
|
86
|
-
defaultLevel: "high"
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
31
|
var qwen_default = defineSingleProviderPluginEntry({
|
|
90
32
|
id: PROVIDER_ID,
|
|
91
33
|
name: "Qwen Provider",
|
|
@@ -109,7 +51,7 @@ var qwen_default = defineSingleProviderPluginEntry({
|
|
|
109
51
|
"Manage API keys: https://home.qwencloud.com/api-keys",
|
|
110
52
|
"Docs: https://docs.qwencloud.com/",
|
|
111
53
|
"Endpoint: dashscope.aliyuncs.com/compatible-mode/v1",
|
|
112
|
-
"Models: qwen3.
|
|
54
|
+
"Models: qwen3.6-plus, qwen3.5-plus, qwen3-coder-plus, etc."
|
|
113
55
|
].join("\n"),
|
|
114
56
|
noteTitle: "Qwen Cloud Standard (China)",
|
|
115
57
|
wizard: {
|
|
@@ -132,7 +74,7 @@ var qwen_default = defineSingleProviderPluginEntry({
|
|
|
132
74
|
"Manage API keys: https://home.qwencloud.com/api-keys",
|
|
133
75
|
"Docs: https://docs.qwencloud.com/",
|
|
134
76
|
"Endpoint: dashscope-intl.aliyuncs.com/compatible-mode/v1",
|
|
135
|
-
"Models: qwen3.
|
|
77
|
+
"Models: qwen3.6-plus, qwen3.5-plus, qwen3-coder-plus, etc."
|
|
136
78
|
].join("\n"),
|
|
137
79
|
noteTitle: "Qwen Cloud Standard (Global/Intl)",
|
|
138
80
|
wizard: {
|
|
@@ -188,25 +130,20 @@ var qwen_default = defineSingleProviderPluginEntry({
|
|
|
188
130
|
}
|
|
189
131
|
}
|
|
190
132
|
],
|
|
191
|
-
catalog: {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
discoveryApiKey: auth.discoveryApiKey
|
|
201
|
-
}) };
|
|
202
|
-
},
|
|
203
|
-
staticRun: async () => ({ provider: buildQwenProvider() })
|
|
204
|
-
},
|
|
133
|
+
catalog: { run: async (ctx) => {
|
|
134
|
+
const apiKey = ctx.resolveProviderApiKey(PROVIDER_ID).apiKey;
|
|
135
|
+
if (!apiKey) return null;
|
|
136
|
+
const baseUrl = resolveConfiguredQwenBaseUrl(ctx.config) ?? "https://coding-intl.dashscope.aliyuncs.com/v1";
|
|
137
|
+
return { provider: {
|
|
138
|
+
...buildQwenProvider({ baseUrl }),
|
|
139
|
+
apiKey
|
|
140
|
+
} };
|
|
141
|
+
} },
|
|
205
142
|
applyNativeStreamingUsageCompat: ({ providerConfig }) => applyQwenNativeStreamingUsageCompat(providerConfig),
|
|
206
143
|
wrapStreamFn: wrapQwenProviderStream,
|
|
207
144
|
normalizeConfig: ({ providerConfig }) => {
|
|
208
145
|
if (!isQwenCodingPlanBaseUrl(providerConfig.baseUrl)) return;
|
|
209
|
-
const models = providerConfig.models?.filter((model) =>
|
|
146
|
+
const models = providerConfig.models?.filter((model) => model.id !== "qwen3.6-plus" && model.id !== "qwen3.8-max" && model.id !== "qwen3.8-flash");
|
|
210
147
|
return models && models.length !== providerConfig.models?.length ? {
|
|
211
148
|
...providerConfig,
|
|
212
149
|
models
|
|
@@ -215,38 +152,46 @@ var qwen_default = defineSingleProviderPluginEntry({
|
|
|
215
152
|
},
|
|
216
153
|
register(api) {
|
|
217
154
|
api.registerProvider({
|
|
218
|
-
id:
|
|
219
|
-
label: "Qwen
|
|
155
|
+
id: QWEN_OAUTH_PROVIDER_ID,
|
|
156
|
+
label: "Qwen OAuth",
|
|
220
157
|
docsPath: "/providers/qwen",
|
|
221
|
-
|
|
222
|
-
|
|
158
|
+
aliases: ["qwen-portal", "qwen-cli"],
|
|
159
|
+
envVars: ["QWEN_API_KEY"],
|
|
160
|
+
auth: [createProviderApiKeyAuthMethod({
|
|
161
|
+
providerId: QWEN_OAUTH_PROVIDER_ID,
|
|
162
|
+
methodId: "api-key",
|
|
163
|
+
label: "Qwen OAuth token",
|
|
164
|
+
hint: "Portal token for portal.qwen.ai",
|
|
165
|
+
optionKey: "qwenOauthToken",
|
|
166
|
+
flagName: "--qwen-oauth-token",
|
|
167
|
+
envVar: "QWEN_API_KEY",
|
|
168
|
+
promptMessage: "Enter Qwen OAuth token",
|
|
169
|
+
defaultModel: QWEN_OAUTH_DEFAULT_MODEL_REF,
|
|
170
|
+
applyConfig: (cfg) => applyQwenOAuthConfig(cfg),
|
|
171
|
+
wizard: {
|
|
172
|
+
choiceId: QWEN_OAUTH_PROVIDER_ID,
|
|
173
|
+
choiceLabel: "Qwen OAuth",
|
|
174
|
+
choiceHint: "Portal token for portal.qwen.ai",
|
|
175
|
+
groupId: "qwen",
|
|
176
|
+
groupLabel: "Qwen Cloud",
|
|
177
|
+
groupHint: "Standard / Coding Plan / OAuth"
|
|
178
|
+
}
|
|
179
|
+
})],
|
|
223
180
|
catalog: {
|
|
224
181
|
order: "simple",
|
|
225
182
|
run: async (ctx) => {
|
|
226
|
-
const
|
|
227
|
-
if (!
|
|
228
|
-
return { provider:
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
discoveryApiKey: auth.discoveryApiKey
|
|
233
|
-
}) };
|
|
183
|
+
const apiKey = QWEN_OAUTH_AUTH_PROVIDER_IDS.map((providerId) => ctx.resolveProviderApiKey(providerId).apiKey).find((candidate) => typeof candidate === "string" && candidate.length > 0);
|
|
184
|
+
if (!apiKey) return null;
|
|
185
|
+
return { provider: {
|
|
186
|
+
...buildQwenOAuthProvider(),
|
|
187
|
+
apiKey
|
|
188
|
+
} };
|
|
234
189
|
}
|
|
235
190
|
},
|
|
236
191
|
staticCatalog: {
|
|
237
192
|
order: "simple",
|
|
238
|
-
run: async () => ({ provider:
|
|
193
|
+
run: async () => ({ provider: buildQwenOAuthProvider() })
|
|
239
194
|
},
|
|
240
|
-
applyNativeStreamingUsageCompat: ({ providerConfig }) => applyQwenNativeStreamingUsageCompat(providerConfig),
|
|
241
|
-
wrapStreamFn: wrapQwenProviderStream,
|
|
242
|
-
resolveThinkingProfile: ({ modelId }) => resolveQwenTokenPlanThinkingProfile(modelId)
|
|
243
|
-
});
|
|
244
|
-
api.registerProvider({
|
|
245
|
-
id: QWEN_TOKEN_PLAN_LEGACY_PROVIDER_ID,
|
|
246
|
-
label: "Alibaba Token Plan (legacy custom config)",
|
|
247
|
-
docsPath: "/providers/qwen",
|
|
248
|
-
auth: [],
|
|
249
|
-
applyNativeStreamingUsageCompat: ({ providerConfig }) => applyQwenNativeStreamingUsageCompat(providerConfig),
|
|
250
195
|
wrapStreamFn: wrapQwenProviderStream
|
|
251
196
|
});
|
|
252
197
|
api.registerMediaUnderstandingProvider(buildQwenMediaUnderstandingProvider());
|
|
@@ -2,11 +2,11 @@ import { QWEN_STANDARD_GLOBAL_BASE_URL } from "./models.js";
|
|
|
2
2
|
import { buildOpenAiCompatibleVideoRequestBody, coerceOpenAiCompatibleVideoText, describeImageWithModel, describeImagesWithModel, resolveMediaUnderstandingString } from "openclaw/plugin-sdk/media-understanding";
|
|
3
3
|
import { assertOkOrThrowHttpError, postJsonRequest, readProviderJsonResponse, resolveProviderHttpRequestConfig } from "openclaw/plugin-sdk/provider-http";
|
|
4
4
|
//#region extensions/qwen/media-understanding-provider.ts
|
|
5
|
-
const
|
|
5
|
+
const DEFAULT_QWEN_VIDEO_MODEL = "qwen-vl-max-latest";
|
|
6
6
|
const DEFAULT_QWEN_VIDEO_PROMPT = "Describe the video in detail.";
|
|
7
7
|
async function describeQwenVideo(params) {
|
|
8
8
|
const fetchFn = params.fetchFn ?? fetch;
|
|
9
|
-
const model = resolveMediaUnderstandingString(params.model,
|
|
9
|
+
const model = resolveMediaUnderstandingString(params.model, DEFAULT_QWEN_VIDEO_MODEL);
|
|
10
10
|
const mime = resolveMediaUnderstandingString(params.mime, "video/mp4");
|
|
11
11
|
const prompt = resolveMediaUnderstandingString(params.prompt, DEFAULT_QWEN_VIDEO_PROMPT);
|
|
12
12
|
const { baseUrl, allowPrivateNetwork, headers, dispatcherPolicy } = resolveProviderHttpRequestConfig({
|
|
@@ -33,14 +33,14 @@ async function describeQwenVideo(params) {
|
|
|
33
33
|
buffer: params.buffer
|
|
34
34
|
}),
|
|
35
35
|
timeoutMs: params.timeoutMs,
|
|
36
|
-
...params.signal ? { signal: params.signal } : {},
|
|
37
36
|
fetchFn,
|
|
38
37
|
allowPrivateNetwork,
|
|
39
38
|
dispatcherPolicy
|
|
40
39
|
});
|
|
41
40
|
try {
|
|
42
41
|
await assertOkOrThrowHttpError(res, "Qwen video description failed");
|
|
43
|
-
const
|
|
42
|
+
const payload = await readProviderJsonResponse(res, "Qwen video description failed");
|
|
43
|
+
const text = coerceOpenAiCompatibleVideoText(payload);
|
|
44
44
|
if (!text) throw new Error("Qwen video description response missing content");
|
|
45
45
|
return {
|
|
46
46
|
text,
|
|
@@ -55,8 +55,8 @@ function buildQwenMediaUnderstandingProvider() {
|
|
|
55
55
|
id: "qwen",
|
|
56
56
|
capabilities: ["image", "video"],
|
|
57
57
|
defaultModels: {
|
|
58
|
-
image:
|
|
59
|
-
video:
|
|
58
|
+
image: "qwen-vl-max-latest",
|
|
59
|
+
video: DEFAULT_QWEN_VIDEO_MODEL
|
|
60
60
|
},
|
|
61
61
|
autoPriority: { video: 15 },
|
|
62
62
|
describeImage: describeImageWithModel,
|
|
@@ -65,4 +65,4 @@ function buildQwenMediaUnderstandingProvider() {
|
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
//#endregion
|
|
68
|
-
export { buildQwenMediaUnderstandingProvider };
|
|
68
|
+
export { buildQwenMediaUnderstandingProvider, describeQwenVideo };
|
package/dist/models.js
CHANGED
|
@@ -5,15 +5,15 @@ const QWEN_GLOBAL_BASE_URL = QWEN_BASE_URL;
|
|
|
5
5
|
const QWEN_CN_BASE_URL = "https://coding.dashscope.aliyuncs.com/v1";
|
|
6
6
|
const QWEN_STANDARD_CN_BASE_URL = "https://dashscope.aliyuncs.com/compatible-mode/v1";
|
|
7
7
|
const QWEN_STANDARD_GLOBAL_BASE_URL = "https://dashscope-intl.aliyuncs.com/compatible-mode/v1";
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const QWEN_TOKEN_PLAN_GLOBAL_BASE_URL = "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1";
|
|
11
|
-
const QWEN_TOKEN_PLAN_CN_BASE_URL = "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1";
|
|
8
|
+
const QWEN_OAUTH_PROVIDER_ID = "qwen-oauth";
|
|
9
|
+
const QWEN_OAUTH_BASE_URL = "https://portal.qwen.ai/v1";
|
|
12
10
|
const QWEN_DEFAULT_MODEL_ID = "qwen3.5-plus";
|
|
13
|
-
const QWEN_36_FLASH_MODEL_ID = "qwen3.6-flash";
|
|
14
11
|
const QWEN_36_PLUS_MODEL_ID = "qwen3.6-plus";
|
|
15
|
-
const
|
|
16
|
-
|
|
12
|
+
const QWEN_STANDARD_ONLY_MODEL_IDS = /* @__PURE__ */ new Set([
|
|
13
|
+
"qwen3.6-plus",
|
|
14
|
+
"qwen3.8-max",
|
|
15
|
+
"qwen3.8-flash"
|
|
16
|
+
]);
|
|
17
17
|
const QWEN_DEFAULT_COST = {
|
|
18
18
|
input: 0,
|
|
19
19
|
output: 0,
|
|
@@ -21,87 +21,7 @@ const QWEN_DEFAULT_COST = {
|
|
|
21
21
|
cacheWrite: 0
|
|
22
22
|
};
|
|
23
23
|
const QWEN_DEFAULT_MODEL_REF = `qwen/${QWEN_DEFAULT_MODEL_ID}`;
|
|
24
|
-
const
|
|
25
|
-
const QWEN_TOKEN_PLAN_DEFAULT_MODEL_REF = `${QWEN_TOKEN_PLAN_PROVIDER_ID}/${QWEN_TOKEN_PLAN_DEFAULT_MODEL_ID}`;
|
|
26
|
-
function isQwenTokenPlanThinkingOnlyModelId(modelId) {
|
|
27
|
-
const normalized = modelId.trim().toLowerCase();
|
|
28
|
-
return normalized === "minimax-m2.5" || normalized.startsWith("kimi-k2.7-code");
|
|
29
|
-
}
|
|
30
|
-
function isQwenTokenPlanDeepSeekV4ModelId(modelId) {
|
|
31
|
-
return modelId.trim().toLowerCase().startsWith("deepseek-v4");
|
|
32
|
-
}
|
|
33
|
-
function isQwenTokenPlanKimiModelId(modelId) {
|
|
34
|
-
return modelId.trim().toLowerCase().startsWith("kimi-");
|
|
35
|
-
}
|
|
36
|
-
function isQwenTokenPlanGlmModelId(modelId) {
|
|
37
|
-
return modelId.trim().toLowerCase().startsWith("glm-");
|
|
38
|
-
}
|
|
39
|
-
function supportsQwenTokenPlanGlmMaxThinking(modelId) {
|
|
40
|
-
return modelId.trim().toLowerCase() === "glm-5.2";
|
|
41
|
-
}
|
|
42
|
-
const QWEN_TOKEN_PLAN_BASE_URLS = {
|
|
43
|
-
global: QWEN_TOKEN_PLAN_GLOBAL_BASE_URL,
|
|
44
|
-
cn: QWEN_TOKEN_PLAN_CN_BASE_URL
|
|
45
|
-
};
|
|
46
|
-
function resolveQwenTokenPlanBaseUrl(region) {
|
|
47
|
-
return QWEN_TOKEN_PLAN_BASE_URLS[region];
|
|
48
|
-
}
|
|
49
|
-
const QWEN_TOKEN_PLAN_MODEL_CATALOG = [
|
|
50
|
-
{
|
|
51
|
-
id: QWEN_37_PLUS_MODEL_ID,
|
|
52
|
-
name: QWEN_37_PLUS_MODEL_ID,
|
|
53
|
-
reasoning: true,
|
|
54
|
-
input: ["text", "image"],
|
|
55
|
-
cost: QWEN_DEFAULT_COST,
|
|
56
|
-
contextWindow: 1e6,
|
|
57
|
-
maxTokens: 65536
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
id: QWEN_36_PLUS_MODEL_ID,
|
|
61
|
-
name: QWEN_36_PLUS_MODEL_ID,
|
|
62
|
-
reasoning: true,
|
|
63
|
-
input: ["text", "image"],
|
|
64
|
-
cost: QWEN_DEFAULT_COST,
|
|
65
|
-
contextWindow: 1e6,
|
|
66
|
-
maxTokens: 65536
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
id: "qwen3-coder-next",
|
|
70
|
-
name: "qwen3-coder-next",
|
|
71
|
-
reasoning: true,
|
|
72
|
-
input: ["text"],
|
|
73
|
-
cost: QWEN_DEFAULT_COST,
|
|
74
|
-
contextWindow: 262144,
|
|
75
|
-
maxTokens: 65536
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
id: "kimi-k2.5",
|
|
79
|
-
name: "kimi-k2.5",
|
|
80
|
-
reasoning: true,
|
|
81
|
-
input: ["text", "image"],
|
|
82
|
-
cost: QWEN_DEFAULT_COST,
|
|
83
|
-
contextWindow: 262144,
|
|
84
|
-
maxTokens: 98304
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
id: "glm-5",
|
|
88
|
-
name: "glm-5",
|
|
89
|
-
reasoning: true,
|
|
90
|
-
input: ["text"],
|
|
91
|
-
cost: QWEN_DEFAULT_COST,
|
|
92
|
-
contextWindow: 202752,
|
|
93
|
-
maxTokens: 16384
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
id: "MiniMax-M2.5",
|
|
97
|
-
name: "MiniMax-M2.5",
|
|
98
|
-
reasoning: true,
|
|
99
|
-
input: ["text"],
|
|
100
|
-
cost: QWEN_DEFAULT_COST,
|
|
101
|
-
contextWindow: 196608,
|
|
102
|
-
maxTokens: 32768
|
|
103
|
-
}
|
|
104
|
-
];
|
|
24
|
+
const QWEN_OAUTH_DEFAULT_MODEL_REF = `qwen-oauth/${QWEN_DEFAULT_MODEL_ID}`;
|
|
105
25
|
const QWEN_MODEL_CATALOG = [
|
|
106
26
|
{
|
|
107
27
|
id: "qwen3.5-plus",
|
|
@@ -112,41 +32,68 @@ const QWEN_MODEL_CATALOG = [
|
|
|
112
32
|
contextWindow: 1e6,
|
|
113
33
|
maxTokens: 65536
|
|
114
34
|
},
|
|
115
|
-
{
|
|
116
|
-
id: QWEN_36_FLASH_MODEL_ID,
|
|
117
|
-
name: QWEN_36_FLASH_MODEL_ID,
|
|
118
|
-
reasoning: true,
|
|
119
|
-
input: ["text", "image"],
|
|
120
|
-
cost: QWEN_DEFAULT_COST,
|
|
121
|
-
contextWindow: 1e6,
|
|
122
|
-
maxTokens: 65536
|
|
123
|
-
},
|
|
124
35
|
{
|
|
125
36
|
id: QWEN_36_PLUS_MODEL_ID,
|
|
126
37
|
name: QWEN_36_PLUS_MODEL_ID,
|
|
127
|
-
reasoning:
|
|
38
|
+
reasoning: false,
|
|
128
39
|
input: ["text", "image"],
|
|
129
40
|
cost: QWEN_DEFAULT_COST,
|
|
130
41
|
contextWindow: 1e6,
|
|
131
42
|
maxTokens: 65536
|
|
132
43
|
},
|
|
133
44
|
{
|
|
134
|
-
id:
|
|
135
|
-
name:
|
|
45
|
+
id: "qwen3.8-max",
|
|
46
|
+
name: "qwen3.8-max",
|
|
136
47
|
reasoning: true,
|
|
137
|
-
input: ["text"],
|
|
48
|
+
input: ["text", "image"],
|
|
138
49
|
cost: QWEN_DEFAULT_COST,
|
|
139
50
|
contextWindow: 1e6,
|
|
140
|
-
maxTokens:
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
51
|
+
maxTokens: 131072,
|
|
52
|
+
thinkingLevelMap: {
|
|
53
|
+
minimal: "low",
|
|
54
|
+
high: "xhigh",
|
|
55
|
+
max: "xhigh"
|
|
56
|
+
},
|
|
57
|
+
compat: {
|
|
58
|
+
supportsReasoningEffort: true,
|
|
59
|
+
supportedReasoningEfforts: [
|
|
60
|
+
"low",
|
|
61
|
+
"medium",
|
|
62
|
+
"xhigh"
|
|
63
|
+
],
|
|
64
|
+
reasoningEffortMap: {
|
|
65
|
+
minimal: "low",
|
|
66
|
+
high: "xhigh",
|
|
67
|
+
max: "xhigh"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: "qwen3.8-flash",
|
|
73
|
+
name: "qwen3.8-flash",
|
|
145
74
|
reasoning: true,
|
|
146
75
|
input: ["text", "image"],
|
|
147
76
|
cost: QWEN_DEFAULT_COST,
|
|
148
77
|
contextWindow: 1e6,
|
|
149
|
-
maxTokens:
|
|
78
|
+
maxTokens: 131072,
|
|
79
|
+
thinkingLevelMap: {
|
|
80
|
+
minimal: "low",
|
|
81
|
+
high: "xhigh",
|
|
82
|
+
max: "xhigh"
|
|
83
|
+
},
|
|
84
|
+
compat: {
|
|
85
|
+
supportsReasoningEffort: true,
|
|
86
|
+
supportedReasoningEfforts: [
|
|
87
|
+
"low",
|
|
88
|
+
"medium",
|
|
89
|
+
"xhigh"
|
|
90
|
+
],
|
|
91
|
+
reasoningEffortMap: {
|
|
92
|
+
minimal: "low",
|
|
93
|
+
high: "xhigh",
|
|
94
|
+
max: "xhigh"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
150
97
|
},
|
|
151
98
|
{
|
|
152
99
|
id: "qwen3-max-2026-01-23",
|
|
@@ -222,15 +169,11 @@ function isQwenCodingPlanBaseUrl(baseUrl) {
|
|
|
222
169
|
return false;
|
|
223
170
|
}
|
|
224
171
|
}
|
|
225
|
-
function isQwen36PlusSupportedBaseUrl(
|
|
226
|
-
return
|
|
227
|
-
}
|
|
228
|
-
const QWEN_STANDARD_ONLY_MODEL_IDS = /* @__PURE__ */ new Set([QWEN_36_FLASH_MODEL_ID, QWEN_37_MAX_MODEL_ID]);
|
|
229
|
-
function isQwenStandardOnlyModelId(modelId) {
|
|
230
|
-
return QWEN_STANDARD_ONLY_MODEL_IDS.has(modelId);
|
|
172
|
+
function isQwen36PlusSupportedBaseUrl(baseUrl) {
|
|
173
|
+
return !isQwenCodingPlanBaseUrl(baseUrl);
|
|
231
174
|
}
|
|
232
175
|
function buildQwenModelCatalogForBaseUrl(baseUrl) {
|
|
233
|
-
return
|
|
176
|
+
return isQwen36PlusSupportedBaseUrl(baseUrl) ? QWEN_MODEL_CATALOG : QWEN_MODEL_CATALOG.filter((model) => !QWEN_STANDARD_ONLY_MODEL_IDS.has(model.id));
|
|
234
177
|
}
|
|
235
178
|
function isNativeQwenBaseUrl(baseUrl) {
|
|
236
179
|
return supportsNativeStreamingUsageCompat({
|
|
@@ -259,6 +202,12 @@ function buildQwenModelDefinition(params) {
|
|
|
259
202
|
function buildQwenDefaultModelDefinition() {
|
|
260
203
|
return buildQwenModelDefinition({ id: QWEN_DEFAULT_MODEL_ID });
|
|
261
204
|
}
|
|
205
|
+
function buildQwenOAuthModelCatalog() {
|
|
206
|
+
return QWEN_MODEL_CATALOG.map((model) => ({
|
|
207
|
+
...model,
|
|
208
|
+
maxTokens: 65536
|
|
209
|
+
}));
|
|
210
|
+
}
|
|
262
211
|
/** @deprecated Use QWEN_BASE_URL. */
|
|
263
212
|
const MODELSTUDIO_BASE_URL = QWEN_BASE_URL;
|
|
264
213
|
/** @deprecated Use QWEN_GLOBAL_BASE_URL. */
|
|
@@ -282,4 +231,4 @@ const applyModelStudioNativeStreamingUsageCompat = applyQwenNativeStreamingUsage
|
|
|
282
231
|
const buildModelStudioModelDefinition = buildQwenModelDefinition;
|
|
283
232
|
const buildModelStudioDefaultModelDefinition = buildQwenDefaultModelDefinition;
|
|
284
233
|
//#endregion
|
|
285
|
-
export { MODELSTUDIO_BASE_URL, MODELSTUDIO_CN_BASE_URL, MODELSTUDIO_DEFAULT_COST, MODELSTUDIO_DEFAULT_MODEL_ID, MODELSTUDIO_DEFAULT_MODEL_REF, MODELSTUDIO_GLOBAL_BASE_URL, MODELSTUDIO_MODEL_CATALOG, MODELSTUDIO_STANDARD_CN_BASE_URL, MODELSTUDIO_STANDARD_GLOBAL_BASE_URL,
|
|
234
|
+
export { MODELSTUDIO_BASE_URL, MODELSTUDIO_CN_BASE_URL, MODELSTUDIO_DEFAULT_COST, MODELSTUDIO_DEFAULT_MODEL_ID, MODELSTUDIO_DEFAULT_MODEL_REF, MODELSTUDIO_GLOBAL_BASE_URL, MODELSTUDIO_MODEL_CATALOG, MODELSTUDIO_STANDARD_CN_BASE_URL, MODELSTUDIO_STANDARD_GLOBAL_BASE_URL, QWEN_36_PLUS_MODEL_ID, QWEN_BASE_URL, QWEN_CN_BASE_URL, QWEN_DEFAULT_COST, QWEN_DEFAULT_MODEL_ID, QWEN_DEFAULT_MODEL_REF, QWEN_GLOBAL_BASE_URL, QWEN_MODEL_CATALOG, QWEN_OAUTH_BASE_URL, QWEN_OAUTH_DEFAULT_MODEL_REF, QWEN_OAUTH_PROVIDER_ID, QWEN_STANDARD_CN_BASE_URL, QWEN_STANDARD_GLOBAL_BASE_URL, applyModelStudioNativeStreamingUsageCompat, applyQwenNativeStreamingUsageCompat, buildModelStudioDefaultModelDefinition, buildModelStudioModelDefinition, buildQwenDefaultModelDefinition, buildQwenModelCatalogForBaseUrl, buildQwenModelDefinition, buildQwenOAuthModelCatalog, isNativeModelStudioBaseUrl, isNativeQwenBaseUrl, isQwen36PlusSupportedBaseUrl, isQwenCodingPlanBaseUrl };
|
package/dist/onboard.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { QWEN_CN_BASE_URL, QWEN_DEFAULT_MODEL_REF, QWEN_GLOBAL_BASE_URL,
|
|
2
|
-
import {
|
|
1
|
+
import { QWEN_CN_BASE_URL, QWEN_DEFAULT_MODEL_REF, QWEN_GLOBAL_BASE_URL, QWEN_OAUTH_DEFAULT_MODEL_REF, QWEN_OAUTH_PROVIDER_ID, QWEN_STANDARD_CN_BASE_URL, QWEN_STANDARD_GLOBAL_BASE_URL } from "./models.js";
|
|
2
|
+
import { buildQwenOAuthProvider, buildQwenProvider } from "./provider-catalog.js";
|
|
3
3
|
import { createModelCatalogPresetAppliers } from "openclaw/plugin-sdk/provider-onboard";
|
|
4
4
|
//#region extensions/qwen/onboard.ts
|
|
5
5
|
const qwenPresetAppliers = createModelCatalogPresetAppliers({
|
|
@@ -18,18 +18,18 @@ const qwenPresetAppliers = createModelCatalogPresetAppliers({
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
|
-
const
|
|
22
|
-
primaryModelRef:
|
|
23
|
-
resolveParams: (
|
|
24
|
-
const provider =
|
|
21
|
+
const qwenOAuthPresetAppliers = createModelCatalogPresetAppliers({
|
|
22
|
+
primaryModelRef: QWEN_OAUTH_DEFAULT_MODEL_REF,
|
|
23
|
+
resolveParams: () => {
|
|
24
|
+
const provider = buildQwenOAuthProvider();
|
|
25
25
|
return {
|
|
26
|
-
providerId:
|
|
26
|
+
providerId: QWEN_OAUTH_PROVIDER_ID,
|
|
27
27
|
api: provider.api ?? "openai-completions",
|
|
28
|
-
baseUrl,
|
|
28
|
+
baseUrl: provider.baseUrl,
|
|
29
29
|
catalogModels: provider.models ?? [],
|
|
30
|
-
aliases: [...(provider.models ?? []).map((model) =>
|
|
31
|
-
modelRef:
|
|
32
|
-
alias: "Qwen
|
|
30
|
+
aliases: [...(provider.models ?? []).map((model) => `qwen-oauth/${model.id}`), {
|
|
31
|
+
modelRef: QWEN_OAUTH_DEFAULT_MODEL_REF,
|
|
32
|
+
alias: "Qwen OAuth"
|
|
33
33
|
}]
|
|
34
34
|
};
|
|
35
35
|
}
|
|
@@ -46,8 +46,8 @@ function applyQwenStandardConfig(cfg) {
|
|
|
46
46
|
function applyQwenStandardConfigCn(cfg) {
|
|
47
47
|
return qwenPresetAppliers.applyConfig(cfg, QWEN_STANDARD_CN_BASE_URL);
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
return
|
|
49
|
+
function applyQwenOAuthConfig(cfg) {
|
|
50
|
+
return qwenOAuthPresetAppliers.applyConfig(cfg);
|
|
51
51
|
}
|
|
52
52
|
//#endregion
|
|
53
|
-
export { applyQwenConfig, applyQwenConfigCn, applyQwenStandardConfig, applyQwenStandardConfigCn
|
|
53
|
+
export { applyQwenConfig, applyQwenConfigCn, applyQwenOAuthConfig, applyQwenStandardConfig, applyQwenStandardConfigCn };
|
package/dist/provider-catalog.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QWEN_OAUTH_BASE_URL, buildQwenModelCatalogForBaseUrl, buildQwenOAuthModelCatalog } from "./models.js";
|
|
2
2
|
//#region extensions/qwen/provider-catalog.ts
|
|
3
3
|
function buildQwenProvider(params) {
|
|
4
4
|
const baseUrl = params?.baseUrl ?? "https://coding-intl.dashscope.aliyuncs.com/v1";
|
|
@@ -8,13 +8,13 @@ function buildQwenProvider(params) {
|
|
|
8
8
|
models: buildQwenModelCatalogForBaseUrl(baseUrl).map((model) => Object.assign({}, model))
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function buildQwenOAuthProvider() {
|
|
12
12
|
return {
|
|
13
|
-
baseUrl:
|
|
13
|
+
baseUrl: QWEN_OAUTH_BASE_URL,
|
|
14
14
|
api: "openai-completions",
|
|
15
|
-
models:
|
|
15
|
+
models: buildQwenOAuthModelCatalog().map((model) => Object.assign({}, model))
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
const buildModelStudioProvider = buildQwenProvider;
|
|
19
19
|
//#endregion
|
|
20
|
-
export { buildModelStudioProvider,
|
|
20
|
+
export { buildModelStudioProvider, buildQwenOAuthProvider, buildQwenProvider };
|
package/dist/stream.js
CHANGED
|
@@ -1,154 +1,50 @@
|
|
|
1
|
-
import { isQwenTokenPlanDeepSeekV4ModelId, isQwenTokenPlanGlmModelId, isQwenTokenPlanKimiModelId, isQwenTokenPlanThinkingOnlyModelId, supportsQwenTokenPlanGlmMaxThinking } from "./models.js";
|
|
2
|
-
import { streamSimple } from "openclaw/plugin-sdk/llm";
|
|
3
1
|
import { normalizeProviderId } from "openclaw/plugin-sdk/provider-model-shared";
|
|
4
|
-
import { createPayloadPatchStreamWrapper, isOpenAICompatibleThinkingEnabled,
|
|
2
|
+
import { createPayloadPatchStreamWrapper, isOpenAICompatibleThinkingEnabled, setQwenChatTemplateThinking } from "openclaw/plugin-sdk/provider-stream-shared";
|
|
5
3
|
//#region extensions/qwen/stream.ts
|
|
6
|
-
function asPayloadRecord(value) {
|
|
7
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
8
|
-
}
|
|
9
|
-
function resolveQwenThinkingLevel(thinkingLevel, options) {
|
|
10
|
-
const runtimeOptions = options ?? {};
|
|
11
|
-
const raw = runtimeOptions.reasoningEffort ?? runtimeOptions.reasoning ?? thinkingLevel;
|
|
12
|
-
if (typeof raw !== "string") return thinkingLevel;
|
|
13
|
-
const normalized = raw.trim().toLowerCase();
|
|
14
|
-
if (normalized === "none") return "off";
|
|
15
|
-
switch (normalized) {
|
|
16
|
-
case "off":
|
|
17
|
-
case "minimal":
|
|
18
|
-
case "low":
|
|
19
|
-
case "medium":
|
|
20
|
-
case "high":
|
|
21
|
-
case "xhigh":
|
|
22
|
-
case "max": return normalized;
|
|
23
|
-
default: return thinkingLevel;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
4
|
function isQwenProviderId(providerId) {
|
|
27
5
|
const normalized = normalizeProviderId(providerId);
|
|
28
|
-
return normalized === "qwen" || normalized === "qwen-
|
|
6
|
+
return normalized === "qwen" || normalized === "qwen-oauth" || normalized === "qwen-portal" || normalized === "qwen-cli" || normalized === "modelstudio" || normalized === "qwencloud" || normalized === "dashscope";
|
|
29
7
|
}
|
|
30
|
-
function
|
|
8
|
+
function isQwenOAuthProviderId(providerId) {
|
|
31
9
|
const normalized = normalizeProviderId(providerId);
|
|
32
|
-
return normalized === "qwen-
|
|
33
|
-
}
|
|
34
|
-
function resolveQwenTokenPlanThinkingContract(providerId, modelId) {
|
|
35
|
-
if (!isQwenTokenPlanProviderId(providerId)) return;
|
|
36
|
-
if (isQwenTokenPlanDeepSeekV4ModelId(modelId)) return { family: "deepseek-v4" };
|
|
37
|
-
if (isQwenTokenPlanKimiModelId(modelId)) return { family: "kimi" };
|
|
38
|
-
if (isQwenTokenPlanGlmModelId(modelId)) return {
|
|
39
|
-
family: "glm",
|
|
40
|
-
supportsMax: supportsQwenTokenPlanGlmMaxThinking(modelId)
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function patchTokenPlanDeepSeekV4Payload(payload, thinkingLevel, enableThinking) {
|
|
44
|
-
delete payload.thinking;
|
|
45
|
-
if (!enableThinking) {
|
|
46
|
-
delete payload.reasoning_effort;
|
|
47
|
-
normalizeOpenAICompatibleReasoningReplay(payload, { thinkingEnabled: false });
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
payload.reasoning_effort = thinkingLevel === "xhigh" || thinkingLevel === "max" ? "max" : "high";
|
|
51
|
-
normalizeOpenAICompatibleReasoningReplay(payload, { thinkingEnabled: true });
|
|
52
|
-
}
|
|
53
|
-
function patchTokenPlanKimiPayload(payload, enableThinking) {
|
|
54
|
-
delete payload.thinking;
|
|
55
|
-
delete payload.reasoning_effort;
|
|
56
|
-
if (enableThinking) normalizeOpenAICompatibleReasoningReplay(payload, {
|
|
57
|
-
thinkingEnabled: true,
|
|
58
|
-
shouldBackfillAssistantMessage: (message) => Array.isArray(message.tool_calls) && message.tool_calls.length > 0
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
function normalizeTokenPlanThinkingToolChoice(payload, enableThinking, forceThinking) {
|
|
62
|
-
if (!enableThinking) return false;
|
|
63
|
-
const toolChoice = payload.tool_choice;
|
|
64
|
-
const toolChoiceType = asPayloadRecord(toolChoice)?.type;
|
|
65
|
-
if (toolChoiceType === "auto" || toolChoiceType === "none") {
|
|
66
|
-
payload.tool_choice = toolChoiceType;
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
if (toolChoice == null || toolChoice === "auto" || toolChoice === "none") return true;
|
|
70
|
-
if (!forceThinking && (toolChoiceType === "tool" || toolChoiceType === "function")) {
|
|
71
|
-
payload.enable_thinking = false;
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
payload.tool_choice = "auto";
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
function enforceQwenTokenPlanPayloadAfterCaller(payload, tokenPlanContract, forceThinking, requestedEnableThinking, requestedThinkingLevel) {
|
|
78
|
-
const hasPayloadThinking = typeof payload.enable_thinking === "boolean";
|
|
79
|
-
let enableThinking = forceThinking || (hasPayloadThinking ? payload.enable_thinking !== false : requestedEnableThinking);
|
|
80
|
-
const rawThinkingLevel = typeof payload.reasoning_effort === "string" ? payload.reasoning_effort : hasPayloadThinking ? void 0 : requestedThinkingLevel;
|
|
81
|
-
if (!forceThinking && rawThinkingLevel === "off") enableThinking = false;
|
|
82
|
-
payload.enable_thinking = enableThinking;
|
|
83
|
-
enableThinking = normalizeTokenPlanThinkingToolChoice(payload, enableThinking, forceThinking);
|
|
84
|
-
if (tokenPlanContract?.family === "deepseek-v4") patchTokenPlanDeepSeekV4Payload(payload, rawThinkingLevel === "xhigh" || rawThinkingLevel === "max" ? "max" : "high", enableThinking);
|
|
85
|
-
else if (tokenPlanContract?.family === "kimi") patchTokenPlanKimiPayload(payload, enableThinking);
|
|
86
|
-
else if (tokenPlanContract?.family === "glm") {
|
|
87
|
-
if (Array.isArray(payload.tools) && payload.tools.length > 0) payload.tool_stream = true;
|
|
88
|
-
if (rawThinkingLevel === "none" && enableThinking) delete payload.thinking;
|
|
89
|
-
else patchTokenPlanGlmPayload(payload, typeof rawThinkingLevel === "string" ? resolveQwenThinkingLevel(rawThinkingLevel, void 0) : void 0, enableThinking, tokenPlanContract.supportsMax);
|
|
90
|
-
} else {
|
|
91
|
-
delete payload.thinking;
|
|
92
|
-
delete payload.reasoning_effort;
|
|
93
|
-
}
|
|
94
|
-
delete payload.reasoningEffort;
|
|
95
|
-
delete payload.reasoning;
|
|
10
|
+
return normalized === "qwen-oauth" || normalized === "qwen-portal" || normalized === "qwen-cli";
|
|
96
11
|
}
|
|
97
|
-
function
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const originalOnPayload = options?.onPayload;
|
|
112
|
-
return underlying(model, context, {
|
|
113
|
-
...options,
|
|
114
|
-
onPayload(payload, payloadModel) {
|
|
115
|
-
const payloadObj = asPayloadRecord(payload);
|
|
116
|
-
const result = originalOnPayload?.(payload, payloadModel);
|
|
117
|
-
if (result && typeof result.then === "function") return Promise.resolve(result).then((resolved) => finalizeQwenTokenPlanPayloadAfterCaller(resolved, payloadObj, tokenPlanContract, forceThinking, requestedEnableThinking, requestedThinkingLevel));
|
|
118
|
-
return finalizeQwenTokenPlanPayloadAfterCaller(result, payloadObj, tokenPlanContract, forceThinking, requestedEnableThinking, requestedThinkingLevel);
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
};
|
|
12
|
+
function normalizeQwenOAuthContent(content) {
|
|
13
|
+
if (typeof content === "string") return [{
|
|
14
|
+
type: "text",
|
|
15
|
+
text: content
|
|
16
|
+
}];
|
|
17
|
+
if (!Array.isArray(content)) return content;
|
|
18
|
+
const normalized = content.map((part) => {
|
|
19
|
+
if (typeof part === "string") return {
|
|
20
|
+
type: "text",
|
|
21
|
+
text: part
|
|
22
|
+
};
|
|
23
|
+
return part && typeof part === "object" ? part : void 0;
|
|
24
|
+
}).filter((part) => Boolean(part));
|
|
25
|
+
return normalized.length > 0 ? normalized : content;
|
|
122
26
|
}
|
|
123
|
-
function
|
|
124
|
-
|
|
125
|
-
if (!
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
case "high":
|
|
134
|
-
case "xhigh":
|
|
135
|
-
payload.reasoning_effort = thinkingLevel;
|
|
136
|
-
return;
|
|
137
|
-
case "max":
|
|
138
|
-
payload.reasoning_effort = supportsMax ? "max" : "xhigh";
|
|
139
|
-
return;
|
|
140
|
-
default: delete payload.reasoning_effort;
|
|
27
|
+
function patchQwenOAuthPayload(payload) {
|
|
28
|
+
const messages = payload.messages;
|
|
29
|
+
if (!Array.isArray(messages)) return;
|
|
30
|
+
for (const message of messages) {
|
|
31
|
+
if (!message || typeof message !== "object") continue;
|
|
32
|
+
const record = message;
|
|
33
|
+
record.content = normalizeQwenOAuthContent(record.content);
|
|
34
|
+
if (record.role !== "system" || !Array.isArray(record.content) || record.content.length === 0) continue;
|
|
35
|
+
const last = record.content[record.content.length - 1];
|
|
36
|
+
if (last && typeof last === "object") last.cache_control = { type: "ephemeral" };
|
|
141
37
|
}
|
|
38
|
+
payload.vl_high_resolution_images = true;
|
|
142
39
|
}
|
|
143
40
|
function readQwenThinkingFormatFromModel(model) {
|
|
144
41
|
if (model.api !== "openai-completions") return;
|
|
145
42
|
const compat = model.compat && typeof model.compat === "object" ? model.compat : void 0;
|
|
146
43
|
return typeof compat?.thinkingFormat === "string" ? compat.thinkingFormat : void 0;
|
|
147
44
|
}
|
|
148
|
-
function createQwenThinkingWrapper(baseStreamFn, thinkingLevel, thinkingFormat
|
|
45
|
+
function createQwenThinkingWrapper(baseStreamFn, thinkingLevel, thinkingFormat) {
|
|
149
46
|
return createPayloadPatchStreamWrapper(baseStreamFn, ({ payload: payloadObj, model, options }) => {
|
|
150
|
-
const
|
|
151
|
-
const enableThinking = forceThinking || isOpenAICompatibleThinkingEnabled({
|
|
47
|
+
const enableThinking = isOpenAICompatibleThinkingEnabled({
|
|
152
48
|
thinkingLevel,
|
|
153
49
|
options
|
|
154
50
|
});
|
|
@@ -156,25 +52,18 @@ function createQwenThinkingWrapper(baseStreamFn, thinkingLevel, thinkingFormat,
|
|
|
156
52
|
setQwenChatTemplateThinking(payloadObj, enableThinking);
|
|
157
53
|
delete payloadObj.enable_thinking;
|
|
158
54
|
} else payloadObj.enable_thinking = enableThinking;
|
|
159
|
-
|
|
160
|
-
else if (tokenPlanContract?.family === "kimi") patchTokenPlanKimiPayload(payloadObj, false);
|
|
161
|
-
else if (tokenPlanContract?.family === "glm") patchTokenPlanGlmPayload(payloadObj, effectiveThinkingLevel, enableThinking, tokenPlanContract.supportsMax);
|
|
162
|
-
else delete payloadObj.reasoning_effort;
|
|
55
|
+
delete payloadObj.reasoning_effort;
|
|
163
56
|
delete payloadObj.reasoningEffort;
|
|
164
57
|
delete payloadObj.reasoning;
|
|
165
|
-
}, { shouldPatch: ({ model }) => model.api === "openai-completions" &&
|
|
58
|
+
}, { shouldPatch: ({ model }) => model.api === "openai-completions" && model.reasoning });
|
|
166
59
|
}
|
|
167
60
|
function wrapQwenProviderStream(ctx) {
|
|
168
61
|
if (!isQwenProviderId(ctx.provider) || ctx.model && ctx.model.api !== "openai-completions") return;
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const forceThinking = useTokenPlanConstraints && isQwenTokenPlanThinkingOnlyModelId(ctx.modelId);
|
|
175
|
-
let streamFn = createQwenThinkingWrapper(ctx.streamFn, ctx.thinkingLevel, thinkingFormat, forceThinking, tokenPlanContract);
|
|
176
|
-
if (useTokenPlanConstraints) streamFn = createQwenTokenPlanConstraintWrapper(streamFn, tokenPlanContract, forceThinking, ctx.thinkingLevel);
|
|
177
|
-
return streamFn;
|
|
62
|
+
const streamFn = createQwenThinkingWrapper(ctx.streamFn, ctx.thinkingLevel, ctx.model ? readQwenThinkingFormatFromModel(ctx.model) : void 0);
|
|
63
|
+
if (!isQwenOAuthProviderId(ctx.provider)) return streamFn;
|
|
64
|
+
return createPayloadPatchStreamWrapper(streamFn, ({ payload, model }) => {
|
|
65
|
+
if (model.api === "openai-completions") patchQwenOAuthPayload(payload);
|
|
66
|
+
});
|
|
178
67
|
}
|
|
179
68
|
//#endregion
|
|
180
69
|
export { createQwenThinkingWrapper, wrapQwenProviderStream };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./models.js";
|
|
2
|
-
import { resolveProviderHttpRequestConfig
|
|
2
|
+
import { resolveProviderHttpRequestConfig } from "openclaw/plugin-sdk/provider-http";
|
|
3
3
|
import { isProviderApiKeyConfigured } from "openclaw/plugin-sdk/provider-auth";
|
|
4
4
|
import { resolveApiKeyForProvider } from "openclaw/plugin-sdk/provider-auth-runtime";
|
|
5
5
|
import { DASHSCOPE_WAN_VIDEO_CAPABILITIES, DASHSCOPE_WAN_VIDEO_MODELS, DEFAULT_DASHSCOPE_WAN_VIDEO_MODEL, DEFAULT_VIDEO_GENERATION_TIMEOUT_MS, runDashscopeVideoGenerationTask } from "openclaw/plugin-sdk/video-generation";
|
|
@@ -44,9 +44,9 @@ function buildQwenVideoGenerationProvider() {
|
|
|
44
44
|
store: req.authStore
|
|
45
45
|
});
|
|
46
46
|
if (!auth.apiKey) throw new Error("Qwen API key missing");
|
|
47
|
-
const
|
|
47
|
+
const requestBaseUrl = resolveQwenVideoBaseUrl(req);
|
|
48
48
|
const { baseUrl, allowPrivateNetwork, headers, dispatcherPolicy } = resolveProviderHttpRequestConfig({
|
|
49
|
-
baseUrl:
|
|
49
|
+
baseUrl: requestBaseUrl,
|
|
50
50
|
defaultBaseUrl: DEFAULT_QWEN_VIDEO_BASE_URL,
|
|
51
51
|
defaultHeaders: {
|
|
52
52
|
Authorization: `Bearer ${auth.apiKey}`,
|
|
@@ -55,12 +55,12 @@ function buildQwenVideoGenerationProvider() {
|
|
|
55
55
|
},
|
|
56
56
|
provider: "qwen",
|
|
57
57
|
capability: "video",
|
|
58
|
-
transport: "http"
|
|
59
|
-
request: sanitizeConfiguredModelProviderRequest(providerConfig?.request)
|
|
58
|
+
transport: "http"
|
|
60
59
|
});
|
|
60
|
+
const model = req.model?.trim() || DEFAULT_QWEN_VIDEO_MODEL;
|
|
61
61
|
return await runDashscopeVideoGenerationTask({
|
|
62
62
|
providerLabel: "Qwen",
|
|
63
|
-
model
|
|
63
|
+
model,
|
|
64
64
|
req,
|
|
65
65
|
url: `${resolveDashscopeAigcApiBaseUrl(baseUrl)}/api/v1/services/aigc/video-generation/video-synthesis`,
|
|
66
66
|
headers,
|
package/openclaw.plugin.json
CHANGED
|
@@ -5,14 +5,11 @@
|
|
|
5
5
|
"onStartup": false
|
|
6
6
|
},
|
|
7
7
|
"enabledByDefault": true,
|
|
8
|
-
"providers": [
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
"qwen-token-plan",
|
|
14
|
-
"bailian-token-plan"
|
|
15
|
-
],
|
|
8
|
+
"providers": ["qwen", "qwencloud", "modelstudio", "dashscope", "qwen-oauth", "qwen-portal", "qwen-cli"],
|
|
9
|
+
"providerAuthAliases": {
|
|
10
|
+
"qwen-portal": "qwen-oauth",
|
|
11
|
+
"qwen-cli": "qwen-oauth"
|
|
12
|
+
},
|
|
16
13
|
"providerEndpoints": [
|
|
17
14
|
{
|
|
18
15
|
"endpointClass": "modelstudio-native",
|
|
@@ -20,10 +17,12 @@
|
|
|
20
17
|
"https://coding-intl.dashscope.aliyuncs.com/v1",
|
|
21
18
|
"https://coding.dashscope.aliyuncs.com/v1",
|
|
22
19
|
"https://dashscope.aliyuncs.com/compatible-mode/v1",
|
|
23
|
-
"https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
|
|
24
|
-
"https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
|
|
25
|
-
"https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1"
|
|
20
|
+
"https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
|
|
26
21
|
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"endpointClass": "qwen-portal-native",
|
|
25
|
+
"baseUrls": ["https://portal.qwen.ai/v1"]
|
|
27
26
|
}
|
|
28
27
|
],
|
|
29
28
|
"providerRequest": {
|
|
@@ -40,29 +39,31 @@
|
|
|
40
39
|
"dashscope": {
|
|
41
40
|
"family": "modelstudio"
|
|
42
41
|
},
|
|
43
|
-
"qwen-
|
|
44
|
-
"family": "
|
|
42
|
+
"qwen-oauth": {
|
|
43
|
+
"family": "qwen-portal"
|
|
45
44
|
},
|
|
46
|
-
"
|
|
47
|
-
"family": "
|
|
45
|
+
"qwen-portal": {
|
|
46
|
+
"family": "qwen-portal"
|
|
47
|
+
},
|
|
48
|
+
"qwen-cli": {
|
|
49
|
+
"family": "qwen-portal"
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
},
|
|
51
53
|
"modelCatalog": {
|
|
52
|
-
"
|
|
53
|
-
{
|
|
54
|
-
"provider": "qwen"
|
|
55
|
-
"model": "qwen3.6-flash",
|
|
56
|
-
"reason": "qwen3.6-flash is not supported on the Qwen Coding Plan endpoint; use a Standard pay-as-you-go Qwen endpoint.",
|
|
57
|
-
"when": {
|
|
58
|
-
"baseUrlHosts": ["coding.dashscope.aliyuncs.com", "coding-intl.dashscope.aliyuncs.com"],
|
|
59
|
-
"providerConfigApiIn": ["qwen", "modelstudio"]
|
|
60
|
-
}
|
|
54
|
+
"aliases": {
|
|
55
|
+
"qwen-portal": {
|
|
56
|
+
"provider": "qwen-oauth"
|
|
61
57
|
},
|
|
58
|
+
"qwen-cli": {
|
|
59
|
+
"provider": "qwen-oauth"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"suppressions": [
|
|
62
63
|
{
|
|
63
64
|
"provider": "qwen",
|
|
64
|
-
"model": "qwen3.
|
|
65
|
-
"reason": "qwen3.
|
|
65
|
+
"model": "qwen3.6-plus",
|
|
66
|
+
"reason": "qwen3.6-plus is not supported on the Qwen Coding Plan endpoint; use a Standard pay-as-you-go Qwen endpoint or choose qwen/qwen3.5-plus.",
|
|
66
67
|
"when": {
|
|
67
68
|
"baseUrlHosts": ["coding.dashscope.aliyuncs.com", "coding-intl.dashscope.aliyuncs.com"],
|
|
68
69
|
"providerConfigApiIn": ["qwen", "modelstudio"]
|
|
@@ -70,17 +71,8 @@
|
|
|
70
71
|
},
|
|
71
72
|
{
|
|
72
73
|
"provider": "modelstudio",
|
|
73
|
-
"model": "qwen3.6-
|
|
74
|
-
"reason": "qwen3.6-
|
|
75
|
-
"when": {
|
|
76
|
-
"baseUrlHosts": ["coding.dashscope.aliyuncs.com", "coding-intl.dashscope.aliyuncs.com"],
|
|
77
|
-
"providerConfigApiIn": ["qwen", "modelstudio"]
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"provider": "modelstudio",
|
|
82
|
-
"model": "qwen3.7-max",
|
|
83
|
-
"reason": "qwen3.7-max is not supported on the Qwen Coding Plan endpoint; use a Standard pay-as-you-go Qwen endpoint.",
|
|
74
|
+
"model": "qwen3.6-plus",
|
|
75
|
+
"reason": "qwen3.6-plus is not supported on the Qwen Coding Plan endpoint; use a Standard pay-as-you-go Qwen endpoint or choose qwen/qwen3.5-plus.",
|
|
84
76
|
"when": {
|
|
85
77
|
"baseUrlHosts": ["coding.dashscope.aliyuncs.com", "coding-intl.dashscope.aliyuncs.com"],
|
|
86
78
|
"providerConfigApiIn": ["qwen", "modelstudio"]
|
|
@@ -88,72 +80,138 @@
|
|
|
88
80
|
}
|
|
89
81
|
],
|
|
90
82
|
"providers": {
|
|
91
|
-
"qwen-
|
|
92
|
-
"baseUrl": "https://
|
|
83
|
+
"qwen-oauth": {
|
|
84
|
+
"baseUrl": "https://portal.qwen.ai/v1",
|
|
93
85
|
"api": "openai-completions",
|
|
94
86
|
"models": [
|
|
95
87
|
{
|
|
96
|
-
"id": "qwen3.
|
|
97
|
-
"name": "qwen3.
|
|
98
|
-
"reasoning":
|
|
88
|
+
"id": "qwen3.5-plus",
|
|
89
|
+
"name": "qwen3.5-plus",
|
|
90
|
+
"reasoning": false,
|
|
99
91
|
"input": ["text", "image"],
|
|
100
|
-
"cost": {
|
|
92
|
+
"cost": {
|
|
93
|
+
"input": 0,
|
|
94
|
+
"output": 0,
|
|
95
|
+
"cacheRead": 0,
|
|
96
|
+
"cacheWrite": 0
|
|
97
|
+
},
|
|
101
98
|
"contextWindow": 1000000,
|
|
102
99
|
"maxTokens": 65536
|
|
103
100
|
},
|
|
104
101
|
{
|
|
105
102
|
"id": "qwen3.6-plus",
|
|
106
103
|
"name": "qwen3.6-plus",
|
|
107
|
-
"reasoning":
|
|
104
|
+
"reasoning": false,
|
|
108
105
|
"input": ["text", "image"],
|
|
109
|
-
"cost": {
|
|
106
|
+
"cost": {
|
|
107
|
+
"input": 0,
|
|
108
|
+
"output": 0,
|
|
109
|
+
"cacheRead": 0,
|
|
110
|
+
"cacheWrite": 0
|
|
111
|
+
},
|
|
110
112
|
"contextWindow": 1000000,
|
|
111
113
|
"maxTokens": 65536
|
|
112
114
|
},
|
|
115
|
+
{
|
|
116
|
+
"id": "qwen3-max-2026-01-23",
|
|
117
|
+
"name": "qwen3-max-2026-01-23",
|
|
118
|
+
"reasoning": false,
|
|
119
|
+
"input": ["text"],
|
|
120
|
+
"cost": {
|
|
121
|
+
"input": 0,
|
|
122
|
+
"output": 0,
|
|
123
|
+
"cacheRead": 0,
|
|
124
|
+
"cacheWrite": 0
|
|
125
|
+
},
|
|
126
|
+
"contextWindow": 262144,
|
|
127
|
+
"maxTokens": 65536
|
|
128
|
+
},
|
|
113
129
|
{
|
|
114
130
|
"id": "qwen3-coder-next",
|
|
115
131
|
"name": "qwen3-coder-next",
|
|
116
|
-
"reasoning":
|
|
132
|
+
"reasoning": false,
|
|
117
133
|
"input": ["text"],
|
|
118
|
-
"cost": {
|
|
134
|
+
"cost": {
|
|
135
|
+
"input": 0,
|
|
136
|
+
"output": 0,
|
|
137
|
+
"cacheRead": 0,
|
|
138
|
+
"cacheWrite": 0
|
|
139
|
+
},
|
|
119
140
|
"contextWindow": 262144,
|
|
120
|
-
"maxTokens": 65536
|
|
121
|
-
"status": "deprecated",
|
|
122
|
-
"replacedBy": "qwen3.7-plus"
|
|
141
|
+
"maxTokens": 65536
|
|
123
142
|
},
|
|
124
143
|
{
|
|
125
|
-
"id": "
|
|
126
|
-
"name": "
|
|
144
|
+
"id": "qwen3-coder-plus",
|
|
145
|
+
"name": "qwen3-coder-plus",
|
|
146
|
+
"reasoning": false,
|
|
147
|
+
"input": ["text"],
|
|
148
|
+
"cost": {
|
|
149
|
+
"input": 0,
|
|
150
|
+
"output": 0,
|
|
151
|
+
"cacheRead": 0,
|
|
152
|
+
"cacheWrite": 0
|
|
153
|
+
},
|
|
154
|
+
"contextWindow": 1000000,
|
|
155
|
+
"maxTokens": 65536
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"id": "MiniMax-M2.5",
|
|
159
|
+
"name": "MiniMax-M2.5",
|
|
127
160
|
"reasoning": true,
|
|
128
|
-
"input": ["text"
|
|
129
|
-
"cost": {
|
|
130
|
-
|
|
131
|
-
|
|
161
|
+
"input": ["text"],
|
|
162
|
+
"cost": {
|
|
163
|
+
"input": 0,
|
|
164
|
+
"output": 0,
|
|
165
|
+
"cacheRead": 0,
|
|
166
|
+
"cacheWrite": 0
|
|
167
|
+
},
|
|
168
|
+
"contextWindow": 1000000,
|
|
169
|
+
"maxTokens": 65536
|
|
132
170
|
},
|
|
133
171
|
{
|
|
134
172
|
"id": "glm-5",
|
|
135
173
|
"name": "glm-5",
|
|
136
|
-
"reasoning":
|
|
174
|
+
"reasoning": false,
|
|
137
175
|
"input": ["text"],
|
|
138
|
-
"cost": {
|
|
176
|
+
"cost": {
|
|
177
|
+
"input": 0,
|
|
178
|
+
"output": 0,
|
|
179
|
+
"cacheRead": 0,
|
|
180
|
+
"cacheWrite": 0
|
|
181
|
+
},
|
|
139
182
|
"contextWindow": 202752,
|
|
140
|
-
"maxTokens":
|
|
183
|
+
"maxTokens": 65536
|
|
141
184
|
},
|
|
142
185
|
{
|
|
143
|
-
"id": "
|
|
144
|
-
"name": "
|
|
145
|
-
"reasoning":
|
|
186
|
+
"id": "glm-4.7",
|
|
187
|
+
"name": "glm-4.7",
|
|
188
|
+
"reasoning": false,
|
|
146
189
|
"input": ["text"],
|
|
147
|
-
"cost": {
|
|
148
|
-
|
|
149
|
-
|
|
190
|
+
"cost": {
|
|
191
|
+
"input": 0,
|
|
192
|
+
"output": 0,
|
|
193
|
+
"cacheRead": 0,
|
|
194
|
+
"cacheWrite": 0
|
|
195
|
+
},
|
|
196
|
+
"contextWindow": 202752,
|
|
197
|
+
"maxTokens": 65536
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"id": "kimi-k2.5",
|
|
201
|
+
"name": "kimi-k2.5",
|
|
202
|
+
"reasoning": false,
|
|
203
|
+
"input": ["text", "image"],
|
|
204
|
+
"cost": {
|
|
205
|
+
"input": 0,
|
|
206
|
+
"output": 0,
|
|
207
|
+
"cacheRead": 0,
|
|
208
|
+
"cacheWrite": 0
|
|
209
|
+
},
|
|
210
|
+
"contextWindow": 262144,
|
|
211
|
+
"maxTokens": 65536
|
|
150
212
|
}
|
|
151
213
|
]
|
|
152
214
|
}
|
|
153
|
-
},
|
|
154
|
-
"discovery": {
|
|
155
|
-
"qwen": "runtime",
|
|
156
|
-
"qwen-token-plan": "refreshable"
|
|
157
215
|
}
|
|
158
216
|
},
|
|
159
217
|
"contracts": {
|
|
@@ -164,8 +222,8 @@
|
|
|
164
222
|
"qwen": {
|
|
165
223
|
"capabilities": ["image", "video"],
|
|
166
224
|
"defaultModels": {
|
|
167
|
-
"image": "
|
|
168
|
-
"video": "
|
|
225
|
+
"image": "qwen-vl-max-latest",
|
|
226
|
+
"video": "qwen-vl-max-latest"
|
|
169
227
|
},
|
|
170
228
|
"autoPriority": {
|
|
171
229
|
"video": 15
|
|
@@ -179,8 +237,8 @@
|
|
|
179
237
|
"envVars": ["QWEN_API_KEY", "MODELSTUDIO_API_KEY", "DASHSCOPE_API_KEY"]
|
|
180
238
|
},
|
|
181
239
|
{
|
|
182
|
-
"id": "qwen-
|
|
183
|
-
"envVars": ["
|
|
240
|
+
"id": "qwen-oauth",
|
|
241
|
+
"envVars": ["QWEN_API_KEY"]
|
|
184
242
|
}
|
|
185
243
|
]
|
|
186
244
|
},
|
|
@@ -250,34 +308,19 @@
|
|
|
250
308
|
"cliDescription": "Qwen Cloud Coding Plan API key (Global/Intl)"
|
|
251
309
|
},
|
|
252
310
|
{
|
|
253
|
-
"provider": "qwen-
|
|
311
|
+
"provider": "qwen-oauth",
|
|
254
312
|
"method": "api-key",
|
|
255
|
-
"choiceId": "qwen-
|
|
256
|
-
"appGuidedSecret": true,
|
|
257
|
-
"choiceLabel": "Qwen Token Plan (Global/Intl)",
|
|
258
|
-
"choiceHint": "Endpoint: token-plan.ap-southeast-1.maas.aliyuncs.com",
|
|
259
|
-
"groupId": "qwen",
|
|
260
|
-
"groupLabel": "Qwen Cloud",
|
|
261
|
-
"groupHint": "Standard / Coding Plan / Token Plan",
|
|
262
|
-
"optionKey": "qwenTokenPlanApiKey",
|
|
263
|
-
"cliFlag": "--qwen-token-plan-api-key",
|
|
264
|
-
"cliOption": "--qwen-token-plan-api-key <key>",
|
|
265
|
-
"cliDescription": "Qwen Token Plan API key (Global/Intl)"
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
"provider": "qwen-token-plan",
|
|
269
|
-
"method": "api-key-cn",
|
|
270
|
-
"choiceId": "qwen-token-plan-cn",
|
|
313
|
+
"choiceId": "qwen-oauth",
|
|
271
314
|
"appGuidedSecret": true,
|
|
272
|
-
"choiceLabel": "Qwen
|
|
273
|
-
"choiceHint": "
|
|
315
|
+
"choiceLabel": "Qwen OAuth",
|
|
316
|
+
"choiceHint": "Portal token for portal.qwen.ai",
|
|
274
317
|
"groupId": "qwen",
|
|
275
318
|
"groupLabel": "Qwen Cloud",
|
|
276
|
-
"groupHint": "Standard / Coding Plan /
|
|
277
|
-
"optionKey": "
|
|
278
|
-
"cliFlag": "--qwen-token
|
|
279
|
-
"cliOption": "--qwen-token
|
|
280
|
-
"cliDescription": "Qwen
|
|
319
|
+
"groupHint": "Standard / Coding Plan / OAuth",
|
|
320
|
+
"optionKey": "qwenOauthToken",
|
|
321
|
+
"cliFlag": "--qwen-oauth-token",
|
|
322
|
+
"cliOption": "--qwen-oauth-token <token>",
|
|
323
|
+
"cliDescription": "Qwen OAuth token"
|
|
281
324
|
}
|
|
282
325
|
],
|
|
283
326
|
"configSchema": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/qwen-provider",
|
|
3
|
-
"version": "2026.7.
|
|
3
|
+
"version": "2026.7.34",
|
|
4
4
|
"description": "OpenClaw Qwen Cloud provider plugin.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"minHostVersion": ">=2026.6.8"
|
|
19
19
|
},
|
|
20
20
|
"compat": {
|
|
21
|
-
"pluginApi": ">=2026.7.
|
|
21
|
+
"pluginApi": ">=2026.7.34"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.7.
|
|
24
|
+
"openclawVersion": "2026.7.34",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"README.md"
|
|
39
39
|
],
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"openclaw": ">=2026.7.
|
|
41
|
+
"openclaw": ">=2026.7.34"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"openclaw": {
|