Skip to content

Commit 165f1a8

Browse files
authored
fix: preserve configured Alibaba Token Plan base URL (lidge-jun#189)
Alibaba Token Plan entry now opts into allowBaseUrlOverride, matching the existing qwen-cloud precedent. Adds router regression coverage and updates the registry parity assertion.
1 parent 30400a3 commit 165f1a8

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎src/providers/registry.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ export const PROVIDER_REGISTRY: readonly ProviderRegistryEntry[] = [
691691
id: "alibaba-token-plan",
692692
label: "Alibaba Token Plan (Beijing)",
693693
baseUrl: "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
694+
allowBaseUrlOverride: true,
694695
adapter: "openai-chat",
695696
authKind: "key",
696697
dashboardUrl: "https://bailian.console.aliyun.com/cn-beijing?tab=plan",

‎tests/provider-registry-parity.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,9 @@ describe("provider registry parity", () => {
418418
test("base URL override permission is registry-only and limited to opted-in providers", () => {
419419
const optedIn = PROVIDER_REGISTRY.filter(entry => entry.allowBaseUrlOverride);
420420

421-
expect(optedIn.map(entry => entry.id)).toEqual(["ollama", "vllm", "lm-studio", "qwen-cloud", "litellm"]);
421+
expect(optedIn.map(entry => entry.id)).toEqual([
422+
"ollama", "vllm", "lm-studio", "qwen-cloud", "alibaba-token-plan", "litellm",
423+
]);
422424
for (const entry of optedIn) {
423425
expect(providerConfigSeed(entry)).not.toHaveProperty("allowBaseUrlOverride");
424426
}

‎tests/router-template-baseurl.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ const OVERRIDE_PROVIDERS = [
66
{ id: "ollama", registryBaseUrl: "http://localhost:11434/v1" },
77
{ id: "vllm", registryBaseUrl: "http://localhost:8000/v1" },
88
{ id: "lm-studio", registryBaseUrl: "http://localhost:1234/v1" },
9+
{
10+
id: "alibaba-token-plan",
11+
registryBaseUrl: "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
12+
},
913
{ id: "litellm", registryBaseUrl: "http://localhost:4000/v1" },
1014
] as const;
1115

@@ -19,7 +23,7 @@ function configFor(providerName: string, provider: OcxProviderConfig): OcxConfig
1923

2024
for (const { id, registryBaseUrl } of OVERRIDE_PROVIDERS) {
2125
test(`${id} trims and preserves a configured base URL override`, () => {
22-
const override = `http://${id}.lan:3210/v1`;
26+
const override = `https://${id}.example.test/v1`;
2327
const config = configFor(id, {
2428
adapter: "openai-chat",
2529
baseUrl: ` ${override} `,

0 commit comments

Comments
 (0)