mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-24 16:32:29 +00:00
feat(modelstudio): add standard (pay-as-you-go) DashScope endpoints for Qwen (#43878)
Add Standard API Key auth methods for China (dashscope.aliyuncs.com) and Global/Intl (dashscope-intl.aliyuncs.com) pay-as-you-go endpoints alongside the existing Coding Plan (subscription) endpoints. Also updates group label to 'Qwen (Alibaba Cloud Model Studio)' and fixes glm-4.7 -> glm-5 in Coding Plan note messages. Co-authored-by: wenmeng zhou <wenmengzhou@users.noreply.github.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,8 @@ import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-en
|
||||
import {
|
||||
applyModelStudioConfig,
|
||||
applyModelStudioConfigCn,
|
||||
applyModelStudioStandardConfig,
|
||||
applyModelStudioStandardConfigCn,
|
||||
MODELSTUDIO_DEFAULT_MODEL_REF,
|
||||
} from "./onboard.js";
|
||||
import { buildModelStudioProvider } from "./provider-catalog.js";
|
||||
@@ -16,6 +18,50 @@ export default defineSingleProviderPluginEntry({
|
||||
label: "Model Studio",
|
||||
docsPath: "/providers/models",
|
||||
auth: [
|
||||
{
|
||||
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",
|
||||
promptMessage: "Enter Alibaba Cloud Model Studio API key (China)",
|
||||
defaultModel: MODELSTUDIO_DEFAULT_MODEL_REF,
|
||||
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-coder-plus, qwen3-coder-next, etc.",
|
||||
].join("\n"),
|
||||
noteTitle: "Alibaba Cloud Model Studio Standard (China)",
|
||||
wizard: {
|
||||
choiceHint: "Endpoint: dashscope.aliyuncs.com",
|
||||
groupLabel: "Qwen (Alibaba Cloud Model Studio)",
|
||||
groupHint: "Standard / Coding Plan (CN / Global)",
|
||||
},
|
||||
},
|
||||
{
|
||||
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",
|
||||
promptMessage: "Enter Alibaba Cloud Model Studio API key (Global/Intl)",
|
||||
defaultModel: MODELSTUDIO_DEFAULT_MODEL_REF,
|
||||
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-coder-plus, qwen3-coder-next, etc.",
|
||||
].join("\n"),
|
||||
noteTitle: "Alibaba Cloud Model Studio Standard (Global/Intl)",
|
||||
wizard: {
|
||||
choiceHint: "Endpoint: dashscope-intl.aliyuncs.com",
|
||||
groupLabel: "Qwen (Alibaba Cloud Model Studio)",
|
||||
groupHint: "Standard / Coding Plan (CN / Global)",
|
||||
},
|
||||
},
|
||||
{
|
||||
methodId: "api-key-cn",
|
||||
label: "Coding Plan API Key for China (subscription)",
|
||||
@@ -29,13 +75,13 @@ export default defineSingleProviderPluginEntry({
|
||||
noteMessage: [
|
||||
"Get your API key at: https://bailian.console.aliyun.com/",
|
||||
"Endpoint: coding.dashscope.aliyuncs.com",
|
||||
"Models: qwen3.5-plus, glm-4.7, kimi-k2.5, MiniMax-M2.5, etc.",
|
||||
"Models: qwen3.5-plus, glm-5, kimi-k2.5, MiniMax-M2.5, etc.",
|
||||
].join("\n"),
|
||||
noteTitle: "Alibaba Cloud Model Studio Coding Plan (China)",
|
||||
wizard: {
|
||||
choiceHint: "Endpoint: coding.dashscope.aliyuncs.com",
|
||||
groupLabel: "Alibaba Cloud Model Studio",
|
||||
groupHint: "Coding Plan API key (CN / Global)",
|
||||
groupLabel: "Qwen (Alibaba Cloud Model Studio)",
|
||||
groupHint: "Standard / Coding Plan (CN / Global)",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -51,13 +97,13 @@ export default defineSingleProviderPluginEntry({
|
||||
noteMessage: [
|
||||
"Get your API key at: https://bailian.console.aliyun.com/",
|
||||
"Endpoint: coding-intl.dashscope.aliyuncs.com",
|
||||
"Models: qwen3.5-plus, glm-4.7, kimi-k2.5, MiniMax-M2.5, etc.",
|
||||
"Models: qwen3.5-plus, glm-5, kimi-k2.5, MiniMax-M2.5, etc.",
|
||||
].join("\n"),
|
||||
noteTitle: "Alibaba Cloud Model Studio Coding Plan (Global/Intl)",
|
||||
wizard: {
|
||||
choiceHint: "Endpoint: coding-intl.dashscope.aliyuncs.com",
|
||||
groupLabel: "Alibaba Cloud Model Studio",
|
||||
groupHint: "Coding Plan API key (CN / Global)",
|
||||
groupLabel: "Qwen (Alibaba Cloud Model Studio)",
|
||||
groupHint: "Standard / Coding Plan (CN / Global)",
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -6,10 +6,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,
|
||||
};
|
||||
|
||||
const modelStudioPresetAppliers = createModelCatalogPresetAppliers<[string]>({
|
||||
primaryModelRef: MODELSTUDIO_DEFAULT_MODEL_REF,
|
||||
@@ -43,3 +51,19 @@ export function applyModelStudioConfig(cfg: OpenClawConfig): OpenClawConfig {
|
||||
export function applyModelStudioConfigCn(cfg: OpenClawConfig): OpenClawConfig {
|
||||
return modelStudioPresetAppliers.applyConfig(cfg, MODELSTUDIO_CN_BASE_URL);
|
||||
}
|
||||
|
||||
export function applyModelStudioStandardProviderConfig(cfg: OpenClawConfig): OpenClawConfig {
|
||||
return modelStudioPresetAppliers.applyProviderConfig(cfg, MODELSTUDIO_STANDARD_GLOBAL_BASE_URL);
|
||||
}
|
||||
|
||||
export function applyModelStudioStandardProviderConfigCn(cfg: OpenClawConfig): OpenClawConfig {
|
||||
return modelStudioPresetAppliers.applyProviderConfig(cfg, MODELSTUDIO_STANDARD_CN_BASE_URL);
|
||||
}
|
||||
|
||||
export function applyModelStudioStandardConfig(cfg: OpenClawConfig): OpenClawConfig {
|
||||
return modelStudioPresetAppliers.applyConfig(cfg, MODELSTUDIO_STANDARD_GLOBAL_BASE_URL);
|
||||
}
|
||||
|
||||
export function applyModelStudioStandardConfigCn(cfg: OpenClawConfig): OpenClawConfig {
|
||||
return modelStudioPresetAppliers.applyConfig(cfg, MODELSTUDIO_STANDARD_CN_BASE_URL);
|
||||
}
|
||||
|
||||
@@ -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>",
|
||||
|
||||
@@ -65,6 +65,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_]*$/;
|
||||
|
||||
@@ -49,6 +49,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"
|
||||
@@ -143,6 +145,8 @@ export type OnboardOptions = {
|
||||
volcengineApiKey?: string;
|
||||
byteplusApiKey?: string;
|
||||
qianfanApiKey?: string;
|
||||
modelstudioStandardApiKeyCn?: string;
|
||||
modelstudioStandardApiKey?: string;
|
||||
modelstudioApiKeyCn?: string;
|
||||
modelstudioApiKey?: string;
|
||||
customBaseUrl?: string;
|
||||
|
||||
@@ -1927,6 +1927,34 @@ export const GENERATED_BUNDLED_PLUGIN_METADATA = [
|
||||
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",
|
||||
@@ -1934,8 +1962,8 @@ export const GENERATED_BUNDLED_PLUGIN_METADATA = [
|
||||
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>",
|
||||
@@ -1948,8 +1976,8 @@ export const GENERATED_BUNDLED_PLUGIN_METADATA = [
|
||||
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>",
|
||||
|
||||
Reference in New Issue
Block a user