@eum-agent/llm-provider-zhipu 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +781 -322
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,14 +1,13 @@
1
1
  //#endregion
2
2
  //#region src/catalog.ts
3
- /** Supplier-owned catalogue rows; protocol request facts belong to protocol registrations. */
4
3
  const catalog = {
5
4
  vendors: [
6
5
  {
7
6
  kind: "vendor",
8
7
  id: "zhipu-cn",
9
8
  logo: "data:image/svg+xml,%3Csvg%20height%3D%2224%22%20viewBox%3D%223%203%2024%2024%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ctitle%3EZhipu%3C%2Ftitle%3E%3Cg%20fill%3D%22%232D2D2D%22%3E%3Cpath%20d%3D%22M15.47%207.1l-1.3%201.85c-.2.29-.54.47-.9.47h-7.1V7.09c-.01.01%209.3.01%209.3.01z%22%2F%3E%3Cpath%20d%3D%22M24.3%207.1L13.14%2022.91H5.7L16.86%207.1z%22%2F%3E%3Cpath%20d%3D%22M14.53%2022.91l1.31-1.86c.2-.29.54-.47.9-.47h7.09v2.33h-9.3z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E%0A",
10
- name: "智谱 GLM",
11
- region: "国内",
9
+ name: "\u667a\u8c31 GLM",
10
+ region: "\u56fd\u5185",
12
11
  market: "domestic",
13
12
  catalogKey: "zhipuai",
14
13
  canListModels: true,
@@ -28,8 +27,8 @@ const catalog = {
28
27
  kind: "vendor",
29
28
  id: "zhipu",
30
29
  logo: "data:image/svg+xml,%3Csvg%20height%3D%2224%22%20viewBox%3D%223%203%2024%2024%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ctitle%3EZhipu%3C%2Ftitle%3E%3Cg%20fill%3D%22%232D2D2D%22%3E%3Cpath%20d%3D%22M15.47%207.1l-1.3%201.85c-.2.29-.54.47-.9.47h-7.1V7.09c-.01.01%209.3.01%209.3.01z%22%2F%3E%3Cpath%20d%3D%22M24.3%207.1L13.14%2022.91H5.7L16.86%207.1z%22%2F%3E%3Cpath%20d%3D%22M14.53%2022.91l1.31-1.86c.2-.29.54-.47.9-.47h7.09v2.33h-9.3z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E%0A",
31
- name: "智谱 GLM",
32
- region: "国际 · Z.AI",
30
+ name: "\u667a\u8c31 GLM",
31
+ region: "\u56fd\u9645 \u00b7 Z.AI",
33
32
  market: "international",
34
33
  catalogKey: "zai",
35
34
  canListModels: true,
@@ -49,8 +48,8 @@ const catalog = {
49
48
  kind: "vendor",
50
49
  id: "zhipu-coding-cn",
51
50
  logo: "data:image/svg+xml,%3Csvg%20height%3D%2224%22%20viewBox%3D%223%203%2024%2024%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ctitle%3EZhipu%3C%2Ftitle%3E%3Cg%20fill%3D%22%232D2D2D%22%3E%3Cpath%20d%3D%22M15.47%207.1l-1.3%201.85c-.2.29-.54.47-.9.47h-7.1V7.09c-.01.01%209.3.01%209.3.01z%22%2F%3E%3Cpath%20d%3D%22M24.3%207.1L13.14%2022.91H5.7L16.86%207.1z%22%2F%3E%3Cpath%20d%3D%22M14.53%2022.91l1.31-1.86c.2-.29.54-.47.9-.47h7.09v2.33h-9.3z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E%0A",
52
- name: "智谱 GLM Coding Plan",
53
- region: "国内",
51
+ name: "\u667a\u8c31 GLM Coding Plan",
52
+ region: "\u56fd\u5185",
54
53
  market: "domestic",
55
54
  catalogKey: "zhipuai-coding-plan",
56
55
  canListModels: true,
@@ -70,8 +69,8 @@ const catalog = {
70
69
  kind: "vendor",
71
70
  id: "zhipu-coding",
72
71
  logo: "data:image/svg+xml,%3Csvg%20height%3D%2224%22%20viewBox%3D%223%203%2024%2024%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ctitle%3EZhipu%3C%2Ftitle%3E%3Cg%20fill%3D%22%232D2D2D%22%3E%3Cpath%20d%3D%22M15.47%207.1l-1.3%201.85c-.2.29-.54.47-.9.47h-7.1V7.09c-.01.01%209.3.01%209.3.01z%22%2F%3E%3Cpath%20d%3D%22M24.3%207.1L13.14%2022.91H5.7L16.86%207.1z%22%2F%3E%3Cpath%20d%3D%22M14.53%2022.91l1.31-1.86c.2-.29.54-.47.9-.47h7.09v2.33h-9.3z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E%0A",
73
- name: "智谱 GLM Coding Plan",
74
- region: "国际 · Z.AI",
72
+ name: "\u667a\u8c31 GLM Coding Plan",
73
+ region: "\u56fd\u9645 \u00b7 Z.AI",
75
74
  market: "international",
76
75
  catalogKey: "zai-coding-plan",
77
76
  canListModels: true,
@@ -90,15 +89,12 @@ const catalog = {
90
89
  ],
91
90
  snapshot: {
92
91
  "zhipu-cn": {
93
- "glm-5.2": {
94
- "id": "glm-5.2",
95
- "name": "GLM-5.2",
92
+ "glm-4.7": {
93
+ "id": "glm-4.7",
94
+ "name": "GLM-4.7",
96
95
  "family": "glm",
97
96
  "reasoning": true,
98
- "reasoning_options": [{
99
- "type": "effort",
100
- "values": ["high", "max"]
101
- }],
97
+ "reasoning_options": [{ "type": "toggle" }],
102
98
  "temperature": true,
103
99
  "tool_call": true,
104
100
  "attachment": false,
@@ -107,46 +103,15 @@ const catalog = {
107
103
  "output": ["text"]
108
104
  },
109
105
  "limit": {
110
- "context": 1e6,
111
- "output": 131072
112
- },
113
- "release_date": "2026-06-13"
114
- },
115
- "glm-5.3-flash": {
116
- "id": "glm-5.3-flash",
117
- "name": "GLM-5.3-Flash",
118
- "family": "glm-flash",
119
- "reasoning": true,
120
- "reasoning_options": [{
121
- "type": "effort",
122
- "values": [
123
- "low",
124
- "high",
125
- "max"
126
- ]
127
- }],
128
- "temperature": true,
129
- "tool_call": true,
130
- "attachment": true,
131
- "modalities": {
132
- "input": [
133
- "text",
134
- "image",
135
- "video",
136
- "pdf"
137
- ],
138
- "output": ["text"]
139
- },
140
- "limit": {
141
- "context": 1e6,
106
+ "context": 204800,
142
107
  "output": 131072
143
108
  },
144
- "release_date": "2026-08-26"
109
+ "release_date": "2025-12-22"
145
110
  },
146
- "glm-5": {
147
- "id": "glm-5",
148
- "name": "GLM-5",
149
- "family": "glm",
111
+ "glm-4.5-air": {
112
+ "id": "glm-4.5-air",
113
+ "name": "GLM-4.5-Air",
114
+ "family": "glm-air",
150
115
  "reasoning": true,
151
116
  "reasoning_options": [{ "type": "toggle" }],
152
117
  "temperature": true,
@@ -157,10 +122,10 @@ const catalog = {
157
122
  "output": ["text"]
158
123
  },
159
124
  "limit": {
160
- "context": 204800,
161
- "output": 131072
125
+ "context": 131072,
126
+ "output": 98304
162
127
  },
163
- "release_date": "2026-02-11"
128
+ "release_date": "2025-07-28"
164
129
  },
165
130
  "glm-5.1": {
166
131
  "id": "glm-5.1",
@@ -179,21 +144,14 @@ const catalog = {
179
144
  "context": 2e5,
180
145
  "output": 131072
181
146
  },
182
- "release_date": "2026-03-27"
147
+ "release_date": "2026-04-07"
183
148
  },
184
- "glm-5.3": {
185
- "id": "glm-5.3",
186
- "name": "GLM-5.3",
187
- "family": "glm",
149
+ "glm-4.5-flash": {
150
+ "id": "glm-4.5-flash",
151
+ "name": "GLM-4.5-Flash",
152
+ "family": "glm-flash",
188
153
  "reasoning": true,
189
- "reasoning_options": [{
190
- "type": "effort",
191
- "values": [
192
- "low",
193
- "high",
194
- "max"
195
- ]
196
- }],
154
+ "reasoning_options": [{ "type": "toggle" }],
197
155
  "temperature": true,
198
156
  "tool_call": true,
199
157
  "attachment": false,
@@ -202,14 +160,14 @@ const catalog = {
202
160
  "output": ["text"]
203
161
  },
204
162
  "limit": {
205
- "context": 1e6,
206
- "output": 131072
163
+ "context": 131072,
164
+ "output": 98304
207
165
  },
208
- "release_date": "2026-08-14"
166
+ "release_date": "2025-07-28"
209
167
  },
210
- "glm-5v-turbo": {
211
- "id": "glm-5v-turbo",
212
- "name": "GLM-5V-Turbo",
168
+ "glm-4.6v": {
169
+ "id": "glm-4.6v",
170
+ "name": "GLM-4.6V",
213
171
  "family": "glm",
214
172
  "reasoning": true,
215
173
  "reasoning_options": [{ "type": "toggle" }],
@@ -220,21 +178,39 @@ const catalog = {
220
178
  "input": [
221
179
  "text",
222
180
  "image",
223
- "video",
224
- "pdf"
181
+ "video"
225
182
  ],
226
183
  "output": ["text"]
227
184
  },
228
185
  "limit": {
229
- "context": 2e5,
186
+ "context": 128e3,
187
+ "output": 32768
188
+ },
189
+ "release_date": "2025-12-08"
190
+ },
191
+ "glm-4.6": {
192
+ "id": "glm-4.6",
193
+ "name": "GLM-4.6",
194
+ "family": "glm",
195
+ "reasoning": true,
196
+ "reasoning_options": [{ "type": "toggle" }],
197
+ "temperature": true,
198
+ "tool_call": true,
199
+ "attachment": false,
200
+ "modalities": {
201
+ "input": ["text"],
202
+ "output": ["text"]
203
+ },
204
+ "limit": {
205
+ "context": 204800,
230
206
  "output": 131072
231
207
  },
232
- "release_date": "2026-04-01"
208
+ "release_date": "2025-09-30"
233
209
  },
234
- "glm-4.7-flash": {
235
- "id": "glm-4.7-flash",
236
- "name": "GLM-4.7-Flash",
237
- "family": "glm-flash",
210
+ "glm-5": {
211
+ "id": "glm-5",
212
+ "name": "GLM-5",
213
+ "family": "glm",
238
214
  "reasoning": true,
239
215
  "reasoning_options": [{ "type": "toggle" }],
240
216
  "temperature": true,
@@ -245,10 +221,10 @@ const catalog = {
245
221
  "output": ["text"]
246
222
  },
247
223
  "limit": {
248
- "context": 2e5,
224
+ "context": 204800,
249
225
  "output": 131072
250
226
  },
251
- "release_date": "2026-01-19"
227
+ "release_date": "2026-02-12"
252
228
  },
253
229
  "glm-4.7-flashx": {
254
230
  "id": "glm-4.7-flashx",
@@ -269,10 +245,10 @@ const catalog = {
269
245
  },
270
246
  "release_date": "2026-01-19"
271
247
  },
272
- "glm-4.5v": {
273
- "id": "glm-4.5v",
274
- "name": "GLM-4.5V",
275
- "family": "glm",
248
+ "glm-4.6v-flash": {
249
+ "id": "glm-4.6v-flash",
250
+ "name": "GLM-4.6V-Flash",
251
+ "family": "glm-flash",
276
252
  "reasoning": true,
277
253
  "reasoning_options": [{ "type": "toggle" }],
278
254
  "temperature": true,
@@ -287,15 +263,15 @@ const catalog = {
287
263
  "output": ["text"]
288
264
  },
289
265
  "limit": {
290
- "context": 64e3,
291
- "output": 16384
266
+ "context": 128e3,
267
+ "output": 32768
292
268
  },
293
- "release_date": "2025-08-11"
269
+ "release_date": "2025-12-08"
294
270
  },
295
- "glm-4.5": {
296
- "id": "glm-4.5",
297
- "name": "GLM-4.5",
298
- "family": "glm",
271
+ "glm-4.7-flash": {
272
+ "id": "glm-4.7-flash",
273
+ "name": "GLM-4.7-Flash",
274
+ "family": "glm-flash",
299
275
  "reasoning": true,
300
276
  "reasoning_options": [{ "type": "toggle" }],
301
277
  "temperature": true,
@@ -306,17 +282,51 @@ const catalog = {
306
282
  "output": ["text"]
307
283
  },
308
284
  "limit": {
309
- "context": 131072,
310
- "output": 98304
285
+ "context": 2e5,
286
+ "output": 131072
311
287
  },
312
- "release_date": "2025-07-28"
288
+ "release_date": "2026-01-19"
313
289
  },
314
- "glm-4.5-flash": {
315
- "id": "glm-4.5-flash",
316
- "name": "GLM-4.5-Flash",
290
+ "glm-5.3-flash": {
291
+ "id": "glm-5.3-flash",
292
+ "name": "GLM-5.3-Flash",
317
293
  "family": "glm-flash",
318
294
  "reasoning": true,
319
- "reasoning_options": [{ "type": "toggle" }],
295
+ "reasoning_options": [{
296
+ "type": "effort",
297
+ "values": [
298
+ "low",
299
+ "high",
300
+ "max"
301
+ ]
302
+ }],
303
+ "temperature": true,
304
+ "tool_call": true,
305
+ "attachment": true,
306
+ "modalities": {
307
+ "input": [
308
+ "text",
309
+ "image",
310
+ "video",
311
+ "pdf"
312
+ ],
313
+ "output": ["text"]
314
+ },
315
+ "limit": {
316
+ "context": 1e6,
317
+ "output": 131072
318
+ },
319
+ "release_date": "2026-08-26"
320
+ },
321
+ "glm-5.2": {
322
+ "id": "glm-5.2",
323
+ "name": "GLM-5.2",
324
+ "family": "glm",
325
+ "reasoning": true,
326
+ "reasoning_options": [{ "type": "toggle" }, {
327
+ "type": "effort",
328
+ "values": ["high", "max"]
329
+ }],
320
330
  "temperature": true,
321
331
  "tool_call": true,
322
332
  "attachment": false,
@@ -325,14 +335,45 @@ const catalog = {
325
335
  "output": ["text"]
326
336
  },
327
337
  "limit": {
328
- "context": 131072,
329
- "output": 98304
338
+ "context": 1e6,
339
+ "output": 131072
330
340
  },
331
- "release_date": "2025-07-28"
341
+ "release_date": "2026-06-13"
332
342
  },
333
- "glm-4.6v": {
334
- "id": "glm-4.6v",
335
- "name": "GLM-4.6V",
343
+ "glm-5.3-flashx": {
344
+ "id": "glm-5.3-flashx",
345
+ "name": "GLM-5.3-FlashX",
346
+ "family": "glm-flash",
347
+ "reasoning": true,
348
+ "reasoning_options": [{
349
+ "type": "effort",
350
+ "values": [
351
+ "low",
352
+ "high",
353
+ "max"
354
+ ]
355
+ }],
356
+ "temperature": true,
357
+ "tool_call": true,
358
+ "attachment": true,
359
+ "modalities": {
360
+ "input": [
361
+ "text",
362
+ "image",
363
+ "video",
364
+ "pdf"
365
+ ],
366
+ "output": ["text"]
367
+ },
368
+ "limit": {
369
+ "context": 1e6,
370
+ "output": 131072
371
+ },
372
+ "release_date": "2026-09-18"
373
+ },
374
+ "glm-4.5v": {
375
+ "id": "glm-4.5v",
376
+ "name": "GLM-4.5V",
336
377
  "family": "glm",
337
378
  "reasoning": true,
338
379
  "reasoning_options": [{ "type": "toggle" }],
@@ -348,17 +389,24 @@ const catalog = {
348
389
  "output": ["text"]
349
390
  },
350
391
  "limit": {
351
- "context": 128e3,
352
- "output": 32768
392
+ "context": 64e3,
393
+ "output": 16384
353
394
  },
354
- "release_date": "2025-12-08"
395
+ "release_date": "2025-08-11"
355
396
  },
356
- "glm-4.6": {
357
- "id": "glm-4.6",
358
- "name": "GLM-4.6",
397
+ "glm-5.3": {
398
+ "id": "glm-5.3",
399
+ "name": "GLM-5.3",
359
400
  "family": "glm",
360
401
  "reasoning": true,
361
- "reasoning_options": [{ "type": "toggle" }],
402
+ "reasoning_options": [{
403
+ "type": "effort",
404
+ "values": [
405
+ "low",
406
+ "high",
407
+ "max"
408
+ ]
409
+ }],
362
410
  "temperature": true,
363
411
  "tool_call": true,
364
412
  "attachment": false,
@@ -367,15 +415,15 @@ const catalog = {
367
415
  "output": ["text"]
368
416
  },
369
417
  "limit": {
370
- "context": 204800,
418
+ "context": 1e6,
371
419
  "output": 131072
372
420
  },
373
- "release_date": "2025-09-30"
421
+ "release_date": "2026-08-14"
374
422
  },
375
- "glm-4.5-air": {
376
- "id": "glm-4.5-air",
377
- "name": "GLM-4.5-Air",
378
- "family": "glm-air",
423
+ "glm-4.5": {
424
+ "id": "glm-4.5",
425
+ "name": "GLM-4.5",
426
+ "family": "glm",
379
427
  "reasoning": true,
380
428
  "reasoning_options": [{ "type": "toggle" }],
381
429
  "temperature": true,
@@ -391,24 +439,29 @@ const catalog = {
391
439
  },
392
440
  "release_date": "2025-07-28"
393
441
  },
394
- "glm-4.7": {
395
- "id": "glm-4.7",
396
- "name": "GLM-4.7",
442
+ "glm-5v-turbo": {
443
+ "id": "glm-5v-turbo",
444
+ "name": "GLM-5V-Turbo",
397
445
  "family": "glm",
398
446
  "reasoning": true,
399
447
  "reasoning_options": [{ "type": "toggle" }],
400
448
  "temperature": true,
401
449
  "tool_call": true,
402
- "attachment": false,
450
+ "attachment": true,
403
451
  "modalities": {
404
- "input": ["text"],
452
+ "input": [
453
+ "text",
454
+ "image",
455
+ "video",
456
+ "pdf"
457
+ ],
405
458
  "output": ["text"]
406
459
  },
407
460
  "limit": {
408
- "context": 204800,
461
+ "context": 2e5,
409
462
  "output": 131072
410
463
  },
411
- "release_date": "2025-12-22"
464
+ "release_date": "2026-04-01"
412
465
  }
413
466
  },
414
467
  "zhipu": {
@@ -450,9 +503,9 @@ const catalog = {
450
503
  },
451
504
  "release_date": "2025-07-28"
452
505
  },
453
- "glm-4.6": {
454
- "id": "glm-4.6",
455
- "name": "GLM-4.6",
506
+ "glm-5.1": {
507
+ "id": "glm-5.1",
508
+ "name": "GLM-5.1",
456
509
  "family": "glm",
457
510
  "reasoning": true,
458
511
  "reasoning_options": [{ "type": "toggle" }],
@@ -464,10 +517,29 @@ const catalog = {
464
517
  "output": ["text"]
465
518
  },
466
519
  "limit": {
467
- "context": 204800,
520
+ "context": 2e5,
468
521
  "output": 131072
469
522
  },
470
- "release_date": "2025-09-30"
523
+ "release_date": "2026-04-07"
524
+ },
525
+ "glm-4.5-flash": {
526
+ "id": "glm-4.5-flash",
527
+ "name": "GLM-4.5-Flash",
528
+ "family": "glm-flash",
529
+ "reasoning": true,
530
+ "reasoning_options": [{ "type": "toggle" }],
531
+ "temperature": true,
532
+ "tool_call": true,
533
+ "attachment": false,
534
+ "modalities": {
535
+ "input": ["text"],
536
+ "output": ["text"]
537
+ },
538
+ "limit": {
539
+ "context": 131072,
540
+ "output": 98304
541
+ },
542
+ "release_date": "2025-07-28"
471
543
  },
472
544
  "glm-4.6v": {
473
545
  "id": "glm-4.6v",
@@ -492,15 +564,12 @@ const catalog = {
492
564
  },
493
565
  "release_date": "2025-12-08"
494
566
  },
495
- "glm-5.2": {
496
- "id": "glm-5.2",
497
- "name": "GLM-5.2",
567
+ "glm-4.6": {
568
+ "id": "glm-4.6",
569
+ "name": "GLM-4.6",
498
570
  "family": "glm",
499
571
  "reasoning": true,
500
- "reasoning_options": [{
501
- "type": "effort",
502
- "values": ["high", "max"]
503
- }],
572
+ "reasoning_options": [{ "type": "toggle" }],
504
573
  "temperature": true,
505
574
  "tool_call": true,
506
575
  "attachment": false,
@@ -509,14 +578,33 @@ const catalog = {
509
578
  "output": ["text"]
510
579
  },
511
580
  "limit": {
512
- "context": 1e6,
581
+ "context": 204800,
513
582
  "output": 131072
514
583
  },
515
- "release_date": "2026-06-13"
584
+ "release_date": "2025-09-30"
516
585
  },
517
- "glm-4.5-flash": {
518
- "id": "glm-4.5-flash",
519
- "name": "GLM-4.5-Flash",
586
+ "glm-5": {
587
+ "id": "glm-5",
588
+ "name": "GLM-5",
589
+ "family": "glm",
590
+ "reasoning": true,
591
+ "reasoning_options": [{ "type": "toggle" }],
592
+ "temperature": true,
593
+ "tool_call": true,
594
+ "attachment": false,
595
+ "modalities": {
596
+ "input": ["text"],
597
+ "output": ["text"]
598
+ },
599
+ "limit": {
600
+ "context": 204800,
601
+ "output": 131072
602
+ },
603
+ "release_date": "2026-02-12"
604
+ },
605
+ "glm-4.7-flashx": {
606
+ "id": "glm-4.7-flashx",
607
+ "name": "GLM-4.7-FlashX",
520
608
  "family": "glm-flash",
521
609
  "reasoning": true,
522
610
  "reasoning_options": [{ "type": "toggle" }],
@@ -528,24 +616,17 @@ const catalog = {
528
616
  "output": ["text"]
529
617
  },
530
618
  "limit": {
531
- "context": 131072,
532
- "output": 98304
619
+ "context": 2e5,
620
+ "output": 131072
533
621
  },
534
- "release_date": "2025-07-28"
622
+ "release_date": "2026-01-19"
535
623
  },
536
- "glm-5.3-flash": {
537
- "id": "glm-5.3-flash",
538
- "name": "GLM-5.3-Flash",
624
+ "glm-4.6v-flash": {
625
+ "id": "glm-4.6v-flash",
626
+ "name": "GLM-4.6V-Flash",
539
627
  "family": "glm-flash",
540
628
  "reasoning": true,
541
- "reasoning_options": [{
542
- "type": "effort",
543
- "values": [
544
- "low",
545
- "high",
546
- "max"
547
- ]
548
- }],
629
+ "reasoning_options": [{ "type": "toggle" }],
549
630
  "temperature": true,
550
631
  "tool_call": true,
551
632
  "attachment": true,
@@ -553,21 +634,20 @@ const catalog = {
553
634
  "input": [
554
635
  "text",
555
636
  "image",
556
- "video",
557
- "pdf"
637
+ "video"
558
638
  ],
559
639
  "output": ["text"]
560
640
  },
561
641
  "limit": {
562
- "context": 1e6,
563
- "output": 131072
642
+ "context": 128e3,
643
+ "output": 32768
564
644
  },
565
- "release_date": "2026-08-26"
645
+ "release_date": "2025-12-08"
566
646
  },
567
- "glm-4.5": {
568
- "id": "glm-4.5",
569
- "name": "GLM-4.5",
570
- "family": "glm",
647
+ "glm-4.7-flash": {
648
+ "id": "glm-4.7-flash",
649
+ "name": "GLM-4.7-Flash",
650
+ "family": "glm-flash",
571
651
  "reasoning": true,
572
652
  "reasoning_options": [{ "type": "toggle" }],
573
653
  "temperature": true,
@@ -578,17 +658,24 @@ const catalog = {
578
658
  "output": ["text"]
579
659
  },
580
660
  "limit": {
581
- "context": 131072,
582
- "output": 98304
661
+ "context": 2e5,
662
+ "output": 131072
583
663
  },
584
- "release_date": "2025-07-28"
664
+ "release_date": "2026-01-19"
585
665
  },
586
- "glm-4.5v": {
587
- "id": "glm-4.5v",
588
- "name": "GLM-4.5V",
589
- "family": "glm",
666
+ "glm-5.3-flash": {
667
+ "id": "glm-5.3-flash",
668
+ "name": "GLM-5.3-Flash",
669
+ "family": "glm-flash",
590
670
  "reasoning": true,
591
- "reasoning_options": [{ "type": "toggle" }],
671
+ "reasoning_options": [{
672
+ "type": "effort",
673
+ "values": [
674
+ "low",
675
+ "high",
676
+ "max"
677
+ ]
678
+ }],
592
679
  "temperature": true,
593
680
  "tool_call": true,
594
681
  "attachment": true,
@@ -596,20 +683,21 @@ const catalog = {
596
683
  "input": [
597
684
  "text",
598
685
  "image",
599
- "video"
686
+ "video",
687
+ "pdf"
600
688
  ],
601
689
  "output": ["text"]
602
690
  },
603
691
  "limit": {
604
- "context": 64e3,
605
- "output": 16384
692
+ "context": 1e6,
693
+ "output": 131072
606
694
  },
607
- "release_date": "2025-08-11"
695
+ "release_date": "2026-08-26"
608
696
  },
609
- "glm-4.7-flashx": {
610
- "id": "glm-4.7-flashx",
611
- "name": "GLM-4.7-FlashX",
612
- "family": "glm-flash",
697
+ "glm-5-turbo": {
698
+ "id": "glm-5-turbo",
699
+ "name": "GLM-5-Turbo",
700
+ "family": "glm",
613
701
  "reasoning": true,
614
702
  "reasoning_options": [{ "type": "toggle" }],
615
703
  "temperature": true,
@@ -623,14 +711,17 @@ const catalog = {
623
711
  "context": 2e5,
624
712
  "output": 131072
625
713
  },
626
- "release_date": "2026-01-19"
714
+ "release_date": "2026-03-16"
627
715
  },
628
- "glm-5": {
629
- "id": "glm-5",
630
- "name": "GLM-5",
716
+ "glm-5.2": {
717
+ "id": "glm-5.2",
718
+ "name": "GLM-5.2",
631
719
  "family": "glm",
632
720
  "reasoning": true,
633
- "reasoning_options": [{ "type": "toggle" }],
721
+ "reasoning_options": [{ "type": "toggle" }, {
722
+ "type": "effort",
723
+ "values": ["high", "max"]
724
+ }],
634
725
  "temperature": true,
635
726
  "tool_call": true,
636
727
  "attachment": false,
@@ -639,48 +730,64 @@ const catalog = {
639
730
  "output": ["text"]
640
731
  },
641
732
  "limit": {
642
- "context": 204800,
733
+ "context": 1e6,
643
734
  "output": 131072
644
735
  },
645
- "release_date": "2026-02-12"
736
+ "release_date": "2026-06-13"
646
737
  },
647
- "glm-5.1": {
648
- "id": "glm-5.1",
649
- "name": "GLM-5.1",
650
- "family": "glm",
738
+ "glm-5.3-flashx": {
739
+ "id": "glm-5.3-flashx",
740
+ "name": "GLM-5.3-FlashX",
741
+ "family": "glm-flash",
651
742
  "reasoning": true,
652
- "reasoning_options": [{ "type": "toggle" }],
743
+ "reasoning_options": [{
744
+ "type": "effort",
745
+ "values": [
746
+ "low",
747
+ "high",
748
+ "max"
749
+ ]
750
+ }],
653
751
  "temperature": true,
654
752
  "tool_call": true,
655
- "attachment": false,
753
+ "attachment": true,
656
754
  "modalities": {
657
- "input": ["text"],
755
+ "input": [
756
+ "text",
757
+ "image",
758
+ "video",
759
+ "pdf"
760
+ ],
658
761
  "output": ["text"]
659
762
  },
660
763
  "limit": {
661
- "context": 2e5,
764
+ "context": 1e6,
662
765
  "output": 131072
663
766
  },
664
- "release_date": "2026-04-07"
767
+ "release_date": "2026-09-18"
665
768
  },
666
- "glm-5-turbo": {
667
- "id": "glm-5-turbo",
668
- "name": "GLM-5-Turbo",
769
+ "glm-4.5v": {
770
+ "id": "glm-4.5v",
771
+ "name": "GLM-4.5V",
669
772
  "family": "glm",
670
773
  "reasoning": true,
671
774
  "reasoning_options": [{ "type": "toggle" }],
672
775
  "temperature": true,
673
776
  "tool_call": true,
674
- "attachment": false,
777
+ "attachment": true,
675
778
  "modalities": {
676
- "input": ["text"],
779
+ "input": [
780
+ "text",
781
+ "image",
782
+ "video"
783
+ ],
677
784
  "output": ["text"]
678
785
  },
679
786
  "limit": {
680
- "context": 2e5,
681
- "output": 131072
787
+ "context": 64e3,
788
+ "output": 16384
682
789
  },
683
- "release_date": "2026-03-16"
790
+ "release_date": "2025-08-11"
684
791
  },
685
792
  "glm-5.3": {
686
793
  "id": "glm-5.3",
@@ -708,64 +815,31 @@ const catalog = {
708
815
  },
709
816
  "release_date": "2026-08-14"
710
817
  },
711
- "glm-5v-turbo": {
712
- "id": "glm-5v-turbo",
713
- "name": "GLM-5V-Turbo",
818
+ "glm-4.5": {
819
+ "id": "glm-4.5",
820
+ "name": "GLM-4.5",
714
821
  "family": "glm",
715
822
  "reasoning": true,
716
823
  "reasoning_options": [{ "type": "toggle" }],
717
824
  "temperature": true,
718
825
  "tool_call": true,
719
- "attachment": true,
720
- "modalities": {
721
- "input": [
722
- "text",
723
- "image",
724
- "video",
725
- "pdf"
726
- ],
727
- "output": ["text"]
728
- },
729
- "limit": {
730
- "context": 2e5,
731
- "output": 131072
732
- },
733
- "release_date": "2026-04-01"
734
- },
735
- "glm-4.7-flash": {
736
- "id": "glm-4.7-flash",
737
- "name": "GLM-4.7-Flash",
738
- "family": "glm-flash",
739
- "reasoning": true,
740
- "reasoning_options": [{ "type": "toggle" }],
741
- "temperature": true,
742
- "tool_call": true,
743
826
  "attachment": false,
744
827
  "modalities": {
745
828
  "input": ["text"],
746
829
  "output": ["text"]
747
830
  },
748
831
  "limit": {
749
- "context": 2e5,
750
- "output": 131072
832
+ "context": 131072,
833
+ "output": 98304
751
834
  },
752
- "release_date": "2026-01-19"
753
- }
754
- },
755
- "zhipu-coding-cn": {
756
- "glm-5.3-flash": {
757
- "id": "glm-5.3-flash",
758
- "name": "GLM-5.3-Flash",
759
- "family": "glm-flash",
835
+ "release_date": "2025-07-28"
836
+ },
837
+ "glm-5v-turbo": {
838
+ "id": "glm-5v-turbo",
839
+ "name": "GLM-5V-Turbo",
840
+ "family": "glm",
760
841
  "reasoning": true,
761
- "reasoning_options": [{
762
- "type": "effort",
763
- "values": [
764
- "low",
765
- "high",
766
- "max"
767
- ]
768
- }],
842
+ "reasoning_options": [{ "type": "toggle" }],
769
843
  "temperature": true,
770
844
  "tool_call": true,
771
845
  "attachment": true,
@@ -779,11 +853,13 @@ const catalog = {
779
853
  "output": ["text"]
780
854
  },
781
855
  "limit": {
782
- "context": 1e6,
856
+ "context": 2e5,
783
857
  "output": 131072
784
858
  },
785
- "release_date": "2026-08-26"
786
- },
859
+ "release_date": "2026-04-01"
860
+ }
861
+ },
862
+ "zhipu-coding-cn": {
787
863
  "glm-5.3-highspeed": {
788
864
  "id": "glm-5.3-highspeed",
789
865
  "name": "GLM-5.3 Highspeed",
@@ -810,32 +886,6 @@ const catalog = {
810
886
  },
811
887
  "release_date": "2026-08-14"
812
888
  },
813
- "glm-5.3": {
814
- "id": "glm-5.3",
815
- "name": "GLM-5.3",
816
- "family": "glm",
817
- "reasoning": true,
818
- "reasoning_options": [{
819
- "type": "effort",
820
- "values": [
821
- "low",
822
- "high",
823
- "max"
824
- ]
825
- }],
826
- "temperature": true,
827
- "tool_call": true,
828
- "attachment": false,
829
- "modalities": {
830
- "input": ["text"],
831
- "output": ["text"]
832
- },
833
- "limit": {
834
- "context": 1e6,
835
- "output": 131072
836
- },
837
- "release_date": "2026-08-14"
838
- },
839
889
  "glm-4.6v": {
840
890
  "id": "glm-4.6v",
841
891
  "name": "GLM-4.6V",
@@ -858,9 +908,7 @@ const catalog = {
858
908
  "output": 32768
859
909
  },
860
910
  "release_date": "2025-12-08"
861
- }
862
- },
863
- "zhipu-coding": {
911
+ },
864
912
  "glm-5.3-flash": {
865
913
  "id": "glm-5.3-flash",
866
914
  "name": "GLM-5.3-Flash",
@@ -892,9 +940,9 @@ const catalog = {
892
940
  },
893
941
  "release_date": "2026-08-26"
894
942
  },
895
- "glm-5.3-highspeed": {
896
- "id": "glm-5.3-highspeed",
897
- "name": "GLM-5.3 Highspeed",
943
+ "glm-5.3": {
944
+ "id": "glm-5.3",
945
+ "name": "GLM-5.3",
898
946
  "family": "glm",
899
947
  "reasoning": true,
900
948
  "reasoning_options": [{
@@ -917,16 +965,15 @@ const catalog = {
917
965
  "output": 131072
918
966
  },
919
967
  "release_date": "2026-08-14"
920
- },
921
- "glm-5.2-highspeed": {
922
- "id": "glm-5.2-highspeed",
923
- "name": "GLM-5.2 Highspeed",
968
+ }
969
+ },
970
+ "zhipu-coding": {
971
+ "glm-4.7": {
972
+ "id": "glm-4.7",
973
+ "name": "GLM-4.7",
924
974
  "family": "glm",
925
975
  "reasoning": true,
926
- "reasoning_options": [{
927
- "type": "effort",
928
- "values": ["high", "max"]
929
- }],
976
+ "reasoning_options": [{ "type": "toggle" }],
930
977
  "temperature": true,
931
978
  "tool_call": true,
932
979
  "attachment": false,
@@ -935,17 +982,24 @@ const catalog = {
935
982
  "output": ["text"]
936
983
  },
937
984
  "limit": {
938
- "context": 1e6,
985
+ "context": 204800,
939
986
  "output": 131072
940
987
  },
941
- "release_date": "2026-06-13"
988
+ "release_date": "2025-12-22"
942
989
  },
943
- "glm-4.7": {
944
- "id": "glm-4.7",
945
- "name": "GLM-4.7",
990
+ "glm-5.3-highspeed": {
991
+ "id": "glm-5.3-highspeed",
992
+ "name": "GLM-5.3 Highspeed",
946
993
  "family": "glm",
947
994
  "reasoning": true,
948
- "reasoning_options": [{ "type": "toggle" }],
995
+ "reasoning_options": [{
996
+ "type": "effort",
997
+ "values": [
998
+ "low",
999
+ "high",
1000
+ "max"
1001
+ ]
1002
+ }],
949
1003
  "temperature": true,
950
1004
  "tool_call": true,
951
1005
  "attachment": false,
@@ -954,32 +1008,41 @@ const catalog = {
954
1008
  "output": ["text"]
955
1009
  },
956
1010
  "limit": {
957
- "context": 204800,
1011
+ "context": 1e6,
958
1012
  "output": 131072
959
1013
  },
960
- "release_date": "2025-12-22"
1014
+ "release_date": "2026-08-14"
961
1015
  },
962
- "glm-5.2": {
963
- "id": "glm-5.2",
964
- "name": "GLM-5.2",
965
- "family": "glm",
1016
+ "glm-5.3-flash": {
1017
+ "id": "glm-5.3-flash",
1018
+ "name": "GLM-5.3-Flash",
1019
+ "family": "glm-flash",
966
1020
  "reasoning": true,
967
1021
  "reasoning_options": [{
968
1022
  "type": "effort",
969
- "values": ["high", "max"]
1023
+ "values": [
1024
+ "low",
1025
+ "high",
1026
+ "max"
1027
+ ]
970
1028
  }],
971
1029
  "temperature": true,
972
1030
  "tool_call": true,
973
- "attachment": false,
1031
+ "attachment": true,
974
1032
  "modalities": {
975
- "input": ["text"],
1033
+ "input": [
1034
+ "text",
1035
+ "image",
1036
+ "video",
1037
+ "pdf"
1038
+ ],
976
1039
  "output": ["text"]
977
1040
  },
978
1041
  "limit": {
979
1042
  "context": 1e6,
980
1043
  "output": 131072
981
1044
  },
982
- "release_date": "2026-06-13"
1045
+ "release_date": "2026-08-26"
983
1046
  },
984
1047
  "glm-5-turbo": {
985
1048
  "id": "glm-5-turbo",
@@ -1000,6 +1063,28 @@ const catalog = {
1000
1063
  },
1001
1064
  "release_date": "2026-03-16"
1002
1065
  },
1066
+ "glm-5.2": {
1067
+ "id": "glm-5.2",
1068
+ "name": "GLM-5.2",
1069
+ "family": "glm",
1070
+ "reasoning": true,
1071
+ "reasoning_options": [{ "type": "toggle" }, {
1072
+ "type": "effort",
1073
+ "values": ["high", "max"]
1074
+ }],
1075
+ "temperature": true,
1076
+ "tool_call": true,
1077
+ "attachment": false,
1078
+ "modalities": {
1079
+ "input": ["text"],
1080
+ "output": ["text"]
1081
+ },
1082
+ "limit": {
1083
+ "context": 1e6,
1084
+ "output": 131072
1085
+ },
1086
+ "release_date": "2026-06-13"
1087
+ },
1003
1088
  "glm-5.3": {
1004
1089
  "id": "glm-5.3",
1005
1090
  "name": "GLM-5.3",
@@ -1025,14 +1110,384 @@ const catalog = {
1025
1110
  "output": 131072
1026
1111
  },
1027
1112
  "release_date": "2026-08-14"
1113
+ },
1114
+ "glm-5.2-highspeed": {
1115
+ "id": "glm-5.2-highspeed",
1116
+ "name": "GLM-5.2 Highspeed",
1117
+ "family": "glm",
1118
+ "reasoning": true,
1119
+ "reasoning_options": [{ "type": "toggle" }, {
1120
+ "type": "effort",
1121
+ "values": ["high", "max"]
1122
+ }],
1123
+ "temperature": true,
1124
+ "tool_call": true,
1125
+ "attachment": false,
1126
+ "modalities": {
1127
+ "input": ["text"],
1128
+ "output": ["text"]
1129
+ },
1130
+ "limit": {
1131
+ "context": 1e6,
1132
+ "output": 131072
1133
+ },
1134
+ "release_date": "2026-06-13"
1028
1135
  }
1029
1136
  }
1030
1137
  },
1031
- snapshotAt: Date.parse("2026-09-17")
1138
+ snapshotAt: Date.parse("2026-11-18")
1139
+ };
1140
+ //#endregion
1141
+ //#region src/facts.ts
1142
+ const verifiedAt = "2026-10-29";
1143
+ const regions = {
1144
+ "zhipu-cn": {
1145
+ overview: "https://docs.bigmodel.cn/cn/guide/start/model-overview",
1146
+ output: "https://docs.bigmodel.cn/cn/guide/start/concept-param",
1147
+ coding: "zhipu-coding-cn",
1148
+ codingModels: "https://docs.bigmodel.cn/cn/coding-plan/latest-model"
1149
+ },
1150
+ zhipu: {
1151
+ overview: "https://docs.z.ai/guides/overview/overview",
1152
+ output: "https://docs.z.ai/api-reference/llm/chat-completion",
1153
+ coding: "zhipu-coding",
1154
+ codingModels: "https://docs.z.ai/devpack/latest-model"
1155
+ }
1156
+ };
1157
+ const apiModels = [
1158
+ "glm-5.3",
1159
+ "glm-5.3-flash",
1160
+ "glm-5.3-flashx",
1161
+ "glm-5.3-flashx-legal",
1162
+ "glm-5.2",
1163
+ "glm-5.1",
1164
+ "glm-5",
1165
+ "glm-5-turbo",
1166
+ "glm-5v-turbo",
1167
+ "glm-4.7",
1168
+ "glm-4.7-flash",
1169
+ "glm-4.7-flashx",
1170
+ "glm-4.6",
1171
+ "glm-4.6v",
1172
+ "glm-4.5",
1173
+ "glm-4.5-air",
1174
+ "glm-4.5-flash",
1175
+ "glm-4.5v"
1176
+ ];
1177
+ const contextFloors = [
1178
+ [
1179
+ "glm-5",
1180
+ 2e5,
1181
+ 204800
1182
+ ],
1183
+ [
1184
+ "glm-4.7",
1185
+ 2e5,
1186
+ 204800
1187
+ ],
1188
+ [
1189
+ "glm-4.6",
1190
+ 2e5,
1191
+ 204800
1192
+ ],
1193
+ [
1194
+ "glm-4.5",
1195
+ 128e3,
1196
+ 131072
1197
+ ],
1198
+ [
1199
+ "glm-4.5-air",
1200
+ 128e3,
1201
+ 131072
1202
+ ],
1203
+ [
1204
+ "glm-4.5-flash",
1205
+ 128e3,
1206
+ 131072
1207
+ ]
1208
+ ];
1209
+ const flashx = {
1210
+ chat: true,
1211
+ reasoning: true,
1212
+ tool_call: true,
1213
+ attachment: true,
1214
+ modalities: {
1215
+ input: [
1216
+ "text",
1217
+ "image",
1218
+ "video"
1219
+ ],
1220
+ output: ["text"]
1221
+ },
1222
+ reasoning_options: [{
1223
+ type: "effort",
1224
+ values: [
1225
+ "low",
1226
+ "high",
1227
+ "max"
1228
+ ]
1229
+ }]
1230
+ };
1231
+ function apiRevisions(endpointId) {
1232
+ const { overview } = regions[endpointId];
1233
+ return [...contextFloors.map(([model, value, catalogue]) => ({
1234
+ endpointId,
1235
+ model,
1236
+ field: "limit.context",
1237
+ value,
1238
+ corrects: { catalogue },
1239
+ source: overview,
1240
+ verifiedAt
1241
+ })), ...apiModels.flatMap((model) => ["openai-responses", "anthropic"].map((protocolId) => ({
1242
+ endpointId,
1243
+ protocolId,
1244
+ model,
1245
+ field: "limit.output",
1246
+ value: { unknown: true },
1247
+ corrects: { structural: "GLM declares numeric output maxima only for Chat Completions" },
1248
+ source: overview,
1249
+ verifiedAt
1250
+ })))];
1251
+ }
1252
+ function codingRevisions(api) {
1253
+ const { coding: endpointId, codingModels: source } = regions[api];
1254
+ return ["glm-5.3", "glm-5.3-flash"].flatMap((model) => [{
1255
+ endpointId,
1256
+ model,
1257
+ field: "limit.output",
1258
+ value: { unknown: true },
1259
+ corrects: { structural: "GLM Coding Plan publishes no output maximum" },
1260
+ source,
1261
+ verifiedAt
1262
+ }, ...["openai-responses", "anthropic"].map((protocolId) => ({
1263
+ endpointId,
1264
+ protocolId,
1265
+ model,
1266
+ field: "limit.context",
1267
+ value: 2e5,
1268
+ corrects: { structural: "GLM Coding Plan grants 1M context only through Chat Completions" },
1269
+ source,
1270
+ verifiedAt
1271
+ }))]);
1272
+ }
1273
+ function presets(endpointId) {
1274
+ const missing = [[
1275
+ "glm-5.3-flashx-legal",
1276
+ flashx,
1277
+ 1e6
1278
+ ]];
1279
+ if (endpointId === "zhipu-cn") missing.push([
1280
+ "glm-5-turbo",
1281
+ {},
1282
+ 2e5
1283
+ ]);
1284
+ return missing.flatMap(([model, entry, context]) => [{
1285
+ endpointId,
1286
+ model,
1287
+ entry: {
1288
+ ...entry,
1289
+ limit: { context }
1290
+ }
1291
+ }, {
1292
+ endpointId,
1293
+ protocolId: "openai",
1294
+ model,
1295
+ entry: {
1296
+ ...entry,
1297
+ limit: {
1298
+ context,
1299
+ output: 131072
1300
+ }
1301
+ }
1302
+ }]);
1303
+ }
1304
+ const modelFacts = {
1305
+ revisions: [
1306
+ ...apiRevisions("zhipu-cn"),
1307
+ ...apiRevisions("zhipu"),
1308
+ ...codingRevisions("zhipu-cn"),
1309
+ ...codingRevisions("zhipu")
1310
+ ],
1311
+ presets: [...presets("zhipu-cn"), ...presets("zhipu")]
1032
1312
  };
1033
1313
  //#endregion
1314
+ //#region src/resources.ts
1315
+ function failure(detail) {
1316
+ const code = detail === "Resource request failed" ? "source-failed" : "invalid-response";
1317
+ return Object.assign(new Error(code), {
1318
+ name: "ProviderResourceFailure",
1319
+ code,
1320
+ retryable: false
1321
+ });
1322
+ }
1323
+ const labels = (en, zh) => ({
1324
+ "en-US": en,
1325
+ "zh-CN": zh
1326
+ });
1327
+ function object(value) {
1328
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw failure("Invalid resource response");
1329
+ return value;
1330
+ }
1331
+ function decimal(value) {
1332
+ const text = typeof value === "number" && Number.isFinite(value) ? String(value) : value;
1333
+ if (typeof text !== "string" || !/^-?(0|[1-9]\d*)(\.\d+)?$/.test(text)) throw failure("Invalid resource amount");
1334
+ const normalized = text.includes(".") ? text.replace(/0+$/, "").replace(/\.$/, "") : text;
1335
+ return normalized === "-0" ? "0" : normalized;
1336
+ }
1337
+ function resourceCapability(endpointId) {
1338
+ if (!endpointId.endsWith("-cn")) return {
1339
+ support: "unsupported",
1340
+ reason: "unsupported",
1341
+ sources: [],
1342
+ presets: []
1343
+ };
1344
+ const plan = endpointId === "zhipu-coding-cn";
1345
+ const id = plan ? "plan" : "account";
1346
+ const base = "https://open.bigmodel.cn/api";
1347
+ return {
1348
+ support: "supported",
1349
+ applicability: {
1350
+ kind: "base-url",
1351
+ defaultBaseUrl: `${base}/${plan ? "coding/paas/v4" : "v1"}`,
1352
+ allowedBaseUrls: [
1353
+ `${base}/v1`,
1354
+ `${base}/anthropic/v1`,
1355
+ `${base}/${plan ? "coding/paas/v4" : "paas/v4"}`
1356
+ ]
1357
+ },
1358
+ sources: [{
1359
+ id,
1360
+ labels: labels("Account resources", "\u8d26\u6237\u8d44\u6e90"),
1361
+ optional: false,
1362
+ allowedHeaderNames: ["Authorization"],
1363
+ requests: [{
1364
+ id,
1365
+ method: "GET",
1366
+ url: plan ? "https://open.bigmodel.cn/api/monitor/usage/quota/limit" : "https://www.bigmodel.cn/api/biz/account/query-customer-account-report"
1367
+ }]
1368
+ }],
1369
+ presets: [{
1370
+ id: plan ? "subscription" : "available-balance",
1371
+ labels: plan ? labels("Subscription", "\u8ba2\u9605\u989d\u5ea6") : labels("Available balance", "\u53ef\u7528\u4f59\u989d"),
1372
+ sourceId: id,
1373
+ order: 0,
1374
+ recommended: true,
1375
+ format: plan ? "quota-windows" : "amount",
1376
+ match: { group: plan ? "subscription-windows" : "available-balance" }
1377
+ }]
1378
+ };
1379
+ }
1380
+ async function readResourceSource(input) {
1381
+ if (!["zhipu-cn", "zhipu-coding-cn"].includes(input.endpointId)) return {
1382
+ kind: "unavailable",
1383
+ reason: "unsupported"
1384
+ };
1385
+ const sourceId = input.endpointId === "zhipu-cn" ? "account" : "plan";
1386
+ if (input.sourceId !== sourceId) throw failure("Invalid resource source");
1387
+ if (!input.secrets.apiKey) return {
1388
+ kind: "unavailable",
1389
+ reason: "auth-required"
1390
+ };
1391
+ const response = await input.queryJSON({
1392
+ requestId: sourceId,
1393
+ headers: { Authorization: `Bearer ${input.secrets.apiKey}` }
1394
+ });
1395
+ if (response.status === 401) return {
1396
+ kind: "unavailable",
1397
+ reason: "auth-required"
1398
+ };
1399
+ if (response.status === 403) return {
1400
+ kind: "unavailable",
1401
+ reason: "permission-denied"
1402
+ };
1403
+ if (response.status !== 200) throw failure("Resource request failed");
1404
+ const body = object(response.body);
1405
+ if (body.success !== true || body.code !== 200) throw failure("Resource request failed");
1406
+ const data = object(body.data);
1407
+ if (data.organizationId != null || data.projectId != null || data.teamId != null) return {
1408
+ kind: "unavailable",
1409
+ reason: "permission-denied"
1410
+ };
1411
+ if (sourceId === "account") {
1412
+ const value = data.availableBalance ?? data.balance;
1413
+ if (value === void 0) throw failure("Invalid resource response");
1414
+ const amount = decimal(value);
1415
+ return {
1416
+ kind: "ready",
1417
+ resources: [{
1418
+ kind: "balance",
1419
+ id: "available-balance",
1420
+ group: "available-balance",
1421
+ labels: labels("Available balance", "\u53ef\u7528\u4f59\u989d"),
1422
+ meaning: Number(amount) <= 0 ? "exhausted" : "available",
1423
+ valueOrigin: "reported",
1424
+ remaining: {
1425
+ value: amount,
1426
+ unit: {
1427
+ kind: "currency",
1428
+ code: "CNY"
1429
+ }
1430
+ }
1431
+ }]
1432
+ };
1433
+ }
1434
+ if (!Array.isArray(data.limits)) throw failure("Invalid resource response");
1435
+ const resources = [];
1436
+ for (const raw of data.limits) {
1437
+ const row = object(raw);
1438
+ const type = row.type;
1439
+ if (type !== "TOKENS_LIMIT" && type !== "CREDIT_LIMIT" && type !== "TIME_LIMIT") continue;
1440
+ if (typeof row.unit !== "number" || !Number.isSafeInteger(row.unit) || typeof row.number !== "number" || !Number.isSafeInteger(row.number) || row.number <= 0) throw failure("Invalid resource window");
1441
+ const percent = row.percentage;
1442
+ if (percent !== void 0 && (typeof percent !== "number" || !Number.isFinite(percent) || percent < 0 || percent > 100)) throw failure("Invalid resource percentage");
1443
+ const unit = type === "CREDIT_LIMIT" ? {
1444
+ kind: "credit",
1445
+ namespace: "glm",
1446
+ label: "Credits"
1447
+ } : {
1448
+ kind: "count",
1449
+ namespace: "glm-tools",
1450
+ label: "Calls"
1451
+ };
1452
+ const reset = typeof row.nextResetTime === "number" && Number.isFinite(row.nextResetTime) ? new Date(row.nextResetTime).toISOString() : void 0;
1453
+ resources.push({
1454
+ kind: "quota",
1455
+ id: `${type.toLowerCase().replaceAll("_", "-")}-${row.unit}-${row.number}`,
1456
+ group: type === "TIME_LIMIT" ? "tool-limits" : "subscription-windows",
1457
+ labels: type === "TIME_LIMIT" ? labels("Tool call limit", "\u5de5\u5177\u8c03\u7528\u9650\u989d") : type === "CREDIT_LIMIT" ? labels("Credit quota", "\u79ef\u5206\u989d\u5ea6") : labels("Subscription quota", "\u8ba2\u9605\u989d\u5ea6"),
1458
+ meaning: percent === 100 ? "exhausted" : percent === void 0 ? "unknown" : "available",
1459
+ valueOrigin: "reported",
1460
+ window: {
1461
+ ...row.unit === 3 ? { durationSeconds: row.number * 3600 } : {},
1462
+ reset: reset ? {
1463
+ kind: "fixed",
1464
+ at: reset
1465
+ } : { kind: "unknown" }
1466
+ },
1467
+ ...typeof percent === "number" ? { usedPercent: percent } : {},
1468
+ ...type !== "TOKENS_LIMIT" ? {
1469
+ ...row.usage !== void 0 ? { limit: {
1470
+ value: decimal(row.usage),
1471
+ unit
1472
+ } } : {},
1473
+ ...row.currentValue !== void 0 ? { used: {
1474
+ value: decimal(row.currentValue),
1475
+ unit
1476
+ } } : {},
1477
+ ...row.remaining !== void 0 ? { remaining: {
1478
+ value: decimal(row.remaining),
1479
+ unit
1480
+ } } : {}
1481
+ } : {}
1482
+ });
1483
+ }
1484
+ return {
1485
+ kind: "ready",
1486
+ resources
1487
+ };
1488
+ }
1489
+ //#endregion
1034
1490
  //#region src/routing.ts
1035
- /** Maps only declared official roots; protocol implementations own the remaining resource URI. */
1036
1491
  function connectionConfig(endpoint, protocolId, config, aliases = []) {
1037
1492
  const defaults = Object.values(endpoint.capabilities).find((one) => one.protocolIds.includes(protocolId))?.protocolDefaults?.[protocolId] ?? {};
1038
1493
  const configured = config.baseUrl;
@@ -1053,7 +1508,7 @@ function connectionConfig(endpoint, protocolId, config, aliases = []) {
1053
1508
  const endpoints = [
1054
1509
  {
1055
1510
  id: "zhipu-cn",
1056
- label: "智谱 GLM · 国内",
1511
+ label: "\u667a\u8c31 GLM \u00b7 \u56fd\u5185",
1057
1512
  capabilities: { chat: {
1058
1513
  protocolIds: [
1059
1514
  "openai",
@@ -1076,7 +1531,7 @@ const endpoints = [
1076
1531
  },
1077
1532
  {
1078
1533
  id: "zhipu",
1079
- label: "智谱 GLM · 国际 · Z.AI",
1534
+ label: "\u667a\u8c31 GLM \u00b7 \u56fd\u9645 \u00b7 Z.AI",
1080
1535
  capabilities: { chat: {
1081
1536
  protocolIds: [
1082
1537
  "openai",
@@ -1098,7 +1553,7 @@ const endpoints = [
1098
1553
  },
1099
1554
  {
1100
1555
  id: "zhipu-coding-cn",
1101
- label: "智谱 GLM Coding Plan · 国内",
1556
+ label: "\u667a\u8c31 GLM Coding Plan \u00b7 \u56fd\u5185",
1102
1557
  capabilities: { chat: {
1103
1558
  protocolIds: [
1104
1559
  "openai",
@@ -1120,7 +1575,7 @@ const endpoints = [
1120
1575
  },
1121
1576
  {
1122
1577
  id: "zhipu-coding",
1123
- label: "智谱 GLM Coding Plan · 国际 · Z.AI",
1578
+ label: "\u667a\u8c31 GLM Coding Plan \u00b7 \u56fd\u9645 \u00b7 Z.AI",
1124
1579
  capabilities: { chat: {
1125
1580
  protocolIds: [
1126
1581
  "openai",
@@ -1161,10 +1616,11 @@ const protocolOptions = {
1161
1616
  thinkingMode: "enabled"
1162
1617
  }
1163
1618
  };
1164
- /** Builds this supplier's declaration without network activity or protocol imports. */
1165
1619
  function glmProviderType(support) {
1166
1620
  return {
1167
1621
  type: "glm",
1622
+ listingContractVersion: "capacity-listing-v1",
1623
+ modelFacts,
1168
1624
  label: "GLM",
1169
1625
  fields: [{
1170
1626
  key: "apiKey",
@@ -1172,7 +1628,11 @@ function glmProviderType(support) {
1172
1628
  label: "API Key",
1173
1629
  required: true
1174
1630
  }],
1175
- endpoints,
1631
+ endpoints: endpoints.map((endpoint) => ({
1632
+ ...endpoint,
1633
+ resourceCapability: resourceCapability(endpoint.id)
1634
+ })),
1635
+ readResourceSource,
1176
1636
  catalog: support ? {
1177
1637
  ...catalog,
1178
1638
  source: support.catalogueSource("https://models.dev/api.json", "models")
@@ -1189,7 +1649,6 @@ function glmProviderType(support) {
1189
1649
  }
1190
1650
  //#endregion
1191
1651
  //#region src/index.ts
1192
- /** Suppliers contribute no tools. */
1193
1652
  const TOOL_NAMES = [];
1194
1653
  const plugin = {
1195
1654
  name: "@eum-agent/llm-provider-zhipu",