Skip to content

Commit eef4064

Browse files
committed
fix: address issue #756
Fixes #756
1 parent be177ea commit eef4064

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/providers/base-url-choices.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ export const ALIBABA_INTL_BASE_URL_CHOICES: readonly ProviderBaseUrlChoice[] = [
3939
{ id: "custom", label: "Custom" },
4040
];
4141

42+
/** Alibaba Coding Plan endpoint presets (international default; China mainland selectable). */
43+
export const ALIBABA_CODING_INTL_BASE_URL = "https://coding-intl.dashscope.aliyuncs.com/v1";
44+
export const ALIBABA_CODING_CN_BASE_URL = "https://coding.dashscope.aliyuncs.com/v1";
45+
46+
export const ALIBABA_CODING_BASE_URL_CHOICES: readonly ProviderBaseUrlChoice[] = [
47+
{ id: "intl", label: "International", baseUrl: ALIBABA_CODING_INTL_BASE_URL },
48+
{ id: "china", label: "China", baseUrl: ALIBABA_CODING_CN_BASE_URL },
49+
];
50+
4251
/** Match a saved baseUrl to a known choice id (`custom` when it does not match). */
4352
export function matchBaseUrlChoice(
4453
choices: readonly ProviderBaseUrlChoice[],

src/providers/registry.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { ProviderBaseUrlChoice } from "./base-url-choices";
55
import {
66
QWEN_CLOUD_BASE_URL_CHOICES, QWEN_CLOUD_TOKEN_PLAN_BASE_URL,
77
ALIBABA_INTL_BASE_URL_CHOICES, ALIBABA_INTL_TOKEN_PLAN_BASE_URL,
8+
ALIBABA_CODING_BASE_URL_CHOICES, ALIBABA_CODING_INTL_BASE_URL,
89
} from "./base-url-choices";
910
import {
1011
CURSOR_STATIC_MODELS,
@@ -969,7 +970,7 @@ export const PROVIDER_REGISTRY: readonly ProviderRegistryEntry[] = [
969970
// 2026-07-10: docs unverified; model data frozen. Evidence: devlog/_plan/260710_provider_hardening/002_research_cn.md.
970971
{ id: "qianfan", label: "Qianfan (Baidu)", baseUrl: "https://qianfan.baidubce.com/v2", adapter: "openai-chat", authKind: "key", dashboardUrl: "https://console.bce.baidu.com/iam/#/iam/apikey/list" },
971972
// 2026-07-10: docs unverified; model data frozen. Evidence: devlog/_plan/260710_provider_hardening/002_research_cn.md.
972-
{ id: "alibaba", label: "Alibaba Coding Plan", baseUrl: "https://coding-intl.dashscope.aliyuncs.com/v1", adapter: "openai-chat", authKind: "key", dashboardUrl: "https://dashscope.console.aliyun.com/apiKey" },
973+
{ id: "alibaba", label: "Alibaba Coding Plan", baseUrl: ALIBABA_CODING_INTL_BASE_URL, adapter: "openai-chat", authKind: "key", allowBaseUrlOverride: true, baseUrlChoices: ALIBABA_CODING_BASE_URL_CHOICES, dashboardUrl: "https://dashscope.console.aliyun.com/apiKey" },
973974
{
974975
id: "alibaba-token-plan",
975976
label: "Alibaba Token Plan (Beijing)",

tests/provider-registry-parity.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,10 @@ describe("provider registry parity", () => {
252252
label: "Alibaba Coding Plan",
253253
baseUrl: "https://coding-intl.dashscope.aliyuncs.com/v1",
254254
});
255+
expect(PROVIDER_REGISTRY.find(entry => entry.id === "alibaba")?.baseUrlChoices).toEqual([
256+
{ id: "intl", label: "International", baseUrl: "https://coding-intl.dashscope.aliyuncs.com/v1" },
257+
{ id: "china", label: "China", baseUrl: "https://coding.dashscope.aliyuncs.com/v1" },
258+
]);
255259
expect(KEY_LOGIN_PROVIDERS["alibaba-token-plan"]).toMatchObject({
256260
label: "Alibaba Token Plan (Beijing)",
257261
adapter: "openai-chat",
@@ -479,7 +483,7 @@ describe("provider registry parity", () => {
479483
test("base URL override permission is registry-only and limited to opted-in providers", () => {
480484
const optedIn = PROVIDER_REGISTRY.filter(entry => entry.allowBaseUrlOverride);
481485

482-
expect(optedIn.map(entry => entry.id)).toEqual(["ollama", "vllm", "lm-studio", "qwen-cloud", "alibaba-token-plan-intl", "litellm"]);
486+
expect(optedIn.map(entry => entry.id)).toEqual(["ollama", "vllm", "lm-studio", "qwen-cloud", "alibaba", "alibaba-token-plan-intl", "litellm"]);
483487
for (const entry of optedIn) {
484488
expect(providerConfigSeed(entry)).not.toHaveProperty("allowBaseUrlOverride");
485489
}

0 commit comments

Comments
 (0)