

























@@ -39,10 +39,7 @@ describe("detectZaiEndpoint", () => {
3939},
4040{
4141responses: {
42-"https://api.z.ai/api/paas/v4/chat/completions::glm-5.1": {
43-status: 404,
44-body: { error: { message: "not found" } },
45-},
42+"https://api.z.ai/api/paas/v4/chat/completions::glm-5.1": { status: 404 },
4643"https://open.bigmodel.cn/api/paas/v4/chat/completions::glm-5.1": { status: 200 },
4744},
4845expected: { endpoint: "cn", modelId: "glm-5.1" },
@@ -51,13 +48,17 @@ describe("detectZaiEndpoint", () => {
5148responses: {
5249"https://api.z.ai/api/paas/v4/chat/completions::glm-5.1": { status: 404 },
5350"https://open.bigmodel.cn/api/paas/v4/chat/completions::glm-5.1": { status: 404 },
54-"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-5.1": { status: 200 },
51+"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-5.2": { status: 200 },
5552},
56-expected: { endpoint: "coding-global", modelId: "glm-5.1" },
53+expected: { endpoint: "coding-global", modelId: "glm-5.2" },
5754},
5855{
5956endpoint: "coding-global",
6057responses: {
58+"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-5.2": {
59+status: 404,
60+body: { error: { message: "glm-5.2 unavailable" } },
61+},
6162"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-5.1": {
6263status: 404,
6364body: { error: { message: "glm-5.1 unavailable" } },
@@ -66,9 +67,46 @@ describe("detectZaiEndpoint", () => {
6667},
6768expected: { endpoint: "coding-global", modelId: "glm-4.7" },
6869},
70+{
71+endpoint: "coding-global",
72+responses: {
73+"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-5.2": {
74+status: 400,
75+body: { code: 1311, msg: "model not included in the current plan" },
76+},
77+"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-5.1": {
78+status: 400,
79+body: { code: 1211, msg: "model does not exist" },
80+},
81+"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-4.7": { status: 200 },
82+},
83+expected: { endpoint: "coding-global", modelId: "glm-4.7" },
84+},
85+{
86+endpoint: "coding-global",
87+responses: {
88+"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-5.2": {
89+status: 429,
90+body: { error: { message: "rate limited" } },
91+},
92+},
93+expected: null,
94+},
6995{
7096endpoint: "coding-cn",
7197responses: {
98+"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions::glm-5.2": {
99+status: 200,
100+},
101+},
102+expected: { endpoint: "coding-cn", modelId: "glm-5.2" },
103+},
104+{
105+endpoint: "coding-cn",
106+responses: {
107+"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions::glm-5.2": {
108+status: 404,
109+},
72110"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions::glm-5.1": {
73111status: 200,
74112},
@@ -78,6 +116,10 @@ describe("detectZaiEndpoint", () => {
78116{
79117endpoint: "coding-cn",
80118responses: {
119+"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions::glm-5.2": {
120+status: 404,
121+body: { error: { message: "glm-5.2 unavailable" } },
122+},
81123"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions::glm-5.1": {
82124status: 404,
83125body: { error: { message: "glm-5.1 unavailable" } },
@@ -92,8 +134,12 @@ describe("detectZaiEndpoint", () => {
92134responses: {
93135"https://api.z.ai/api/paas/v4/chat/completions::glm-5.1": { status: 401 },
94136"https://open.bigmodel.cn/api/paas/v4/chat/completions::glm-5.1": { status: 401 },
137+"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-5.2": { status: 401 },
95138"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-5.1": { status: 401 },
96139"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-4.7": { status: 401 },
140+"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions::glm-5.2": {
141+status: 401,
142+},
97143"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions::glm-5.1": {
98144status: 401,
99145},
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。