Skip to content

Commit b04c03c

Browse files
committed
feat(providers): add Alibaba Token Plan (token-plan.ap-southeast-1)
Fourth Alibaba key type — Coding Plan (alicode/alicode-intl) and Model Studio (alims-intl) both reject Token Plan keys. Registry entry only; PROVIDER_MODELS builds from providers/registry so no executor or translator work is needed. Singapore-only (eu-central-1 answers IllegalEndpoint) and OpenAI-compatible transport only (the Anthropic surface is not authorized for this plan). Closes #2754 Closes #2806
1 parent 8b2b2fe commit b04c03c

5 files changed

Lines changed: 93 additions & 1 deletion

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Token Plan — credit subscription keys on token-plan.<region>.maas.aliyuncs.com.
2+
// Fourth Alibaba key type: Coding Plan (alicode/alicode-intl) and Model Studio
3+
// (alims-intl) both reject these keys, and they reject Model Studio keys back.
4+
// Singapore is the only region that serves the plan; eu-central-1 answers
5+
// IllegalEndpoint. The Anthropic surface (/apps/anthropic/v1/messages) is not
6+
// authorized for this plan, so OpenAI-compatible mode is the only transport.
7+
export default {
8+
id: "alitp-intl",
9+
priority: 11,
10+
alias: "alitp-intl",
11+
display: {
12+
name: "Alibaba Token Plan",
13+
icon: "cloud",
14+
color: "#FF6A00",
15+
textIcon: "ATP",
16+
website: "https://www.alibabacloud.com/campaign/ai-landing-page-token",
17+
notice: {
18+
apiKeyUrl: "https://modelstudio.console.alibabacloud.com/?apiKey=1",
19+
},
20+
},
21+
category: "apikey",
22+
transport: {
23+
baseUrl: "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions",
24+
headers: {},
25+
quirks: { preserveCacheControl: true },
26+
},
27+
models: [
28+
{ id: "qwen3.8-max-preview", name: "Qwen3.8 Max Preview" },
29+
{ id: "qwen3.7-max", name: "Qwen3.7 Max" },
30+
{ id: "qwen3.7-plus", name: "Qwen3.7 Plus" },
31+
{ id: "qwen3.6-flash", name: "Qwen3.6 Flash" },
32+
{ id: "glm-5.2", name: "GLM 5.2" },
33+
{ id: "deepseek-v4-pro", name: "DeepSeek V4 Pro" },
34+
],
35+
};

‎open-sse/providers/registry/index.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ import p117 from "./selfhosted-stt.js";
120120
import p118 from "./selfhosted-tts.js";
121121
import p119 from "./selfhosted-embedding.js";
122122
import p120 from "./fish-audio.js";
123+
import p121 from "./alitp-intl.js";
123124

124125
export default [
125126
p0,
@@ -241,4 +242,5 @@ export default [
241242
p118,
242243
p119,
243244
p120,
245+
p121,
244246
];

‎tests/__baseline__/alias-baseline.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
"alicode": "alicode",
123123
"alicode-intl": "alicode-intl",
124124
"alims-intl": "alims-intl",
125+
"alitp-intl": "alitp-intl",
125126
"anthropic": "anthropic",
126127
"antigravity": "ag",
127128
"api-airforce": "af",
@@ -206,6 +207,7 @@
206207
"alicode",
207208
"alicode-intl",
208209
"alims-intl",
210+
"alitp-intl",
209211
"anthropic",
210212
"assemblyai",
211213
"black-forest-labs",

‎tests/__baseline__/providers-baseline.json‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,15 @@
968968
"tokenrouter": {
969969
"baseUrl": "https://api.tokenrouter.com/v1/chat/completions",
970970
"validateUrl": "https://api.tokenrouter.com/v1/models",
971-
"thinkingFormat": "openai",
971+
"thinkingFormat": "tokenrouter",
972+
"format": "openai"
973+
},
974+
"alitp-intl": {
975+
"baseUrl": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions",
976+
"headers": {},
977+
"quirks": {
978+
"preserveCacheControl": true
979+
},
972980
"format": "openai"
973981
}
974982
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { describe, expect, it } from "vitest";
2+
3+
import REGISTRY from "../../open-sse/providers/registry/index.js";
4+
import { PROVIDERS, PROVIDER_MODELS } from "../../open-sse/providers/index.js";
5+
6+
describe("Alibaba Token Plan provider", () => {
7+
const entry = REGISTRY.find((e) => e.id === "alitp-intl");
8+
9+
it("is registered as an OpenAI-compatible apikey provider", () => {
10+
expect(entry).toBeDefined();
11+
expect(entry.category).toBe("apikey");
12+
expect(PROVIDERS["alitp-intl"]).toBeDefined();
13+
expect(PROVIDERS["alitp-intl"].format).toBe("openai");
14+
});
15+
16+
it("targets the Singapore Token Plan host in compatible mode", () => {
17+
// eu-central-1 answers IllegalEndpoint; the plan is Singapore-only.
18+
expect(PROVIDERS["alitp-intl"].baseUrl).toBe(
19+
"https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions",
20+
);
21+
});
22+
23+
it("does not collide with the other three Alibaba key types", () => {
24+
const hosts = ["alicode", "alicode-intl", "alims-intl", "alitp-intl"]
25+
.map((id) => new URL(PROVIDERS[id].baseUrl).host);
26+
expect(new Set(hosts).size).toBe(hosts.length);
27+
});
28+
29+
it("exposes the models the plan actually serves", () => {
30+
const ids = (PROVIDER_MODELS["alitp-intl"] || []).map((m) => m.id);
31+
expect(ids).toEqual(expect.arrayContaining([
32+
"qwen3.8-max-preview",
33+
"qwen3.7-max",
34+
"qwen3.7-plus",
35+
"qwen3.6-flash",
36+
"glm-5.2",
37+
"deepseek-v4-pro",
38+
]));
39+
});
40+
41+
it("keeps every registry id unique after adding the provider", () => {
42+
const ids = REGISTRY.map((e) => e.id);
43+
expect(new Set(ids).size).toBe(ids.length);
44+
});
45+
});

0 commit comments

Comments
 (0)