diff --git a/src/providers/base-url-choices.ts b/src/providers/base-url-choices.ts index 2c17a8e23..b2af6f1d0 100644 --- a/src/providers/base-url-choices.ts +++ b/src/providers/base-url-choices.ts @@ -39,6 +39,16 @@ export const ALIBABA_INTL_BASE_URL_CHOICES: readonly ProviderBaseUrlChoice[] = [ { id: "custom", label: "Custom" }, ]; +/** Alibaba Coding Plan endpoint presets (international default; China mainland selectable). */ +export const ALIBABA_CODING_INTL_BASE_URL = "https://coding-intl.dashscope.aliyuncs.com/v1"; +export const ALIBABA_CODING_CN_BASE_URL = "https://coding.dashscope.aliyuncs.com/v1"; + +export const ALIBABA_CODING_BASE_URL_CHOICES: readonly ProviderBaseUrlChoice[] = [ + { id: "intl", label: "International", baseUrl: ALIBABA_CODING_INTL_BASE_URL }, + { id: "china", label: "China", baseUrl: ALIBABA_CODING_CN_BASE_URL }, + { id: "custom", label: "Custom" }, +]; + /** Match a saved baseUrl to a known choice id (`custom` when it does not match). */ export function matchBaseUrlChoice( choices: readonly ProviderBaseUrlChoice[], diff --git a/src/providers/registry.ts b/src/providers/registry.ts index da8256366..b0ead3cac 100644 --- a/src/providers/registry.ts +++ b/src/providers/registry.ts @@ -5,6 +5,7 @@ import type { ProviderBaseUrlChoice } from "./base-url-choices"; import { QWEN_CLOUD_BASE_URL_CHOICES, QWEN_CLOUD_TOKEN_PLAN_BASE_URL, ALIBABA_INTL_BASE_URL_CHOICES, ALIBABA_INTL_TOKEN_PLAN_BASE_URL, + ALIBABA_CODING_BASE_URL_CHOICES, ALIBABA_CODING_INTL_BASE_URL, } from "./base-url-choices"; import { CURSOR_STATIC_MODELS, @@ -969,7 +970,7 @@ export const PROVIDER_REGISTRY: readonly ProviderRegistryEntry[] = [ // 2026-07-10: docs unverified; model data frozen. Evidence: devlog/_plan/260710_provider_hardening/002_research_cn.md. { 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" }, // 2026-07-10: docs unverified; model data frozen. Evidence: devlog/_plan/260710_provider_hardening/002_research_cn.md. - { 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" }, + { 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" }, { id: "alibaba-token-plan", label: "Alibaba Token Plan (Beijing)", diff --git a/tests/provider-registry-parity.test.ts b/tests/provider-registry-parity.test.ts index d2f7d5735..9d7d91d40 100644 --- a/tests/provider-registry-parity.test.ts +++ b/tests/provider-registry-parity.test.ts @@ -252,6 +252,11 @@ describe("provider registry parity", () => { label: "Alibaba Coding Plan", baseUrl: "https://coding-intl.dashscope.aliyuncs.com/v1", }); + expect(PROVIDER_REGISTRY.find(entry => entry.id === "alibaba")?.baseUrlChoices).toEqual([ + { id: "intl", label: "International", baseUrl: "https://coding-intl.dashscope.aliyuncs.com/v1" }, + { id: "china", label: "China", baseUrl: "https://coding.dashscope.aliyuncs.com/v1" }, + { id: "custom", label: "Custom" }, + ]); expect(KEY_LOGIN_PROVIDERS["alibaba-token-plan"]).toMatchObject({ label: "Alibaba Token Plan (Beijing)", adapter: "openai-chat", @@ -479,7 +484,7 @@ describe("provider registry parity", () => { test("base URL override permission is registry-only and limited to opted-in providers", () => { const optedIn = PROVIDER_REGISTRY.filter(entry => entry.allowBaseUrlOverride); - expect(optedIn.map(entry => entry.id)).toEqual(["ollama", "vllm", "lm-studio", "qwen-cloud", "alibaba-token-plan-intl", "litellm"]); + expect(optedIn.map(entry => entry.id)).toEqual(["ollama", "vllm", "lm-studio", "qwen-cloud", "alibaba", "alibaba-token-plan-intl", "litellm"]); for (const entry of optedIn) { expect(providerConfigSeed(entry)).not.toHaveProperty("allowBaseUrlOverride"); }