Merge 19e74c5cf5645fc7fd667f83622fa72a9474653d into 5e417b44e1540f528d2ae63e3e20229a902d1db2

This commit is contained in:
wenmeng zhou 2026-03-21 05:00:24 +03:00 committed by GitHub
commit 5d2ac5bf1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 145 additions and 10 deletions

View File

@ -4,6 +4,8 @@ import { buildSingleProviderApiKeyCatalog } from "openclaw/plugin-sdk/provider-c
import {
applyModelStudioConfig,
applyModelStudioConfigCn,
applyModelStudioStandardConfig,
applyModelStudioStandardConfigCn,
MODELSTUDIO_DEFAULT_MODEL_REF,
} from "./onboard.js";
import { buildModelStudioProvider } from "./provider-catalog.js";
@ -21,6 +23,62 @@ export default definePluginEntry({
docsPath: "/providers/models",
envVars: ["MODELSTUDIO_API_KEY"],
auth: [
createProviderApiKeyAuthMethod({
providerId: PROVIDER_ID,
methodId: "standard-api-key-cn",
label: "Standard API Key for China (pay-as-you-go)",
hint: "Endpoint: dashscope.aliyuncs.com",
optionKey: "modelstudioStandardApiKeyCn",
flagName: "--modelstudio-standard-api-key-cn",
envVar: "MODELSTUDIO_API_KEY",
profileId: "modelstudio:standard-cn",
promptMessage: "Enter Alibaba Cloud Model Studio API key (China)",
defaultModel: MODELSTUDIO_DEFAULT_MODEL_REF,
expectedProviders: ["modelstudio"],
applyConfig: (cfg) => applyModelStudioStandardConfigCn(cfg),
noteMessage: [
"Get your API key at: https://bailian.console.aliyun.com/",
"Endpoint: dashscope.aliyuncs.com/compatible-mode/v1",
"Models: qwen3.5-plus, qwen3.5-flash, qwen3-coder-plus, etc.",
].join("\n"),
noteTitle: "Alibaba Cloud Model Studio Standard (China)",
wizard: {
choiceId: "modelstudio-standard-api-key-cn",
choiceLabel: "Standard API Key for China (pay-as-you-go)",
choiceHint: "Endpoint: dashscope.aliyuncs.com",
groupId: "modelstudio",
groupLabel: "Qwen (Alibaba Cloud Model Studio)",
groupHint: "Standard / Coding Plan (CN / Global)",
},
}),
createProviderApiKeyAuthMethod({
providerId: PROVIDER_ID,
methodId: "standard-api-key",
label: "Standard API Key for Global/Intl (pay-as-you-go)",
hint: "Endpoint: dashscope-intl.aliyuncs.com",
optionKey: "modelstudioStandardApiKey",
flagName: "--modelstudio-standard-api-key",
envVar: "MODELSTUDIO_API_KEY",
profileId: "modelstudio:standard",
promptMessage: "Enter Alibaba Cloud Model Studio API key (Global/Intl)",
defaultModel: MODELSTUDIO_DEFAULT_MODEL_REF,
expectedProviders: ["modelstudio"],
applyConfig: (cfg) => applyModelStudioStandardConfig(cfg),
noteMessage: [
"Get your API key at: https://modelstudio.console.alibabacloud.com/",
"Endpoint: dashscope-intl.aliyuncs.com/compatible-mode/v1",
"Models: qwen3.5-plus, qwen3.5-flash, qwen3-coder-plus, etc.",
].join("\n"),
noteTitle: "Alibaba Cloud Model Studio Standard (Global/Intl)",
wizard: {
choiceId: "modelstudio-standard-api-key",
choiceLabel: "Standard API Key for Global/Intl (pay-as-you-go)",
choiceHint: "Endpoint: dashscope-intl.aliyuncs.com",
groupId: "modelstudio",
groupLabel: "Qwen (Alibaba Cloud Model Studio)",
groupHint: "Standard / Coding Plan (CN / Global)",
},
}),
createProviderApiKeyAuthMethod({
providerId: PROVIDER_ID,
methodId: "api-key-cn",
@ -44,8 +102,8 @@ export default definePluginEntry({
choiceLabel: "Coding Plan API Key for China (subscription)",
choiceHint: "Endpoint: coding.dashscope.aliyuncs.com",
groupId: "modelstudio",
groupLabel: "Alibaba Cloud Model Studio",
groupHint: "Coding Plan API key (CN / Global)",
groupLabel: "Qwen (Alibaba Cloud Model Studio)",
groupHint: "Standard / Coding Plan (CN / Global)",
},
}),
createProviderApiKeyAuthMethod({
@ -71,8 +129,8 @@ export default definePluginEntry({
choiceLabel: "Coding Plan API Key for Global/Intl (subscription)",
choiceHint: "Endpoint: coding-intl.dashscope.aliyuncs.com",
groupId: "modelstudio",
groupLabel: "Alibaba Cloud Model Studio",
groupHint: "Coding Plan API key (CN / Global)",
groupLabel: "Qwen (Alibaba Cloud Model Studio)",
groupHint: "Standard / Coding Plan (CN / Global)",
},
}),
],

View File

@ -2,6 +2,9 @@ import type { ModelDefinitionConfig } from "openclaw/plugin-sdk/provider-models"
export const MODELSTUDIO_CN_BASE_URL = "https://coding.dashscope.aliyuncs.com/v1";
export const MODELSTUDIO_GLOBAL_BASE_URL = "https://coding-intl.dashscope.aliyuncs.com/v1";
export const MODELSTUDIO_STANDARD_CN_BASE_URL = "https://dashscope.aliyuncs.com/compatible-mode/v1";
export const MODELSTUDIO_STANDARD_GLOBAL_BASE_URL =
"https://dashscope-intl.aliyuncs.com/compatible-mode/v1";
export const MODELSTUDIO_DEFAULT_MODEL_ID = "qwen3.5-plus";
export const MODELSTUDIO_DEFAULT_MODEL_REF = `modelstudio/${MODELSTUDIO_DEFAULT_MODEL_ID}`;
export const MODELSTUDIO_DEFAULT_COST = {

View File

@ -1,4 +1,5 @@
import {
applyAgentDefaultModelPrimary,
applyProviderConfigWithModelCatalogPreset,
type OpenClawConfig,
} from "openclaw/plugin-sdk/provider-onboard";
@ -6,10 +7,18 @@ import {
MODELSTUDIO_CN_BASE_URL,
MODELSTUDIO_DEFAULT_MODEL_REF,
MODELSTUDIO_GLOBAL_BASE_URL,
MODELSTUDIO_STANDARD_CN_BASE_URL,
MODELSTUDIO_STANDARD_GLOBAL_BASE_URL,
} from "./model-definitions.js";
import { buildModelStudioProvider } from "./provider-catalog.js";
export { MODELSTUDIO_CN_BASE_URL, MODELSTUDIO_DEFAULT_MODEL_REF, MODELSTUDIO_GLOBAL_BASE_URL };
export {
MODELSTUDIO_CN_BASE_URL,
MODELSTUDIO_DEFAULT_MODEL_REF,
MODELSTUDIO_GLOBAL_BASE_URL,
MODELSTUDIO_STANDARD_CN_BASE_URL,
MODELSTUDIO_STANDARD_GLOBAL_BASE_URL,
};
function applyModelStudioProviderConfigWithBaseUrl(
cfg: OpenClawConfig,
@ -53,3 +62,27 @@ export function applyModelStudioConfigCn(cfg: OpenClawConfig): OpenClawConfig {
MODELSTUDIO_DEFAULT_MODEL_REF,
);
}
// Alibaba Cloud Model Studio Standard (pay-as-you-go)
export function applyModelStudioStandardProviderConfig(cfg: OpenClawConfig): OpenClawConfig {
return applyModelStudioProviderConfigWithBaseUrl(cfg, MODELSTUDIO_STANDARD_GLOBAL_BASE_URL);
}
export function applyModelStudioStandardProviderConfigCn(cfg: OpenClawConfig): OpenClawConfig {
return applyModelStudioProviderConfigWithBaseUrl(cfg, MODELSTUDIO_STANDARD_CN_BASE_URL);
}
export function applyModelStudioStandardConfig(cfg: OpenClawConfig): OpenClawConfig {
return applyAgentDefaultModelPrimary(
applyModelStudioStandardProviderConfig(cfg),
MODELSTUDIO_DEFAULT_MODEL_REF,
);
}
export function applyModelStudioStandardConfigCn(cfg: OpenClawConfig): OpenClawConfig {
return applyAgentDefaultModelPrimary(
applyModelStudioStandardProviderConfigCn(cfg),
MODELSTUDIO_DEFAULT_MODEL_REF,
);
}

View File

@ -5,6 +5,34 @@
"modelstudio": ["MODELSTUDIO_API_KEY"]
},
"providerAuthChoices": [
{
"provider": "modelstudio",
"method": "standard-api-key-cn",
"choiceId": "modelstudio-standard-api-key-cn",
"choiceLabel": "Standard API Key for China (pay-as-you-go)",
"choiceHint": "Endpoint: dashscope.aliyuncs.com",
"groupId": "modelstudio",
"groupLabel": "Qwen (Alibaba Cloud Model Studio)",
"groupHint": "Standard / Coding Plan (CN / Global)",
"optionKey": "modelstudioStandardApiKeyCn",
"cliFlag": "--modelstudio-standard-api-key-cn",
"cliOption": "--modelstudio-standard-api-key-cn <key>",
"cliDescription": "Alibaba Cloud Model Studio Standard API key (China)"
},
{
"provider": "modelstudio",
"method": "standard-api-key",
"choiceId": "modelstudio-standard-api-key",
"choiceLabel": "Standard API Key for Global/Intl (pay-as-you-go)",
"choiceHint": "Endpoint: dashscope-intl.aliyuncs.com",
"groupId": "modelstudio",
"groupLabel": "Qwen (Alibaba Cloud Model Studio)",
"groupHint": "Standard / Coding Plan (CN / Global)",
"optionKey": "modelstudioStandardApiKey",
"cliFlag": "--modelstudio-standard-api-key",
"cliOption": "--modelstudio-standard-api-key <key>",
"cliDescription": "Alibaba Cloud Model Studio Standard API key (Global/Intl)"
},
{
"provider": "modelstudio",
"method": "api-key-cn",
@ -12,8 +40,8 @@
"choiceLabel": "Coding Plan API Key for China (subscription)",
"choiceHint": "Endpoint: coding.dashscope.aliyuncs.com",
"groupId": "modelstudio",
"groupLabel": "Alibaba Cloud Model Studio",
"groupHint": "Coding Plan API key (CN / Global)",
"groupLabel": "Qwen (Alibaba Cloud Model Studio)",
"groupHint": "Standard / Coding Plan (CN / Global)",
"optionKey": "modelstudioApiKeyCn",
"cliFlag": "--modelstudio-api-key-cn",
"cliOption": "--modelstudio-api-key-cn <key>",
@ -26,8 +54,8 @@
"choiceLabel": "Coding Plan API Key for Global/Intl (subscription)",
"choiceHint": "Endpoint: coding-intl.dashscope.aliyuncs.com",
"groupId": "modelstudio",
"groupLabel": "Alibaba Cloud Model Studio",
"groupHint": "Coding Plan API key (CN / Global)",
"groupLabel": "Qwen (Alibaba Cloud Model Studio)",
"groupHint": "Standard / Coding Plan (CN / Global)",
"optionKey": "modelstudioApiKey",
"cliFlag": "--modelstudio-api-key",
"cliOption": "--modelstudio-api-key <key>",

View File

@ -61,6 +61,8 @@ const MOONSHOT_NATIVE_BASE_URLS = new Set([
const MODELSTUDIO_NATIVE_BASE_URLS = new Set([
"https://coding-intl.dashscope.aliyuncs.com/v1",
"https://coding.dashscope.aliyuncs.com/v1",
"https://dashscope.aliyuncs.com/compatible-mode/v1",
"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
]);
const ENV_VAR_NAME_RE = /^[A-Z_][A-Z0-9_]*$/;

View File

@ -48,6 +48,8 @@ export type BuiltInAuthChoice =
| "volcengine-api-key"
| "byteplus-api-key"
| "qianfan-api-key"
| "modelstudio-standard-api-key-cn"
| "modelstudio-standard-api-key"
| "modelstudio-api-key-cn"
| "modelstudio-api-key"
| "custom-api-key"
@ -140,6 +142,8 @@ export type OnboardOptions = {
volcengineApiKey?: string;
byteplusApiKey?: string;
qianfanApiKey?: string;
modelstudioStandardApiKeyCn?: string;
modelstudioStandardApiKey?: string;
modelstudioApiKeyCn?: string;
modelstudioApiKey?: string;
customBaseUrl?: string;

View File

@ -6,6 +6,7 @@ export * from "../channels/reply-prefix.js";
export * from "../channels/typing.js";
export type * from "../channels/plugins/types.js";
export * from "../channels/plugins/normalize/signal.js";
export * from "../channels/plugins/normalize/slack.js";
export * from "../channels/plugins/normalize/whatsapp.js";
export * from "../channels/plugins/outbound/interactive.js";
export * from "../channels/plugins/whatsapp-heartbeat.js";

View File

@ -58,7 +58,13 @@ export {
export { resolveWhatsAppHeartbeatRecipients } from "../channels/plugins/whatsapp-heartbeat.js";
export { WhatsAppConfigSchema } from "../config/zod-schema.providers-whatsapp.js";
export { createActionGate, readStringParam } from "../agents/tools/common.js";
export {
createActionGate,
jsonResult,
readReactionParams,
readStringParam,
ToolAuthorizationError,
} from "../agents/tools/common.js";
export { createPluginRuntimeStore } from "./runtime-store.js";
export { normalizeE164 } from "../utils.js";