fix: align Z.AI endpoint detection with GLM-5.1 default (#61998) (thanks @serg0x)

This commit is contained in:
Peter Steinberger
2026-04-08 04:07:34 +01:00
parent 5024ff7129
commit dce3abaef7
4 changed files with 46 additions and 42 deletions

View File

@@ -102,28 +102,28 @@ export async function detectZaiEndpoint(params: {
{
endpoint: "global" as const,
baseUrl: ZAI_GLOBAL_BASE_URL,
modelId: "glm-5",
note: "Verified GLM-5 on global endpoint.",
modelId: "glm-5.1",
note: "Verified GLM-5.1 on global endpoint.",
},
{
endpoint: "cn" as const,
baseUrl: ZAI_CN_BASE_URL,
modelId: "glm-5",
note: "Verified GLM-5 on cn endpoint.",
modelId: "glm-5.1",
note: "Verified GLM-5.1 on cn endpoint.",
},
];
const codingGlm5 = [
const codingGlm51 = [
{
endpoint: "coding-global" as const,
baseUrl: ZAI_CODING_GLOBAL_BASE_URL,
modelId: "glm-5",
note: "Verified GLM-5 on coding-global endpoint.",
modelId: "glm-5.1",
note: "Verified GLM-5.1 on coding-global endpoint.",
},
{
endpoint: "coding-cn" as const,
baseUrl: ZAI_CODING_CN_BASE_URL,
modelId: "glm-5",
note: "Verified GLM-5 on coding-cn endpoint.",
modelId: "glm-5.1",
note: "Verified GLM-5.1 on coding-cn endpoint.",
},
];
const codingFallback = [
@@ -131,13 +131,13 @@ export async function detectZaiEndpoint(params: {
endpoint: "coding-global" as const,
baseUrl: ZAI_CODING_GLOBAL_BASE_URL,
modelId: "glm-4.7",
note: "Coding Plan endpoint verified, but this key/plan does not expose GLM-5 there. Defaulting to GLM-4.7.",
note: "Coding Plan endpoint verified, but this key/plan does not expose GLM-5.1 there. Defaulting to GLM-4.7.",
},
{
endpoint: "coding-cn" as const,
baseUrl: ZAI_CODING_CN_BASE_URL,
modelId: "glm-4.7",
note: "Coding Plan CN endpoint verified, but this key/plan does not expose GLM-5 there. Defaulting to GLM-4.7.",
note: "Coding Plan CN endpoint verified, but this key/plan does not expose GLM-5.1 there. Defaulting to GLM-4.7.",
},
];
@@ -148,16 +148,16 @@ export async function detectZaiEndpoint(params: {
return general.filter((candidate) => candidate.endpoint === "cn");
case "coding-global":
return [
...codingGlm5.filter((candidate) => candidate.endpoint === "coding-global"),
...codingGlm51.filter((candidate) => candidate.endpoint === "coding-global"),
...codingFallback.filter((candidate) => candidate.endpoint === "coding-global"),
];
case "coding-cn":
return [
...codingGlm5.filter((candidate) => candidate.endpoint === "coding-cn"),
...codingGlm51.filter((candidate) => candidate.endpoint === "coding-cn"),
...codingFallback.filter((candidate) => candidate.endpoint === "coding-cn"),
];
default:
return [...general, ...codingGlm5, ...codingFallback];
return [...general, ...codingGlm51, ...codingFallback];
}
})();