@openclaw/qwen-provider 2026.7.2-beta.2 → 2026.7.2-beta.3
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 +4 -52
- package/dist/media-understanding-provider.js +4 -4
- package/dist/models.js +1 -12
- package/dist/onboard.js +3 -22
- package/dist/provider-catalog.js +2 -9
- package/dist/stream.js +2 -37
- package/npm-shrinkwrap.json +2 -2
- package/openclaw.plugin.json +4 -183
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import { QWEN_DEFAULT_MODEL_REF,
|
|
2
|
-
import {
|
|
1
|
+
import { QWEN_DEFAULT_MODEL_REF, QWEN_TOKEN_PLAN_DEFAULT_MODEL_REF, QWEN_TOKEN_PLAN_LEGACY_PROVIDER_ID, QWEN_TOKEN_PLAN_PROVIDER_ID, applyQwenNativeStreamingUsageCompat, isQwenCodingPlanBaseUrl, isQwenStandardOnlyModelId, isQwenTokenPlanDeepSeekV4ModelId, isQwenTokenPlanGlmModelId, isQwenTokenPlanThinkingOnlyModelId, supportsQwenTokenPlanGlmMaxThinking } from "./models.js";
|
|
2
|
+
import { buildQwenProvider, buildQwenTokenPlanProvider } 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,
|
|
6
|
+
import { applyQwenConfig, applyQwenConfigCn, applyQwenStandardConfig, applyQwenStandardConfigCn, applyQwenTokenPlanConfig } 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
9
|
import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
|
|
10
10
|
//#region extensions/qwen/index.ts
|
|
11
11
|
const PROVIDER_ID = "qwen";
|
|
12
12
|
const LEGACY_PROVIDER_ID = "modelstudio";
|
|
13
|
-
const QWEN_OAUTH_AUTH_PROVIDER_IDS = [
|
|
14
|
-
QWEN_OAUTH_PROVIDER_ID,
|
|
15
|
-
"qwen-portal",
|
|
16
|
-
"qwen-cli"
|
|
17
|
-
];
|
|
18
13
|
const QWEN_TOKEN_PLAN_THINKING_LEVEL_IDS = [
|
|
19
14
|
"off",
|
|
20
15
|
"minimal",
|
|
@@ -68,7 +63,7 @@ function createQwenTokenPlanAuthMethod(region) {
|
|
|
68
63
|
choiceHint: `Endpoint: ${host}`,
|
|
69
64
|
groupId: "qwen",
|
|
70
65
|
groupLabel: "Qwen Cloud",
|
|
71
|
-
groupHint: "Standard / Coding Plan / Token Plan
|
|
66
|
+
groupHint: "Standard / Coding Plan / Token Plan"
|
|
72
67
|
}
|
|
73
68
|
});
|
|
74
69
|
}
|
|
@@ -212,49 +207,6 @@ var qwen_default = defineSingleProviderPluginEntry({
|
|
|
212
207
|
}
|
|
213
208
|
},
|
|
214
209
|
register(api) {
|
|
215
|
-
api.registerProvider({
|
|
216
|
-
id: QWEN_OAUTH_PROVIDER_ID,
|
|
217
|
-
label: "Qwen OAuth",
|
|
218
|
-
docsPath: "/providers/qwen",
|
|
219
|
-
aliases: ["qwen-portal", "qwen-cli"],
|
|
220
|
-
envVars: ["QWEN_API_KEY"],
|
|
221
|
-
auth: [createProviderApiKeyAuthMethod({
|
|
222
|
-
providerId: QWEN_OAUTH_PROVIDER_ID,
|
|
223
|
-
methodId: "api-key",
|
|
224
|
-
label: "Qwen OAuth token",
|
|
225
|
-
hint: "Portal token for portal.qwen.ai",
|
|
226
|
-
optionKey: "qwenOauthToken",
|
|
227
|
-
flagName: "--qwen-oauth-token",
|
|
228
|
-
envVar: "QWEN_API_KEY",
|
|
229
|
-
promptMessage: "Enter Qwen OAuth token",
|
|
230
|
-
defaultModel: QWEN_OAUTH_DEFAULT_MODEL_REF,
|
|
231
|
-
applyConfig: (cfg) => applyQwenOAuthConfig(cfg),
|
|
232
|
-
wizard: {
|
|
233
|
-
choiceId: QWEN_OAUTH_PROVIDER_ID,
|
|
234
|
-
choiceLabel: "Qwen OAuth",
|
|
235
|
-
choiceHint: "Portal token for portal.qwen.ai",
|
|
236
|
-
groupId: "qwen",
|
|
237
|
-
groupLabel: "Qwen Cloud",
|
|
238
|
-
groupHint: "Standard / Coding Plan / OAuth"
|
|
239
|
-
}
|
|
240
|
-
})],
|
|
241
|
-
catalog: {
|
|
242
|
-
order: "simple",
|
|
243
|
-
run: async (ctx) => {
|
|
244
|
-
const apiKey = QWEN_OAUTH_AUTH_PROVIDER_IDS.map((providerId) => ctx.resolveProviderApiKey(providerId).apiKey).find((candidate) => typeof candidate === "string" && candidate.length > 0);
|
|
245
|
-
if (!apiKey) return null;
|
|
246
|
-
return { provider: {
|
|
247
|
-
...buildQwenOAuthProvider(),
|
|
248
|
-
apiKey
|
|
249
|
-
} };
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
|
-
staticCatalog: {
|
|
253
|
-
order: "simple",
|
|
254
|
-
run: async () => ({ provider: buildQwenOAuthProvider() })
|
|
255
|
-
},
|
|
256
|
-
wrapStreamFn: wrapQwenProviderStream
|
|
257
|
-
});
|
|
258
210
|
api.registerProvider({
|
|
259
211
|
id: QWEN_TOKEN_PLAN_PROVIDER_ID,
|
|
260
212
|
label: "Qwen Token Plan",
|
|
@@ -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_MEDIA_MODEL = "qwen3.6-plus";
|
|
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_MEDIA_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({
|
|
@@ -54,8 +54,8 @@ function buildQwenMediaUnderstandingProvider() {
|
|
|
54
54
|
id: "qwen",
|
|
55
55
|
capabilities: ["image", "video"],
|
|
56
56
|
defaultModels: {
|
|
57
|
-
image:
|
|
58
|
-
video:
|
|
57
|
+
image: DEFAULT_QWEN_MEDIA_MODEL,
|
|
58
|
+
video: DEFAULT_QWEN_MEDIA_MODEL
|
|
59
59
|
},
|
|
60
60
|
autoPriority: { video: 15 },
|
|
61
61
|
describeImage: describeImageWithModel,
|
package/dist/models.js
CHANGED
|
@@ -5,8 +5,6 @@ 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 QWEN_OAUTH_PROVIDER_ID = "qwen-oauth";
|
|
9
|
-
const QWEN_OAUTH_BASE_URL = "https://portal.qwen.ai/v1";
|
|
10
8
|
const QWEN_TOKEN_PLAN_PROVIDER_ID = "qwen-token-plan";
|
|
11
9
|
const QWEN_TOKEN_PLAN_LEGACY_PROVIDER_ID = "bailian-token-plan";
|
|
12
10
|
const QWEN_TOKEN_PLAN_GLOBAL_BASE_URL = "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1";
|
|
@@ -23,7 +21,6 @@ const QWEN_DEFAULT_COST = {
|
|
|
23
21
|
cacheWrite: 0
|
|
24
22
|
};
|
|
25
23
|
const QWEN_DEFAULT_MODEL_REF = `qwen/${QWEN_DEFAULT_MODEL_ID}`;
|
|
26
|
-
const QWEN_OAUTH_DEFAULT_MODEL_REF = `qwen-oauth/${QWEN_DEFAULT_MODEL_ID}`;
|
|
27
24
|
const QWEN_TOKEN_PLAN_DEFAULT_MODEL_ID = QWEN_37_PLUS_MODEL_ID;
|
|
28
25
|
const QWEN_TOKEN_PLAN_DEFAULT_MODEL_REF = `${QWEN_TOKEN_PLAN_PROVIDER_ID}/${QWEN_TOKEN_PLAN_DEFAULT_MODEL_ID}`;
|
|
29
26
|
const QWEN_TOKEN_PLAN_THINKING_ONLY_MODEL_IDS = /* @__PURE__ */ new Set(["kimi-k2.7-code", "minimax-m2.5"]);
|
|
@@ -316,11 +313,6 @@ function isQwen36PlusSupportedBaseUrl(_baseUrl) {
|
|
|
316
313
|
return true;
|
|
317
314
|
}
|
|
318
315
|
const QWEN_STANDARD_ONLY_MODEL_IDS = /* @__PURE__ */ new Set([QWEN_36_FLASH_MODEL_ID, QWEN_37_MAX_MODEL_ID]);
|
|
319
|
-
const QWEN_OAUTH_UNSUPPORTED_MODEL_IDS = /* @__PURE__ */ new Set([
|
|
320
|
-
QWEN_36_FLASH_MODEL_ID,
|
|
321
|
-
QWEN_37_MAX_MODEL_ID,
|
|
322
|
-
QWEN_37_PLUS_MODEL_ID
|
|
323
|
-
]);
|
|
324
316
|
function isQwenStandardOnlyModelId(modelId) {
|
|
325
317
|
return QWEN_STANDARD_ONLY_MODEL_IDS.has(modelId);
|
|
326
318
|
}
|
|
@@ -354,9 +346,6 @@ function buildQwenModelDefinition(params) {
|
|
|
354
346
|
function buildQwenDefaultModelDefinition() {
|
|
355
347
|
return buildQwenModelDefinition({ id: QWEN_DEFAULT_MODEL_ID });
|
|
356
348
|
}
|
|
357
|
-
function buildQwenOAuthModelCatalog() {
|
|
358
|
-
return QWEN_MODEL_CATALOG.filter((model) => !QWEN_OAUTH_UNSUPPORTED_MODEL_IDS.has(model.id)).map((model) => Object.assign({}, model, { maxTokens: 65536 }));
|
|
359
|
-
}
|
|
360
349
|
/** @deprecated Use QWEN_BASE_URL. */
|
|
361
350
|
const MODELSTUDIO_BASE_URL = QWEN_BASE_URL;
|
|
362
351
|
/** @deprecated Use QWEN_GLOBAL_BASE_URL. */
|
|
@@ -380,4 +369,4 @@ const applyModelStudioNativeStreamingUsageCompat = applyQwenNativeStreamingUsage
|
|
|
380
369
|
const buildModelStudioModelDefinition = buildQwenModelDefinition;
|
|
381
370
|
const buildModelStudioDefaultModelDefinition = buildQwenDefaultModelDefinition;
|
|
382
371
|
//#endregion
|
|
383
|
-
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_FLASH_MODEL_ID, QWEN_36_PLUS_MODEL_ID, QWEN_37_MAX_MODEL_ID, QWEN_37_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,
|
|
372
|
+
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_FLASH_MODEL_ID, QWEN_36_PLUS_MODEL_ID, QWEN_37_MAX_MODEL_ID, QWEN_37_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, QWEN_TOKEN_PLAN_CN_BASE_URL, QWEN_TOKEN_PLAN_DEFAULT_MODEL_ID, QWEN_TOKEN_PLAN_DEFAULT_MODEL_REF, QWEN_TOKEN_PLAN_GLOBAL_BASE_URL, QWEN_TOKEN_PLAN_LEGACY_PROVIDER_ID, QWEN_TOKEN_PLAN_MODEL_CATALOG, QWEN_TOKEN_PLAN_PROVIDER_ID, applyModelStudioNativeStreamingUsageCompat, applyQwenNativeStreamingUsageCompat, buildModelStudioDefaultModelDefinition, buildModelStudioModelDefinition, buildQwenDefaultModelDefinition, buildQwenModelCatalogForBaseUrl, buildQwenModelDefinition, isNativeModelStudioBaseUrl, isNativeQwenBaseUrl, isQwen36PlusSupportedBaseUrl, isQwenCodingPlanBaseUrl, isQwenStandardOnlyModelId, isQwenTokenPlanDeepSeekV4ModelId, isQwenTokenPlanGlmModelId, isQwenTokenPlanKimiModelId, isQwenTokenPlanModelId, isQwenTokenPlanThinkingOnlyModelId, resolveQwenTokenPlanBaseUrl, supportsQwenTokenPlanGlmMaxThinking };
|
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_STANDARD_CN_BASE_URL, QWEN_STANDARD_GLOBAL_BASE_URL, QWEN_TOKEN_PLAN_DEFAULT_MODEL_REF, QWEN_TOKEN_PLAN_PROVIDER_ID, resolveQwenTokenPlanBaseUrl } from "./models.js";
|
|
2
|
+
import { buildQwenProvider, buildQwenTokenPlanProvider } 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,22 +18,6 @@ const qwenPresetAppliers = createModelCatalogPresetAppliers({
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
|
-
const qwenOAuthPresetAppliers = createModelCatalogPresetAppliers({
|
|
22
|
-
primaryModelRef: QWEN_OAUTH_DEFAULT_MODEL_REF,
|
|
23
|
-
resolveParams: () => {
|
|
24
|
-
const provider = buildQwenOAuthProvider();
|
|
25
|
-
return {
|
|
26
|
-
providerId: QWEN_OAUTH_PROVIDER_ID,
|
|
27
|
-
api: provider.api ?? "openai-completions",
|
|
28
|
-
baseUrl: provider.baseUrl,
|
|
29
|
-
catalogModels: provider.models ?? [],
|
|
30
|
-
aliases: [...(provider.models ?? []).map((model) => `qwen-oauth/${model.id}`), {
|
|
31
|
-
modelRef: QWEN_OAUTH_DEFAULT_MODEL_REF,
|
|
32
|
-
alias: "Qwen OAuth"
|
|
33
|
-
}]
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
21
|
const qwenTokenPlanPresetAppliers = createModelCatalogPresetAppliers({
|
|
38
22
|
primaryModelRef: QWEN_TOKEN_PLAN_DEFAULT_MODEL_REF,
|
|
39
23
|
resolveParams: (_cfg, baseUrl) => {
|
|
@@ -62,11 +46,8 @@ function applyQwenStandardConfig(cfg) {
|
|
|
62
46
|
function applyQwenStandardConfigCn(cfg) {
|
|
63
47
|
return qwenPresetAppliers.applyConfig(cfg, QWEN_STANDARD_CN_BASE_URL);
|
|
64
48
|
}
|
|
65
|
-
function applyQwenOAuthConfig(cfg) {
|
|
66
|
-
return qwenOAuthPresetAppliers.applyConfig(cfg);
|
|
67
|
-
}
|
|
68
49
|
function applyQwenTokenPlanConfig(cfg, region) {
|
|
69
50
|
return qwenTokenPlanPresetAppliers.applyConfig(cfg, resolveQwenTokenPlanBaseUrl(region));
|
|
70
51
|
}
|
|
71
52
|
//#endregion
|
|
72
|
-
export { applyQwenConfig, applyQwenConfigCn,
|
|
53
|
+
export { applyQwenConfig, applyQwenConfigCn, applyQwenStandardConfig, applyQwenStandardConfigCn, applyQwenTokenPlanConfig };
|
package/dist/provider-catalog.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QWEN_TOKEN_PLAN_MODEL_CATALOG, buildQwenModelCatalogForBaseUrl } 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,6 @@ function buildQwenProvider(params) {
|
|
|
8
8
|
models: buildQwenModelCatalogForBaseUrl(baseUrl).map((model) => Object.assign({}, model))
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
function buildQwenOAuthProvider() {
|
|
12
|
-
return {
|
|
13
|
-
baseUrl: QWEN_OAUTH_BASE_URL,
|
|
14
|
-
api: "openai-completions",
|
|
15
|
-
models: buildQwenOAuthModelCatalog().map((model) => Object.assign({}, model))
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
11
|
function buildQwenTokenPlanProvider(params) {
|
|
19
12
|
return {
|
|
20
13
|
baseUrl: params?.baseUrl ?? "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
|
|
@@ -24,4 +17,4 @@ function buildQwenTokenPlanProvider(params) {
|
|
|
24
17
|
}
|
|
25
18
|
const buildModelStudioProvider = buildQwenProvider;
|
|
26
19
|
//#endregion
|
|
27
|
-
export { buildModelStudioProvider,
|
|
20
|
+
export { buildModelStudioProvider, buildQwenProvider, buildQwenTokenPlanProvider };
|
package/dist/stream.js
CHANGED
|
@@ -25,7 +25,7 @@ function resolveQwenThinkingLevel(thinkingLevel, options) {
|
|
|
25
25
|
}
|
|
26
26
|
function isQwenProviderId(providerId) {
|
|
27
27
|
const normalized = normalizeProviderId(providerId);
|
|
28
|
-
return normalized === "qwen" || normalized === "qwen-
|
|
28
|
+
return normalized === "qwen" || normalized === "qwen-token-plan" || normalized === "bailian-token-plan" || normalized === "modelstudio" || normalized === "qwencloud" || normalized === "dashscope";
|
|
29
29
|
}
|
|
30
30
|
function isQwenTokenPlanProviderId(providerId) {
|
|
31
31
|
const normalized = normalizeProviderId(providerId);
|
|
@@ -149,38 +149,6 @@ function patchTokenPlanGlmPayload(payload, thinkingLevel, enableThinking, suppor
|
|
|
149
149
|
default: delete payload.reasoning_effort;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
function isQwenOAuthProviderId(providerId) {
|
|
153
|
-
const normalized = normalizeProviderId(providerId);
|
|
154
|
-
return normalized === "qwen-oauth" || normalized === "qwen-portal" || normalized === "qwen-cli";
|
|
155
|
-
}
|
|
156
|
-
function normalizeQwenOAuthContent(content) {
|
|
157
|
-
if (typeof content === "string") return [{
|
|
158
|
-
type: "text",
|
|
159
|
-
text: content
|
|
160
|
-
}];
|
|
161
|
-
if (!Array.isArray(content)) return content;
|
|
162
|
-
const normalized = content.map((part) => {
|
|
163
|
-
if (typeof part === "string") return {
|
|
164
|
-
type: "text",
|
|
165
|
-
text: part
|
|
166
|
-
};
|
|
167
|
-
return part && typeof part === "object" ? part : void 0;
|
|
168
|
-
}).filter((part) => Boolean(part));
|
|
169
|
-
return normalized.length > 0 ? normalized : content;
|
|
170
|
-
}
|
|
171
|
-
function patchQwenOAuthPayload(payload) {
|
|
172
|
-
const messages = payload.messages;
|
|
173
|
-
if (!Array.isArray(messages)) return;
|
|
174
|
-
for (const message of messages) {
|
|
175
|
-
if (!message || typeof message !== "object") continue;
|
|
176
|
-
const record = message;
|
|
177
|
-
record.content = normalizeQwenOAuthContent(record.content);
|
|
178
|
-
if (record.role !== "system" || !Array.isArray(record.content) || record.content.length === 0) continue;
|
|
179
|
-
const last = record.content[record.content.length - 1];
|
|
180
|
-
if (last && typeof last === "object") last.cache_control = { type: "ephemeral" };
|
|
181
|
-
}
|
|
182
|
-
payload.vl_high_resolution_images = true;
|
|
183
|
-
}
|
|
184
152
|
function readQwenThinkingFormatFromModel(model) {
|
|
185
153
|
if (model.api !== "openai-completions") return;
|
|
186
154
|
const compat = model.compat && typeof model.compat === "object" ? model.compat : void 0;
|
|
@@ -215,10 +183,7 @@ function wrapQwenProviderStream(ctx) {
|
|
|
215
183
|
const forceThinking = tokenPlanModel && isQwenTokenPlanThinkingOnlyModelId(ctx.modelId);
|
|
216
184
|
let streamFn = createQwenThinkingWrapper(ctx.streamFn, ctx.thinkingLevel, thinkingFormat, forceThinking, tokenPlanContract);
|
|
217
185
|
if (tokenPlanModel) streamFn = createQwenTokenPlanConstraintWrapper(streamFn, tokenPlanContract, forceThinking, ctx.thinkingLevel);
|
|
218
|
-
|
|
219
|
-
return createPayloadPatchStreamWrapper(streamFn, ({ payload, model }) => {
|
|
220
|
-
if (model.api === "openai-completions") patchQwenOAuthPayload(payload);
|
|
221
|
-
});
|
|
186
|
+
return streamFn;
|
|
222
187
|
}
|
|
223
188
|
//#endregion
|
|
224
189
|
export { createQwenThinkingWrapper, wrapQwenProviderStream };
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/qwen-provider",
|
|
3
|
-
"version": "2026.7.2-beta.
|
|
3
|
+
"version": "2026.7.2-beta.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/qwen-provider",
|
|
9
|
-
"version": "2026.7.2-beta.
|
|
9
|
+
"version": "2026.7.2-beta.3"
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
}
|
package/openclaw.plugin.json
CHANGED
|
@@ -10,16 +10,9 @@
|
|
|
10
10
|
"qwencloud",
|
|
11
11
|
"modelstudio",
|
|
12
12
|
"dashscope",
|
|
13
|
-
"qwen-oauth",
|
|
14
|
-
"qwen-portal",
|
|
15
|
-
"qwen-cli",
|
|
16
13
|
"qwen-token-plan",
|
|
17
14
|
"bailian-token-plan"
|
|
18
15
|
],
|
|
19
|
-
"providerAuthAliases": {
|
|
20
|
-
"qwen-portal": "qwen-oauth",
|
|
21
|
-
"qwen-cli": "qwen-oauth"
|
|
22
|
-
},
|
|
23
16
|
"providerEndpoints": [
|
|
24
17
|
{
|
|
25
18
|
"endpointClass": "modelstudio-native",
|
|
@@ -31,10 +24,6 @@
|
|
|
31
24
|
"https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
|
|
32
25
|
"https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1"
|
|
33
26
|
]
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"endpointClass": "qwen-portal-native",
|
|
37
|
-
"baseUrls": ["https://portal.qwen.ai/v1"]
|
|
38
27
|
}
|
|
39
28
|
],
|
|
40
29
|
"providerRequest": {
|
|
@@ -51,15 +40,6 @@
|
|
|
51
40
|
"dashscope": {
|
|
52
41
|
"family": "modelstudio"
|
|
53
42
|
},
|
|
54
|
-
"qwen-oauth": {
|
|
55
|
-
"family": "qwen-portal"
|
|
56
|
-
},
|
|
57
|
-
"qwen-portal": {
|
|
58
|
-
"family": "qwen-portal"
|
|
59
|
-
},
|
|
60
|
-
"qwen-cli": {
|
|
61
|
-
"family": "qwen-portal"
|
|
62
|
-
},
|
|
63
43
|
"qwen-token-plan": {
|
|
64
44
|
"family": "modelstudio"
|
|
65
45
|
},
|
|
@@ -69,14 +49,6 @@
|
|
|
69
49
|
}
|
|
70
50
|
},
|
|
71
51
|
"modelCatalog": {
|
|
72
|
-
"aliases": {
|
|
73
|
-
"qwen-portal": {
|
|
74
|
-
"provider": "qwen-oauth"
|
|
75
|
-
},
|
|
76
|
-
"qwen-cli": {
|
|
77
|
-
"provider": "qwen-oauth"
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
52
|
"suppressions": [
|
|
81
53
|
{
|
|
82
54
|
"provider": "qwen",
|
|
@@ -116,138 +88,6 @@
|
|
|
116
88
|
}
|
|
117
89
|
],
|
|
118
90
|
"providers": {
|
|
119
|
-
"qwen-oauth": {
|
|
120
|
-
"baseUrl": "https://portal.qwen.ai/v1",
|
|
121
|
-
"api": "openai-completions",
|
|
122
|
-
"models": [
|
|
123
|
-
{
|
|
124
|
-
"id": "qwen3.5-plus",
|
|
125
|
-
"name": "qwen3.5-plus",
|
|
126
|
-
"reasoning": false,
|
|
127
|
-
"input": ["text", "image"],
|
|
128
|
-
"cost": {
|
|
129
|
-
"input": 0,
|
|
130
|
-
"output": 0,
|
|
131
|
-
"cacheRead": 0,
|
|
132
|
-
"cacheWrite": 0
|
|
133
|
-
},
|
|
134
|
-
"contextWindow": 1000000,
|
|
135
|
-
"maxTokens": 65536
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
"id": "qwen3.6-plus",
|
|
139
|
-
"name": "qwen3.6-plus",
|
|
140
|
-
"reasoning": true,
|
|
141
|
-
"input": ["text", "image"],
|
|
142
|
-
"cost": {
|
|
143
|
-
"input": 0,
|
|
144
|
-
"output": 0,
|
|
145
|
-
"cacheRead": 0,
|
|
146
|
-
"cacheWrite": 0
|
|
147
|
-
},
|
|
148
|
-
"contextWindow": 1000000,
|
|
149
|
-
"maxTokens": 65536
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
"id": "qwen3-max-2026-01-23",
|
|
153
|
-
"name": "qwen3-max-2026-01-23",
|
|
154
|
-
"reasoning": false,
|
|
155
|
-
"input": ["text"],
|
|
156
|
-
"cost": {
|
|
157
|
-
"input": 0,
|
|
158
|
-
"output": 0,
|
|
159
|
-
"cacheRead": 0,
|
|
160
|
-
"cacheWrite": 0
|
|
161
|
-
},
|
|
162
|
-
"contextWindow": 262144,
|
|
163
|
-
"maxTokens": 65536
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
"id": "qwen3-coder-next",
|
|
167
|
-
"name": "qwen3-coder-next",
|
|
168
|
-
"reasoning": false,
|
|
169
|
-
"input": ["text"],
|
|
170
|
-
"cost": {
|
|
171
|
-
"input": 0,
|
|
172
|
-
"output": 0,
|
|
173
|
-
"cacheRead": 0,
|
|
174
|
-
"cacheWrite": 0
|
|
175
|
-
},
|
|
176
|
-
"contextWindow": 262144,
|
|
177
|
-
"maxTokens": 65536
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
"id": "qwen3-coder-plus",
|
|
181
|
-
"name": "qwen3-coder-plus",
|
|
182
|
-
"reasoning": false,
|
|
183
|
-
"input": ["text"],
|
|
184
|
-
"cost": {
|
|
185
|
-
"input": 0,
|
|
186
|
-
"output": 0,
|
|
187
|
-
"cacheRead": 0,
|
|
188
|
-
"cacheWrite": 0
|
|
189
|
-
},
|
|
190
|
-
"contextWindow": 1000000,
|
|
191
|
-
"maxTokens": 65536
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
"id": "MiniMax-M2.5",
|
|
195
|
-
"name": "MiniMax-M2.5",
|
|
196
|
-
"reasoning": true,
|
|
197
|
-
"input": ["text"],
|
|
198
|
-
"cost": {
|
|
199
|
-
"input": 0,
|
|
200
|
-
"output": 0,
|
|
201
|
-
"cacheRead": 0,
|
|
202
|
-
"cacheWrite": 0
|
|
203
|
-
},
|
|
204
|
-
"contextWindow": 1000000,
|
|
205
|
-
"maxTokens": 65536
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
"id": "glm-5",
|
|
209
|
-
"name": "glm-5",
|
|
210
|
-
"reasoning": false,
|
|
211
|
-
"input": ["text"],
|
|
212
|
-
"cost": {
|
|
213
|
-
"input": 0,
|
|
214
|
-
"output": 0,
|
|
215
|
-
"cacheRead": 0,
|
|
216
|
-
"cacheWrite": 0
|
|
217
|
-
},
|
|
218
|
-
"contextWindow": 202752,
|
|
219
|
-
"maxTokens": 65536
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
"id": "glm-4.7",
|
|
223
|
-
"name": "glm-4.7",
|
|
224
|
-
"reasoning": false,
|
|
225
|
-
"input": ["text"],
|
|
226
|
-
"cost": {
|
|
227
|
-
"input": 0,
|
|
228
|
-
"output": 0,
|
|
229
|
-
"cacheRead": 0,
|
|
230
|
-
"cacheWrite": 0
|
|
231
|
-
},
|
|
232
|
-
"contextWindow": 202752,
|
|
233
|
-
"maxTokens": 65536
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
"id": "kimi-k2.5",
|
|
237
|
-
"name": "kimi-k2.5",
|
|
238
|
-
"reasoning": false,
|
|
239
|
-
"input": ["text", "image"],
|
|
240
|
-
"cost": {
|
|
241
|
-
"input": 0,
|
|
242
|
-
"output": 0,
|
|
243
|
-
"cacheRead": 0,
|
|
244
|
-
"cacheWrite": 0
|
|
245
|
-
},
|
|
246
|
-
"contextWindow": 262144,
|
|
247
|
-
"maxTokens": 65536
|
|
248
|
-
}
|
|
249
|
-
]
|
|
250
|
-
},
|
|
251
91
|
"qwen-token-plan": {
|
|
252
92
|
"baseUrl": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
|
|
253
93
|
"api": "openai-completions",
|
|
@@ -393,8 +233,8 @@
|
|
|
393
233
|
"qwen": {
|
|
394
234
|
"capabilities": ["image", "video"],
|
|
395
235
|
"defaultModels": {
|
|
396
|
-
"image": "
|
|
397
|
-
"video": "
|
|
236
|
+
"image": "qwen3.6-plus",
|
|
237
|
+
"video": "qwen3.6-plus"
|
|
398
238
|
},
|
|
399
239
|
"autoPriority": {
|
|
400
240
|
"video": 15
|
|
@@ -407,10 +247,6 @@
|
|
|
407
247
|
"id": "qwen",
|
|
408
248
|
"envVars": ["QWEN_API_KEY", "MODELSTUDIO_API_KEY", "DASHSCOPE_API_KEY"]
|
|
409
249
|
},
|
|
410
|
-
{
|
|
411
|
-
"id": "qwen-oauth",
|
|
412
|
-
"envVars": ["QWEN_API_KEY"]
|
|
413
|
-
},
|
|
414
250
|
{
|
|
415
251
|
"id": "qwen-token-plan",
|
|
416
252
|
"envVars": ["QWEN_TOKEN_PLAN_API_KEY"]
|
|
@@ -482,21 +318,6 @@
|
|
|
482
318
|
"cliOption": "--modelstudio-api-key <key>",
|
|
483
319
|
"cliDescription": "Qwen Cloud Coding Plan API key (Global/Intl)"
|
|
484
320
|
},
|
|
485
|
-
{
|
|
486
|
-
"provider": "qwen-oauth",
|
|
487
|
-
"method": "api-key",
|
|
488
|
-
"choiceId": "qwen-oauth",
|
|
489
|
-
"appGuidedSecret": true,
|
|
490
|
-
"choiceLabel": "Qwen OAuth",
|
|
491
|
-
"choiceHint": "Portal token for portal.qwen.ai",
|
|
492
|
-
"groupId": "qwen",
|
|
493
|
-
"groupLabel": "Qwen Cloud",
|
|
494
|
-
"groupHint": "Standard / Coding Plan / OAuth",
|
|
495
|
-
"optionKey": "qwenOauthToken",
|
|
496
|
-
"cliFlag": "--qwen-oauth-token",
|
|
497
|
-
"cliOption": "--qwen-oauth-token <token>",
|
|
498
|
-
"cliDescription": "Qwen OAuth token"
|
|
499
|
-
},
|
|
500
321
|
{
|
|
501
322
|
"provider": "qwen-token-plan",
|
|
502
323
|
"method": "api-key",
|
|
@@ -506,7 +327,7 @@
|
|
|
506
327
|
"choiceHint": "Endpoint: token-plan.ap-southeast-1.maas.aliyuncs.com",
|
|
507
328
|
"groupId": "qwen",
|
|
508
329
|
"groupLabel": "Qwen Cloud",
|
|
509
|
-
"groupHint": "Standard / Coding Plan / Token Plan
|
|
330
|
+
"groupHint": "Standard / Coding Plan / Token Plan",
|
|
510
331
|
"optionKey": "qwenTokenPlanApiKey",
|
|
511
332
|
"cliFlag": "--qwen-token-plan-api-key",
|
|
512
333
|
"cliOption": "--qwen-token-plan-api-key <key>",
|
|
@@ -521,7 +342,7 @@
|
|
|
521
342
|
"choiceHint": "Endpoint: token-plan.cn-beijing.maas.aliyuncs.com",
|
|
522
343
|
"groupId": "qwen",
|
|
523
344
|
"groupLabel": "Qwen Cloud",
|
|
524
|
-
"groupHint": "Standard / Coding Plan / Token Plan
|
|
345
|
+
"groupHint": "Standard / Coding Plan / Token Plan",
|
|
525
346
|
"optionKey": "qwenTokenPlanApiKeyCn",
|
|
526
347
|
"cliFlag": "--qwen-token-plan-api-key-cn",
|
|
527
348
|
"cliOption": "--qwen-token-plan-api-key-cn <key>",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/qwen-provider",
|
|
3
|
-
"version": "2026.7.2-beta.
|
|
3
|
+
"version": "2026.7.2-beta.3",
|
|
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.2-beta.
|
|
21
|
+
"pluginApi": ">=2026.7.2-beta.3"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.7.2-beta.
|
|
24
|
+
"openclawVersion": "2026.7.2-beta.3",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"README.md"
|
|
40
40
|
],
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"openclaw": ">=2026.7.2-beta.
|
|
42
|
+
"openclaw": ">=2026.7.2-beta.3"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
45
45
|
"openclaw": {
|