mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
fix(alicode-intl): split into Coding Plan + Model Studio providers
8b9cac1 swapped alicode-intl to the DashScope compatible-mode endpoint to
fix #2591 for standard DashScope keys, but that broke Coding Plan keys
(sk-sp-...) which only work on coding-intl.dashscope.aliyuncs.com. The two
key types use two different hosts and are not interchangeable.
- alicode-intl: revert to coding-intl endpoint (Coding Plan keys)
- alims-intl: new provider for dashscope-intl/compatible-mode (standard keys)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
c4a120af8f
commit
55628eea02
@@ -1,24 +1,35 @@
|
||||
// #2591 — Alibaba Intl (alicode-intl) must use the OpenAI-compatible-mode
|
||||
// DashScope endpoint so standard DashScope API keys work. The previous
|
||||
// coding-intl host only accepted Alibaba Coding Plan keys and rejected
|
||||
// ordinary DashScope keys with "Invalid API key".
|
||||
// #2591 — Alibaba Intl key types split across two hosts:
|
||||
// - alicode-intl: Coding Plan keys (sk-sp-...) → coding-intl.dashscope.aliyuncs.com
|
||||
// - alims-intl: standard DashScope API keys (sk-...) → dashscope-intl.aliyuncs.com/compatible-mode
|
||||
// The two key types are NOT interchangeable across hosts. Split into two providers
|
||||
// so each key type reaches its own host.
|
||||
import { describe, it, expect } from "vitest";
|
||||
import alicodeIntl from "../../open-sse/providers/registry/alicode-intl.js";
|
||||
import alimsIntl from "../../open-sse/providers/registry/alims-intl.js";
|
||||
|
||||
describe("alicode-intl endpoint (issue #2591)", () => {
|
||||
it("routes to the compatible-mode DashScope endpoint", () => {
|
||||
describe("alicode-intl endpoint (Coding Plan keys)", () => {
|
||||
it("routes to the coding-intl host for Coding Plan keys", () => {
|
||||
expect(alicodeIntl.id).toBe("alicode-intl");
|
||||
expect(alicodeIntl.transport.baseUrl).toBe(
|
||||
"https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions"
|
||||
"https://coding-intl.dashscope.aliyuncs.com/v1/chat/completions"
|
||||
);
|
||||
});
|
||||
|
||||
it("does not use the coding-intl host that rejects standard keys", () => {
|
||||
expect(alicodeIntl.transport.baseUrl).not.toContain("coding-intl.dashscope.aliyuncs.com");
|
||||
});
|
||||
|
||||
it("keeps the chat/completions path and preserveCacheControl quirk", () => {
|
||||
expect(alicodeIntl.transport.baseUrl).toContain("/v1/chat/completions");
|
||||
expect(alicodeIntl.transport.quirks.preserveCacheControl).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("alims-intl endpoint (standard DashScope keys)", () => {
|
||||
it("routes to the compatible-mode DashScope endpoint for standard keys", () => {
|
||||
expect(alimsIntl.id).toBe("alims-intl");
|
||||
expect(alimsIntl.transport.baseUrl).toBe(
|
||||
"https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions"
|
||||
);
|
||||
});
|
||||
|
||||
it("does not use the coding-intl host that rejects standard keys", () => {
|
||||
expect(alimsIntl.transport.baseUrl).not.toContain("coding-intl.dashscope.aliyuncs.com");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user