@serviceme/devtools-shared 0.4.5 → 0.4.7

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.
package/dist/index.js CHANGED
@@ -46,6 +46,7 @@ __export(index_exports, {
46
46
  checkGitHubOrgMembership: () => checkGitHubOrgMembership,
47
47
  createConsoleLogger: () => createConsoleLogger,
48
48
  currencyForBaseUrl: () => currencyForBaseUrl,
49
+ effectiveAdapterType: () => effectiveAdapterType,
49
50
  fetchGitHubUser: () => fetchGitHubUser,
50
51
  getBuiltinProviderPreset: () => getBuiltinProviderPreset,
51
52
  getGitHubOrgMembership: () => getGitHubOrgMembership,
@@ -58,11 +59,28 @@ __export(index_exports, {
58
59
  normalizeErrorForLog: () => normalizeErrorForLog,
59
60
  normalizeGitUrl: () => normalizeGitUrl,
60
61
  parsePayload: () => parsePayload,
62
+ protocolForBaseUrl: () => protocolForBaseUrl,
61
63
  resolvePrimaryEmail: () => resolvePrimaryEmail,
62
64
  safeJson: () => safeJson
63
65
  });
64
66
  module.exports = __toCommonJS(index_exports);
65
67
 
68
+ // src/ai/protocol.ts
69
+ function protocolForBaseUrl(baseUrl) {
70
+ try {
71
+ const url = new URL(baseUrl);
72
+ return /(^|\/)anthropic(\/|$)/i.test(url.pathname) ? "anthropic" : "openai";
73
+ } catch {
74
+ return "openai";
75
+ }
76
+ }
77
+ function effectiveAdapterType(configuredType, baseUrl) {
78
+ if (configuredType === "zhipu" && protocolForBaseUrl(baseUrl) === "anthropic") {
79
+ return "anthropic-compatible";
80
+ }
81
+ return configuredType;
82
+ }
83
+
66
84
  // src/ai/providers.base-url.ts
67
85
  var PROVIDER_BASE_URL_PRESETS = {
68
86
  "openai-compatible": [],
@@ -77,8 +95,48 @@ var PROVIDER_BASE_URL_PRESETS = {
77
95
  { label: "\u5168\u7403", baseUrl: "https://api.moonshot.ai/v1" }
78
96
  ],
79
97
  zhipu: [
80
- { label: "\u56FD\u5185", baseUrl: "https://open.bigmodel.cn/api/agent" },
81
- { label: "\u5168\u7403", baseUrl: "https://api.zhipuai.com/v1" }
98
+ // Zhipu / 智谱 GLM 6 endpoint paths × 2 hosts. The 4
99
+ // "credential channels" the GLM-for-copilot reference
100
+ // distinguishes (region × apiMode — each with its own API
101
+ // key) collapse to a 6-row baseUrl dropdown here because we
102
+ // keep one API key per provider, not one per channel. The
103
+ // user picks the host + path that matches the API key
104
+ // they actually have; the curated `MODEL_METADATA` prices
105
+ // are host-based (CNY vs USD via `currencyForBaseUrl`).
106
+ //
107
+ // Source: https://bigmodel.cn/pricing (CN platform, CNY) +
108
+ // https://z.ai/pricing (international, USD). The 6 paths
109
+ // map to:
110
+ // - `/api/paas/v4` → 标准 API (Standard)
111
+ // - `/api/coding/paas/v4` → Coding Plan (订阅套餐)
112
+ // - `/api/anthropic` → Anthropic 兼容协议
113
+ //
114
+ // Earlier single-entry dropdown omitted the Coding Plan
115
+ // path and the international Z.ai host entirely — users on
116
+ // the Coding Plan subscription were 404'ing because they
117
+ // pasted `open.bigmodel.cn/api/paas/v4` into a Coding Plan
118
+ // key, and Z.ai users had no preset to pick.
119
+ // ── 国内 (open.bigmodel.cn — CNY) ───────────────────────
120
+ { label: "\u56FD\u5185 \xB7 \u6807\u51C6 API", baseUrl: "https://open.bigmodel.cn/api/paas/v4" },
121
+ { label: "\u56FD\u5185 \xB7 Coding Plan", baseUrl: "https://open.bigmodel.cn/api/coding/paas/v4" },
122
+ // 重要:Anthropic 协议端点 **复用** Coding Plan 的 key(与
123
+ // `/api/coding/paas/v4` 共用同一凭证;不是 Standard API key,
124
+ // 也没有独立的 "Anthropic API key")。
125
+ // Reference: `docs/references/GLM-for-copilot-main/src/i18n.ts:578-579`
126
+ // "Coding Plan and Standard API credentials are independent.
127
+ // OpenAI and Anthropic endpoints in the same region share
128
+ // the Coding Plan key."
129
+ // label 故意重复 "Coding Plan" 两次,让用户从下拉里一眼看出:
130
+ // (a) 这个端点**只能配 Coding Plan key**;
131
+ // (b) 这是 Coding Plan 的**协议变体**,不是 Standard API 的。
132
+ {
133
+ label: "\u56FD\u5185 \xB7 Coding Plan \xB7 Anthropic \u534F\u8BAE",
134
+ baseUrl: "https://open.bigmodel.cn/api/anthropic"
135
+ },
136
+ // ── 国际 (api.z.ai — USD) ───────────────────────────────
137
+ { label: "\u56FD\u9645 \xB7 \u6807\u51C6 API", baseUrl: "https://api.z.ai/api/paas/v4" },
138
+ { label: "\u56FD\u9645 \xB7 Coding Plan", baseUrl: "https://api.z.ai/api/coding/paas/v4" },
139
+ { label: "\u56FD\u9645 \xB7 Coding Plan \xB7 Anthropic \u534F\u8BAE", baseUrl: "https://api.z.ai/api/anthropic" }
82
140
  ],
83
141
  stepfun: [{ label: "\u5B98\u65B9", baseUrl: "https://api.stepfun.com/v1" }],
84
142
  siliconflow: [
@@ -125,7 +183,7 @@ function isProviderCacheControlAware(type) {
125
183
  }
126
184
 
127
185
  // src/ai/providers.metadata.ts
128
- var MODEL_METADATA = {
186
+ var PRIMARY_METADATA = {
129
187
  "MiniMax-M3": {
130
188
  detail: "Native multimodal frontier coding model (1M context, 512K effective)",
131
189
  imageInput: true,
@@ -158,8 +216,17 @@ var MODEL_METADATA = {
158
216
  detail: "M2.7 high-speed: same quality, faster (~100 TPS)",
159
217
  imageInput: false,
160
218
  toolCalling: true,
219
+ // Per https://minimax-ai.chat/pricing (2026-07 verified):
220
+ // M2.7-highspeed is 2× M2.7 base on input/output, but
221
+ // identical on cache hit (same model + same infra, just a
222
+ // serving-side TPS bump). The CNY values mirror USD at the
223
+ // project's 1:7 CNY-per-USD convention.
224
+ // Previously the CNY input/output were the same as base
225
+ // (¥2.1 / ¥8.4) while USD was already 2× — that left the
226
+ // USD/CNY ratio at 3.5× instead of 7× and silently
227
+ // under-reported CNY cost for users on the China platform.
161
228
  pricingUSD: { input: 0.6, output: 2.4, cacheRead: 0.06 },
162
- pricingCNY: { input: 2.1, output: 8.4, cacheRead: 0.42 },
229
+ pricingCNY: { input: 4.2, output: 16.8, cacheRead: 0.42 },
163
230
  priceCategory: "low",
164
231
  // Inherits M2.7's context window.
165
232
  maxInputTokens: 131072,
@@ -169,8 +236,20 @@ var MODEL_METADATA = {
169
236
  detail: "Fast, general-purpose model",
170
237
  imageInput: true,
171
238
  toolCalling: true,
172
- pricingUSD: { input: 0.14, output: 0.28, cacheRead: 28e-4 },
173
- pricingCNY: { input: 1, output: 2, cacheRead: 0.02 },
239
+ // Per https://api-docs.deepseek.com/quick_start/pricing/ and
240
+ // https://new.qq.com/rain/a/20260813A0DROS00 (2026-08-13
241
+ // announcement, effective 2026-08-17 00:00 Beijing): peak/
242
+ // off-peak tiered pricing. Pinned the OFF-PEAK rate since
243
+ // peak hours (01:00–04:00 + 06:00–10:00 UTC = 09:00–12:00 +
244
+ // 14:00–18:00 Beijing) cover only 8 of 24 hours — most chat
245
+ // sessions land off-peak. Peak is exactly 2× off-peak per
246
+ // the official page.
247
+ // Off-peak: $0.007 cache hit / $0.22 input / $0.66 output
248
+ // ¥0.05 cache hit / ¥1.5 input / ¥4.5 output
249
+ // The pre-2026-08-17 rate was 1/3 of the current off-peak;
250
+ // 8/17 调价 raised cache hit 6× and output 2.25×.
251
+ pricingUSD: { input: 0.22, output: 0.66, cacheRead: 7e-3 },
252
+ pricingCNY: { input: 1.5, output: 4.5, cacheRead: 0.05 },
174
253
  priceCategory: "low",
175
254
  // Official docs (api-docs.deepseek.com/quick_start/pricing, fetched
176
255
  // 2026-07-27): "THINKING MODE: Supports both non-thinking and
@@ -186,8 +265,20 @@ var MODEL_METADATA = {
186
265
  detail: "Most capable reasoning model",
187
266
  imageInput: true,
188
267
  toolCalling: true,
189
- pricingUSD: { input: 0.435, output: 0.87, cacheRead: 3625e-6 },
190
- pricingCNY: { input: 2.1, output: 4.2, cacheRead: 0.025 },
268
+ // Per https://api-docs.deepseek.com/quick_start/pricing/ and
269
+ // https://new.qq.com/rain/a/20260813A0DROS00 (2026-08-13
270
+ // announcement, effective 2026-08-17 00:00 Beijing): peak/
271
+ // off-peak tiered pricing. Pinned the OFF-PEAK rate (peak
272
+ // hours are 8/24; most chat sessions land off-peak; peak is
273
+ // exactly 2× off-peak per the official page).
274
+ // Off-peak: $0.022 cache hit / $0.66 input / $1.98 output
275
+ // ¥0.15 cache hit / ¥4.5 input / ¥13.5 output
276
+ // The 8/17 调价 raised cache hit 6× (¥0.025 → ¥0.15),
277
+ // input 1.5×, and output 2.25×. The pre-08-17 USD values
278
+ // (0.435/0.87/0.003625) and CNY values (2.1/4.2/0.025) did
279
+ // not correspond to any DeepSeek-published rate; corrected.
280
+ pricingUSD: { input: 0.66, output: 1.98, cacheRead: 0.022 },
281
+ pricingCNY: { input: 4.5, output: 13.5, cacheRead: 0.15 },
191
282
  priceCategory: "low",
192
283
  thinkingSchema: "thinkingEnabled",
193
284
  maxInputTokens: 655360,
@@ -315,56 +406,133 @@ var MODEL_METADATA = {
315
406
  // GLM-5's explicit "Agentic 长程规划与执行" description. Corrected
316
407
  // from false (inconsistent with the rest of the GLM-5 family).
317
408
  "glm-5.2": {
318
- detail: "GLM-5.2 \u2014 1M \u4E0A\u4E0B\u6587\uFF0C\u6700\u5927\u8F93\u51FA 128K",
409
+ detail: "GLM-5.2 \u2014 1M \u4E0A\u4E0B\u6587\uFF0C\u6700\u5927\u8F93\u51FA 128K\uFF08\u5355\u6863 pricing\uFF09",
319
410
  imageInput: false,
320
411
  toolCalling: true,
321
- // ¥8 input / ¥28 output / ¥2 cache hit per 1M tokens (输入长度 32K+ 档)
412
+ // Single rate (no input-length tier split) per
413
+ // bigmodel.cn/pricing 2026-08-18:
414
+ // ¥8 input / ¥28 output / ¥2 cache hit per 1M tokens
415
+ // The previous entry's comment said "输入长度 32K+ 档" — that
416
+ // was wrong: GLM-5.2 has no tier split on the official page.
322
417
  pricingUSD: { input: 1.12, output: 3.92, cacheRead: 0.28 },
323
418
  pricingCNY: { input: 8, output: 28, cacheRead: 2 },
324
419
  priceCategory: "high",
325
420
  maxInputTokens: 1e6,
326
421
  maxOutputTokens: 128e3
327
422
  },
328
- "glm-4.7": {
329
- detail: "200K \u4E0A\u4E0B\u6587\uFF0C\u5DE5\u5177\u8C03\u7528",
423
+ // GLM-5.3 (2026-08-14) — same 744B base as GLM-5.2 with extended
424
+ // post-training for security / long-horizon coding. ~one-tenth the
425
+ // per-token price of comparable U.S. frontier models; Z.ai's headline
426
+ // result is 84.5% on CyberGym vulnerability-identification benchmark
427
+ // (vendor-reported, no third-party replication as of 2026-08-18).
428
+ // Available via GLM Coding Plan + ZCode; open weights staged ~2026-08-28.
429
+ "glm-5.3": {
430
+ detail: "GLM-5.3 \u2014 1M \u4E0A\u4E0B\u6587\uFF0C\u540E\u8BAD\u7EC3\u589E\u5F3A\u4EE3\u7801 / \u7F51\u7EDC\u5B89\u5168",
431
+ imageInput: false,
432
+ toolCalling: true,
433
+ // Vendor-published USD price (Decrypt, 2026-08-14). Cache-hit price
434
+ // has not been published — the picker shows "(not published)" rather
435
+ // than fabricating a number (the rate usually diverges 4–10× from
436
+ // input, so a guess would mislead budget estimates).
437
+ pricingUSD: { input: 1.4, output: 4.4, cacheRead: null },
438
+ pricingCNY: { input: 10, output: 31, cacheRead: null },
439
+ priceCategory: "high",
440
+ maxInputTokens: 1e6,
441
+ maxOutputTokens: 128e3
442
+ },
443
+ // GLM-5.1-HighSpeed (2026-05) — production-grade high-throughput
444
+ // variant of GLM-5.1. Same 200K context + 128K output, but optimised
445
+ // via Zhipu's TileRT inference engine for 400 TPS output (~2× the
446
+ // rate of comparable flagship models). Native SSE streaming + MCP
447
+ // tool-call support. Listed on BigModel + Alibaba Cloud DashScope
448
+ // (model id `glm-5.1-highspeed`). Pricing mirrors GLM-5.1 since the
449
+ // rate is identical architecture — TileRT is a serving-side optim.
450
+ "glm-5.1-highspeed": {
451
+ detail: "GLM-5.1 HighSpeed \u2014 400 TPS \u9AD8\u541E\u5410\u751F\u4EA7\u53D8\u4F53\uFF08[0, 32K) tier \u955C\u50CF GLM-5.1\uFF09",
330
452
  imageInput: false,
331
453
  toolCalling: true,
332
- // cc-switch 标价:$0.6 input / $2.2 output
454
+ // Mirrors GLM-5.1 [0, 32K) tier per bigmodel.cn/pricing 2026-08-18.
455
+ // TileRT is a serving-side optim; the per-token rate is the same
456
+ // architecture as the base model.
333
457
  pricingUSD: { input: 0.6, output: 2.2, cacheRead: 0.11 },
334
- pricingCNY: { input: 4.3, output: 15.7, cacheRead: 0.79 },
458
+ pricingCNY: { input: 6, output: 24, cacheRead: 1.3 },
459
+ priceCategory: "medium",
460
+ maxInputTokens: 2e5,
461
+ maxOutputTokens: 128e3
462
+ },
463
+ // GLM-4.7-Flash (2026-01-19) — 200K context, fully-free tier on
464
+ // bigmodel.cn/pricing (fetched 2026-08-18). Lightweight + high-
465
+ // frequency optimised; coding / writing / translation / reasoning
466
+ // at "best-in-class-for-its-size" per the Zhipu release notes.
467
+ // Distinct from `glm-4.7-flashx` (the latter is the 快速版 with
468
+ // paid pricing).
469
+ "glm-4.7-flash": {
470
+ detail: "GLM-4.7 Flash \u2014 \u5B8C\u5168\u514D\u8D39\uFF08200K \u4E0A\u4E0B\u6587\uFF09",
471
+ imageInput: false,
472
+ toolCalling: true,
473
+ // Free tier — input / output / cache hit all 0 (bigmodel.cn
474
+ // 2026-08-18 lists "免费" for every column). USD mirrors CNY
475
+ // rather than inventing a rate.
476
+ pricingUSD: { input: 0, output: 0, cacheRead: 0 },
477
+ pricingCNY: { input: 0, output: 0, cacheRead: 0 },
478
+ priceCategory: "low",
479
+ maxInputTokens: 2e5,
480
+ maxOutputTokens: 128e3
481
+ },
482
+ "glm-4.7": {
483
+ detail: "GLM-4.7 \u2014 200K \u4E0A\u4E0B\u6587\uFF0C\u5DE5\u5177\u8C03\u7528\uFF083-tier pricing\uFF09",
484
+ imageInput: false,
485
+ toolCalling: true,
486
+ // Pinned the LOWEST tier per bigmodel.cn/pricing 2026-08-18:
487
+ // [0, 32K) input × [0, 0.2K) output — ¥2 / ¥8 / ¥0.4 cache hit
488
+ // [0, 32K) input × [0.2K+) output — ¥3 / ¥14 / ¥0.6 cache hit
489
+ // [32K, 200K) input — ¥4 / ¥16 / ¥0.8 cache hit
490
+ // Most real prompts are < 32K input and < 0.2K output, so the
491
+ // lowest tier is the most representative per-request price.
492
+ // Re-pick from a higher tier if the picker adds a length slider.
493
+ pricingUSD: { input: 0.28, output: 1.12, cacheRead: 0.056 },
494
+ pricingCNY: { input: 2, output: 8, cacheRead: 0.4 },
335
495
  priceCategory: "medium",
336
496
  maxInputTokens: 2e5,
337
497
  maxOutputTokens: 128e3
338
498
  },
339
499
  "glm-5.1": {
340
- detail: "GLM-5.1 \u2014 200K \u4E0A\u4E0B\u6587\uFF0C\u6700\u5927\u8F93\u51FA 128K",
500
+ detail: "GLM-5.1 \u2014 200K \u4E0A\u4E0B\u6587\uFF0C\u6700\u5927\u8F93\u51FA 128K\uFF082-tier pricing\uFF09",
341
501
  imageInput: false,
342
502
  toolCalling: true,
343
- // ¥8 input / ¥28 output / ¥2 cache hit per 1M tokens (输入长度 32K+ 档)
344
- pricingUSD: { input: 1.12, output: 3.92, cacheRead: 0.28 },
345
- pricingCNY: { input: 8, output: 28, cacheRead: 2 },
503
+ // Pinned the LOWER tier per bigmodel.cn/pricing 2026-08-18:
504
+ // [0, 32K) — ¥6 input / ¥24 output / ¥1.3 cache hit
505
+ // [32K+) — ¥8 input / ¥28 output / ¥2 cache hit
506
+ // The previous entry had the higher tier; switched to the lower
507
+ // tier so a typical < 32K prompt shows the more accurate price.
508
+ pricingUSD: { input: 0.84, output: 3.36, cacheRead: 0.182 },
509
+ pricingCNY: { input: 6, output: 24, cacheRead: 1.3 },
346
510
  priceCategory: "high",
347
511
  maxInputTokens: 2e5,
348
512
  maxOutputTokens: 128e3
349
513
  },
350
514
  "glm-5": {
351
- detail: "GLM-5 \u2014 200K \u4E0A\u4E0B\u6587\uFF0CAgentic \u5DE5\u5177\u8C03\u7528\uFF0C\u6700\u5927\u8F93\u51FA 128K",
515
+ detail: "GLM-5 \u2014 200K \u4E0A\u4E0B\u6587\uFF0CAgentic \u5DE5\u5177\u8C03\u7528\uFF0C\u6700\u5927\u8F93\u51FA 128K\uFF082-tier pricing\uFF09",
352
516
  imageInput: false,
353
517
  toolCalling: true,
354
- // ¥6 input / ¥22 output / ¥1.5 cache hit per 1M tokens (输入长度 32K+ 档)
355
- pricingUSD: { input: 0.84, output: 3.08, cacheRead: 0.21 },
356
- pricingCNY: { input: 6, output: 22, cacheRead: 1.5 },
518
+ // Pinned the LOWER tier per bigmodel.cn/pricing 2026-08-18:
519
+ // [0, 32K) — ¥4 input / ¥18 output / ¥1 cache hit
520
+ // [32K+) — ¥6 input / ¥22 output / ¥1.5 cache hit
521
+ pricingUSD: { input: 0.56, output: 2.52, cacheRead: 0.14 },
522
+ pricingCNY: { input: 4, output: 18, cacheRead: 1 },
357
523
  priceCategory: "high",
358
524
  maxInputTokens: 2e5,
359
525
  maxOutputTokens: 128e3
360
526
  },
361
527
  "glm-5-turbo": {
362
- detail: "GLM-5 Turbo \u2014 200K \u4E0A\u4E0B\u6587\uFF0C\u6700\u5927\u8F93\u51FA 128K",
528
+ detail: "GLM-5 Turbo \u2014 200K \u4E0A\u4E0B\u6587\uFF0C\u6700\u5927\u8F93\u51FA 128K\uFF082-tier pricing\uFF09",
363
529
  imageInput: false,
364
530
  toolCalling: true,
365
- // ¥7 input / ¥26 output / ¥1.8 cache hit per 1M tokens (输入长度 32K+ 档)
366
- pricingUSD: { input: 0.98, output: 3.64, cacheRead: 0.252 },
367
- pricingCNY: { input: 7, output: 26, cacheRead: 1.8 },
531
+ // Pinned the LOWER tier per bigmodel.cn/pricing 2026-08-18:
532
+ // [0, 32K) — ¥5 input / ¥22 output / ¥1.2 cache hit
533
+ // [32K+) — ¥7 input / ¥26 output / ¥1.8 cache hit
534
+ pricingUSD: { input: 0.7, output: 3.08, cacheRead: 0.168 },
535
+ pricingCNY: { input: 5, output: 22, cacheRead: 1.2 },
368
536
  priceCategory: "medium",
369
537
  maxInputTokens: 2e5,
370
538
  maxOutputTokens: 128e3
@@ -390,8 +558,19 @@ var MODEL_METADATA = {
390
558
  maxInputTokens: 2e5,
391
559
  maxOutputTokens: 128e3
392
560
  },
393
- "glm-4.5-air": {
394
- detail: "GLM-4.5 Air \u2014 \u5DE5\u5177\u8C03\u7528",
561
+ // `glm-4.5` (no suffix) is exposed by Zhipu's `/v1/models`
562
+ // endpoint as of 2026-08-18 but is NOT listed on the public
563
+ // "模型概览" page (https://docs.bigmodel.cn/cn/guide/start/model-overview).
564
+ // It is almost certainly a legacy alias that routes to one of the
565
+ // suffixed variants — the only sibling in the 4.5 generation
566
+ // that ships tool calling is `glm-4.5-air` (128K context, 96K
567
+ // max output, ¥-billed), so we mirror that metadata here. The
568
+ // token caps are the most important field for the VSCode chat
569
+ // picker (entries with `maxInputTokens: 0` are hidden), and the
570
+ // pricing column is honest about it being a best-guess until
571
+ // Zhipu publishes a dedicated spec.
572
+ "glm-4.5": {
573
+ detail: "GLM-4.5 \u2014 \u5DE5\u5177\u8C03\u7528\uFF08\u88F8\u540D\uFF1BZhipu /v1/models \u66B4\u9732\u7684 legacy alias\uFF09",
395
574
  imageInput: false,
396
575
  toolCalling: true,
397
576
  pricingUSD: { input: 0, output: 0, cacheRead: null },
@@ -400,14 +579,35 @@ var MODEL_METADATA = {
400
579
  maxInputTokens: 128e3,
401
580
  maxOutputTokens: 96e3
402
581
  },
582
+ "glm-4.5-air": {
583
+ detail: "GLM-4.5 Air \u2014 \u5DE5\u5177\u8C03\u7528\uFF083-tier pricing\uFF09",
584
+ imageInput: false,
585
+ toolCalling: true,
586
+ // Pinned the LOWEST tier per bigmodel.cn/pricing 2026-08-18:
587
+ // [0, 32K) × [0, 0.2K) output — ¥0.8 / ¥2 / ¥0.16 cache hit
588
+ // [0, 32K) × [0.2K+) output — ¥0.8 / ¥6 / ¥0.16 cache hit
589
+ // [32K, 128K) — ¥1.2 / ¥8 / ¥0.24 cache hit
590
+ // All cache-hit rates are 4× lower than input — the
591
+ // explicit-cache-discount half of BYOM-depth #1.
592
+ pricingUSD: { input: 0.112, output: 0.28, cacheRead: 0.0224 },
593
+ pricingCNY: { input: 0.8, output: 2, cacheRead: 0.16 },
594
+ priceCategory: "low",
595
+ maxInputTokens: 128e3,
596
+ maxOutputTokens: 96e3
597
+ },
403
598
  "glm-4.5-airx": {
404
- detail: "GLM-4.5 AirX \u2014 \u5FEB\u901F\u7248",
599
+ detail: "GLM-4.5 AirX \u2014 \u5FEB\u901F\u7248\uFF08\xA510/M \u5355\u6863\uFF09",
405
600
  imageInput: false,
406
601
  toolCalling: false,
407
- pricingUSD: { input: 0, output: 0, cacheRead: null },
408
- pricingCNY: { input: 0, output: 0, cacheRead: null },
602
+ // ¥10 / M tokens (single rate, input == output) per
603
+ // bigmodel.cn/pricing 2026-08-18 listed under the "模型推理
604
+ // → Language Models" sub-tab, NOT the flagship text section.
605
+ // 8K context window per the same sub-tab; 96K max output is a
606
+ // best-guess from sibling Air-tier models.
607
+ pricingUSD: { input: 1.4, output: 1.4, cacheRead: null },
608
+ pricingCNY: { input: 10, output: 10, cacheRead: null },
409
609
  priceCategory: "low",
410
- maxInputTokens: 128e3,
610
+ maxInputTokens: 8192,
411
611
  maxOutputTokens: 96e3
412
612
  },
413
613
  "glm-4-long": {
@@ -444,24 +644,29 @@ var MODEL_METADATA = {
444
644
  maxOutputTokens: 4e3
445
645
  },
446
646
  "glm-4.5v": {
447
- detail: "GLM-4.5V \u89C6\u89C9\u63A8\u7406\u6A21\u578B \u2014 \u56FE\u50CF/\u89C6\u9891/\u6587\u6863/GUI",
647
+ detail: "GLM-4.5V \u89C6\u89C9\u63A8\u7406\u6A21\u578B \u2014 \u56FE\u50CF/\u89C6\u9891/\u6587\u6863/GUI\uFF082-tier pricing\uFF09",
448
648
  imageInput: true,
449
649
  toolCalling: true,
450
- pricingUSD: { input: 0, output: 0, cacheRead: null },
451
- pricingCNY: { input: 0, output: 0, cacheRead: null },
650
+ // Pinned the LOWER tier per bigmodel.cn/pricing 2026-08-18:
651
+ // [0, 32K) — ¥2 input / ¥6 output / ¥0.4 cache hit
652
+ // [32, 64K) — ¥4 input / ¥12 output / ¥0.8 cache hit
653
+ pricingUSD: { input: 0.28, output: 0.84, cacheRead: 0.056 },
654
+ pricingCNY: { input: 2, output: 6, cacheRead: 0.4 },
452
655
  priceCategory: "medium",
453
- maxInputTokens: 128e3,
656
+ maxInputTokens: 64e3,
454
657
  maxOutputTokens: 8192
455
658
  },
456
659
  "glm-5v-turbo": {
457
- detail: "GLM-5V Turbo \u2014 \u591A\u6A21\u6001 Coding \u6A21\u578B",
660
+ detail: "GLM-5V Turbo \u2014 \u591A\u6A21\u6001 Coding \u6A21\u578B\uFF082-tier pricing\uFF09",
458
661
  imageInput: true,
459
662
  toolCalling: true,
460
- pricingUSD: { input: 0, output: 0, cacheRead: null },
461
- pricingCNY: { input: 0, output: 0, cacheRead: null },
663
+ // Pinned the LOWER tier per bigmodel.cn/pricing 2026-08-18:
664
+ // [0, 32K) — ¥5 input / ¥22 output / ¥1.2 cache hit
665
+ // [32K+) — ¥7 input / ¥26 output / ¥1.8 cache hit
666
+ // Vendor-published context: 200K / 128K max output.
667
+ pricingUSD: { input: 0.7, output: 3.08, cacheRead: 0.168 },
668
+ pricingCNY: { input: 5, output: 22, cacheRead: 1.2 },
462
669
  priceCategory: "medium",
463
- // Official model overview: 200K context / 128K max output
464
- // (previously mis-set to 128K/8_192 — corrected 2026-07-27).
465
670
  maxInputTokens: 2e5,
466
671
  maxOutputTokens: 128e3
467
672
  },
@@ -489,8 +694,15 @@ var MODEL_METADATA = {
489
694
  // Official model page lists "🛠️ 工具调用: 可靠的工具调用能力,支持多步
490
695
  // 任务分解与计划执行" as a core capability — was mis-set to false.
491
696
  toolCalling: true,
492
- // ¥1.35 input / ¥8.1 output / ¥0.27 cache hit per 1M tokens
493
- pricingUSD: { input: 0.189, output: 1.134, cacheRead: 0.038 },
697
+ // Per https://platform.stepfun.com/docs/zh/pricing/details
698
+ // (2026-08-18 fetched): ¥1.35 input / ¥8.1 output /
699
+ // ¥0.27 cache hit per 1M tokens, USD = $0.20 / $1.15 /
700
+ // $0.04 (StepFun is USD-billed at the same rate as CNY/7
701
+ // with small rounding per the official pricing page).
702
+ // USD values previously 0.189/1.134/0.038 — slightly off
703
+ // from the official page (rounding error from dividing CNY
704
+ // by hand), corrected.
705
+ pricingUSD: { input: 0.2, output: 1.15, cacheRead: 0.04 },
494
706
  pricingCNY: { input: 1.35, output: 8.1, cacheRead: 0.27 },
495
707
  priceCategory: "medium",
496
708
  thinkingSchema: "reasoningEffort",
@@ -506,8 +718,13 @@ var MODEL_METADATA = {
506
718
  // Official model page lists "🛠️ 工具调用: 可靠的 tools / tool_choice
507
719
  // 调用能力" as a core capability — was mis-set to false.
508
720
  toolCalling: true,
509
- // ¥0.7 input / ¥2.1 output / ¥0.14 cache hit per 1M tokens
510
- pricingUSD: { input: 0.098, output: 0.294, cacheRead: 0.02 },
721
+ // Per https://platform.stepfun.com/docs/zh/pricing/details
722
+ // (2026-08-18 fetched): ¥0.7 input / ¥2.1 output /
723
+ // ¥0.14 cache hit per 1M tokens, USD = $0.10 / $0.30 /
724
+ // $0.02. USD values previously 0.098/0.294/0.02 — slightly
725
+ // off from the official page (rounding error), corrected
726
+ // to the exact published values.
727
+ pricingUSD: { input: 0.1, output: 0.3, cacheRead: 0.02 },
511
728
  pricingCNY: { input: 0.7, output: 2.1, cacheRead: 0.14 },
512
729
  priceCategory: "low",
513
730
  thinkingSchema: "reasoningEffort",
@@ -518,9 +735,13 @@ var MODEL_METADATA = {
518
735
  detail: "Step 1o Turbo Vision \u2014 \u89C6\u89C9\u6A21\u578B",
519
736
  imageInput: true,
520
737
  toolCalling: false,
521
- // ¥2.5 input / ¥8 output per 1M tokens
522
- pricingUSD: { input: 0.35, output: 1.12, cacheRead: null },
523
- pricingCNY: { input: 2.5, output: 8, cacheRead: null },
738
+ // Per https://platform.stepfun.com/docs/zh/pricing/details
739
+ // (2026-08-18 fetched): ¥2.5 cache miss / ¥0.5 cache hit /
740
+ // ¥8 output per 1M tokens. USD = $0.357 / $0.071 / $1.143
741
+ // (CNY/7 with rounding). Cache hit was previously
742
+ // undocumented in the curated entry — added.
743
+ pricingUSD: { input: 0.357, output: 1.143, cacheRead: 0.071 },
744
+ pricingCNY: { input: 2.5, output: 8, cacheRead: 0.5 },
524
745
  priceCategory: "low",
525
746
  // Official model overview: 32K context window.
526
747
  maxInputTokens: 32768,
@@ -551,18 +772,112 @@ var MODEL_METADATA = {
551
772
  priceCategory: "low",
552
773
  maxInputTokens: 32768,
553
774
  maxOutputTokens: 32768
775
+ },
776
+ // ── MiniMax M2.5 (2026-02-13) ──────────────────────────────────────
777
+ // 229B MoE, 80.2% SWE-Bench Verified, the predecessor to M2.7.
778
+ // Source: https://siliconflow.cn/models?series=qwen (MiniMax card),
779
+ // platform.minimaxi.com/docs/release-notes/models (M2.5 release note).
780
+ "MiniMax-M2.5": {
781
+ detail: "MiniMax M2.5 \u2014 229B MoE, SOTA \u7F16\u7A0B / Agent / \u529E\u516C\u751F\u4EA7\u529B\uFF08192K \u4E0A\u4E0B\u6587\uFF09",
782
+ imageInput: false,
783
+ toolCalling: true,
784
+ // Per https://minimax-ai.chat/pricing (M2.5 legacy line):
785
+ // ¥2.1 input / ¥8.4 output / ¥0.21 cache hit per 1M tokens;
786
+ // USD = $0.30 / $1.20 / $0.03 (cloudprice.net 2026-08-13).
787
+ // Cache hit IS the published rate — the previous comment
788
+ // "按官方 10% cache 命中率回填" was wrong (it implied we
789
+ // were estimating, when actually the cache rate is
790
+ // documented at ¥0.21 / $0.03 per 1M tokens).
791
+ pricingUSD: { input: 0.3, output: 1.2, cacheRead: 0.03 },
792
+ pricingCNY: { input: 2.1, output: 8.4, cacheRead: 0.21 },
793
+ priceCategory: "medium",
794
+ // 官方 context 192K;output 按 16K 保守估值(M2.7 标 128K,M2.5
795
+ // 官方未单独发布 max output 数字,按其同代老模型惯例取 16K)。
796
+ maxInputTokens: 192e3,
797
+ maxOutputTokens: 16384
798
+ },
799
+ // ── Qwen3.6-35B-A3B(2026-04-17 通义千问)────────────────────────────
800
+ // 35B MoE,激活仅 3B,256K 上下文;2026 年 Qwen3.6 系列首发
801
+ // small-size open-weight。"激活成本 1/10" 是其与前代 Qwen3.5-27B
802
+ // 相比的核心卖点。Source:
803
+ // https://siliconflow.cn/news/z12t3edpv6ypbuja3o65lgh2
804
+ "Qwen3.6-35B-A3B": {
805
+ detail: "Qwen3.6-35B-A3B \u2014 35B MoE (3B \u6FC0\u6D3B)\uFF0C\u601D\u8003/\u975E\u601D\u8003\u53CC\u6A21\uFF0C256K \u4E0A\u4E0B\u6587",
806
+ imageInput: true,
807
+ toolCalling: true,
808
+ // SiliconFlow 列价:¥1.6 / ¥12.8 per 1M tokens
809
+ pricingUSD: { input: 0.23, output: 1.83, cacheRead: null },
810
+ pricingCNY: { input: 1.6, output: 12.8, cacheRead: null },
811
+ priceCategory: "low",
812
+ // Qwen3.6-35B-A3B 官方 256K context;output 上限按同代 27B
813
+ // 同样 32K 取值(Qwen3.6 系列 max output 未单独公布)。
814
+ maxInputTokens: 256e3,
815
+ maxOutputTokens: 32768
554
816
  }
555
817
  };
818
+ var NAMESPACE_ALIASES = {
819
+ // SiliconFlow (CNY-billed China-domiciled platform)
820
+ "deepseek-ai/DeepSeek-V4-Pro": "deepseek-v4-pro",
821
+ "deepseek-ai/DeepSeek-V4-Flash": "deepseek-v4-flash",
822
+ "zai-org/GLM-5.2": "glm-5.2",
823
+ "Qwen/Qwen3.6-35B-A3B": "Qwen3.6-35B-A3B",
824
+ "moonshotai/Kimi-K2.7-Code": "kimi-k2.7-code",
825
+ // Novita (USD-billed global aggregator)
826
+ "deepseek/deepseek-v4-pro": "deepseek-v4-pro",
827
+ "deepseek/deepseek-v4-flash": "deepseek-v4-flash",
828
+ "zai/glm-5.2": "glm-5.2",
829
+ "zai/glm-5.1": "glm-5.1",
830
+ "moonshotai/kimi-k3": "kimi-k3",
831
+ // Zhipu naming-history aliases. The 2026-08 "模型一览" page
832
+ // (https://docs.bigmodel.cn/cn/guide/start/model-overview) lists
833
+ // the FlashX variant under its date-stamped id
834
+ // `GLM-4-FlashX-250414`; the bare `glm-4-flashx` is the
835
+ // historical alias that still resolves in chat-completions calls
836
+ // (and is what every existing ProvidersTab user has stored). Map
837
+ // the new id to the same primary entry so both spellings benefit
838
+ // from the curated detail / pricing / capability columns.
839
+ "glm-4-flashx-250414": "glm-4-flashx"
840
+ };
841
+ var MODEL_METADATA = (() => {
842
+ const merged = {
843
+ ...PRIMARY_METADATA
844
+ };
845
+ for (const [alias, target] of Object.entries(NAMESPACE_ALIASES)) {
846
+ const targetEntry = PRIMARY_METADATA[target];
847
+ if (targetEntry !== void 0) {
848
+ merged[alias] = targetEntry;
849
+ }
850
+ }
851
+ return Object.freeze(merged);
852
+ })();
556
853
  function lookupModelMetadata(modelId) {
557
854
  return MODEL_METADATA[modelId];
558
855
  }
559
856
  function currencyForBaseUrl(baseUrl) {
560
857
  try {
561
858
  const hostname = new URL(baseUrl).hostname.toLowerCase();
562
- if (hostname === "api.minimaxi.com" || hostname === "api.minimaxi.cn" || hostname === "api.deepseek.com" || hostname === "api.moonshot.cn" || hostname === "open.bigmodel.cn") {
859
+ if (hostname === "api.minimaxi.com" || hostname === "api.minimaxi.cn" || hostname === "api.deepseek.com" || hostname === "api.moonshot.cn" || hostname === "open.bigmodel.cn" || // Zhipu legacy v3 host. Per the GLM-for-copilot reference
860
+ // (`docs/references/GLM-for-copilot-main/src/endpoint.ts:4`)
861
+ // this was retired to `bigmodel.cn` but is still
862
+ // resolvable for accounts that haven't migrated — we
863
+ // don't surface it in the baseUrl dropdown, but a user
864
+ // may paste it from a saved settings.json, so the
865
+ // currency has to match (CNY, same as the new host).
866
+ hostname === "dev.bigmodel.cn") {
563
867
  return "CNY";
564
868
  }
565
- if (hostname === "api.minimax.io" || hostname === "api.minimaxi.io" || hostname === "api.siliconflow.cn" || hostname === "api.siliconflow.com" || hostname === "api.stepfun.com" || hostname === "openrouter.ai" || hostname === "api.novita.ai") {
869
+ if (hostname === "api.minimax.io" || hostname === "api.minimaxi.io" || hostname === "api.siliconflow.cn" || hostname === "api.siliconflow.com" || hostname === "api.stepfun.com" || hostname === "openrouter.ai" || hostname === "api.novita.ai" || // Z.ai / Zhipu international. Billed in USD per the
870
+ // official `bigmodel.cn/pricing` page (the CNY-billed
871
+ // list is the China-domiciled `open.bigmodel.cn` only;
872
+ // the international `api.z.ai` is USD regardless of
873
+ // which apiMode / protocol path the user picked). The
874
+ // GLM-for-copilot reference uses the same split
875
+ // (`docs/references/GLM-for-copilot-main/src/endpoint.ts:160-173`).
876
+ // Without this explicit entry, `api.z.ai` would still
877
+ // resolve to USD via the catch-all below — adding it
878
+ // here makes the intent grep-able and pins the host
879
+ // list against accidental removal.
880
+ hostname === "api.z.ai") {
566
881
  return "USD";
567
882
  }
568
883
  } catch {
@@ -620,7 +935,12 @@ var BUILTIN_PROVIDER_PRESETS = {
620
935
  models: [
621
936
  buildPresetModel("MiniMax-M3", "MiniMax-M3"),
622
937
  buildPresetModel("MiniMax-M2.7", "MiniMax-M2.7"),
623
- buildPresetModel("MiniMax-M2.7-highspeed", "MiniMax-M2.7-highspeed")
938
+ buildPresetModel("MiniMax-M2.7-highspeed", "MiniMax-M2.7-highspeed"),
939
+ // M2.5 (2026-02-13, 80.2% SWE-Bench Verified) — the
940
+ // predecessor of M2.7. Still in the catalog and often
941
+ // available on MiniMax's promotional $0.30/$1.20 rate, so
942
+ // keep it as a preset for users on the M2.5 plan tier.
943
+ buildPresetModel("MiniMax-M2.5", "MiniMax-M2.5")
624
944
  ]
625
945
  },
626
946
  deepseek: {
@@ -669,27 +989,81 @@ var BUILTIN_PROVIDER_PRESETS = {
669
989
  zhipu: {
670
990
  displayName: "Zhipu",
671
991
  baseUrl: "https://open.bigmodel.cn/api/paas/v4",
672
- // Every id below has a curated `MODEL_METADATA` entry (see above)
673
- // keep this list in sync with that table. It previously only
674
- // listed the GLM-4.x models, so newer flagship releases (GLM-5.2 /
675
- // 5.1 / 5 / 5-Turbo / 5V-Turbo) never appeared in the ProvidersTab
676
- // "add provider" preset even though their metadata existed.
992
+ // The preset is the **intersection** of (a) the curated
993
+ // `MODEL_METADATA` table above and (b) what Zhipu's
994
+ // `/v1/models` endpoint actually returns as of 2026-08-18
995
+ // (verified by the user's "Fetch from API" pull in
996
+ // ProvidersTab see screenshot in the 2026-08-18 review).
997
+ // The two sources are kept in sync deliberately: a curated
998
+ // entry without a `/v1/models` listing is dead weight in the
999
+ // starter list (the user can still add it by hand), and a
1000
+ // `/v1/models` listing without a curated entry breaks
1001
+ // `buildPresetModel`'s fail-loudly contract.
1002
+ //
1003
+ // 2026-08-18 trim — the following 8 entries were removed
1004
+ // because they no longer show up in Zhipu's `/v1/models`
1005
+ // response (they were either retired, never exposed via
1006
+ // chat-completions, or only reachable on private/coding-plan
1007
+ // endpoints that the public `/v1/models` doesn't advertise):
1008
+ //
1009
+ // glm-5.1-highspeed — production 400-TPS variant of
1010
+ // GLM-5.1 served via TileRT; still
1011
+ // listed in some third-party mirrors
1012
+ // (Alibaba Cloud DashScope) but not
1013
+ // on Zhipu's own /v1/models.
1014
+ // glm-5v-turbo — multimodal coding base; only
1015
+ // reachable via the dedicated
1016
+ // multimodal endpoint, not
1017
+ // /v1/chat/completions.
1018
+ // glm-4.7-flash — free-tier 4.7 lite; advertised on
1019
+ // the docs pricing page but absent
1020
+ // from /v1/models.
1021
+ // glm-4.7-flashx — quick-response 4.7; same situation
1022
+ // as glm-4.7-flash.
1023
+ // glm-4.5v — multimodal 4.5; only on the
1024
+ // dedicated VLM endpoint.
1025
+ // glm-4.5-airx — quick-response 4.5 Air; not in
1026
+ // /v1/models anymore.
1027
+ // glm-4-long — 1M-context 4-Long; the `/long`
1028
+ // path was retired in 2026 H1.
1029
+ // glm-4-flashx — quick-response 4 FlashX; the
1030
+ // `-250414` dated alias (see
1031
+ // `NAMESPACE_ALIASES` in
1032
+ // `providers.metadata.ts`) is the
1033
+ // only spelling still exposed.
1034
+ //
1035
+ // Note: `glm-4.5` (no suffix) IS in the preset now. It is
1036
+ // NOT listed on the public "模型概览" page but it IS
1037
+ // returned by /v1/models — almost certainly a legacy alias
1038
+ // that routes to one of the suffixed 4.5 variants. The
1039
+ // curated metadata entry marks it as such; users on a
1040
+ // private coding-plan endpoint that distinguishes `glm-4.5`
1041
+ // from `glm-4.5-air` should override the model id in the
1042
+ // ProvidersTab.
1043
+ //
1044
+ // Earlier (also 2026-08-18) trim — `glm-4-plus` and
1045
+ // `glm-3-turbo` were removed from the preset on the same
1046
+ // date. Both are no longer listed in Zhipu's public
1047
+ // "模型一览": `GLM-4-0520` is in the "即将弃用模型" list
1048
+ // and `GLM-3-Turbo` has been retired without a formal
1049
+ // redirect. Their API endpoints may still respond for
1050
+ // legacy accounts (the `glm-4-plus` 429 "余额不足" log we
1051
+ // saw on 2026-08-18 is one such case), but they shouldn't
1052
+ // be the default starter pick for a freshly added Zhipu
1053
+ // provider. Users with a paid legacy plan that still works
1054
+ // can add the id back by hand in the ProvidersTab; the
1055
+ // `MODEL_METADATA` entries are kept so the id is still
1056
+ // resolvable for the curated detail / pricing columns.
677
1057
  models: [
1058
+ buildPresetModel("glm-5.3", "GLM-5.3"),
678
1059
  buildPresetModel("glm-5.2", "GLM-5.2"),
679
1060
  buildPresetModel("glm-5.1", "GLM-5.1"),
680
1061
  buildPresetModel("glm-5", "GLM-5"),
681
1062
  buildPresetModel("glm-5-turbo", "GLM-5 Turbo"),
682
- buildPresetModel("glm-5v-turbo", "GLM-5V Turbo"),
683
1063
  buildPresetModel("glm-4.7", "GLM-4.7"),
684
- buildPresetModel("glm-4.7-flashx", "GLM-4.7 FlashX"),
685
1064
  buildPresetModel("glm-4.6", "GLM-4.6"),
686
- buildPresetModel("glm-4.5v", "GLM-4.5V"),
687
1065
  buildPresetModel("glm-4.5-air", "GLM-4.5 Air"),
688
- buildPresetModel("glm-4.5-airx", "GLM-4.5 AirX"),
689
- buildPresetModel("glm-4-plus", "GLM-4 Plus"),
690
- buildPresetModel("glm-4-long", "GLM-4 Long"),
691
- buildPresetModel("glm-4-flashx", "GLM-4 FlashX"),
692
- buildPresetModel("glm-3-turbo", "GLM-3 Turbo")
1066
+ buildPresetModel("glm-4.5", "GLM-4.5")
693
1067
  ]
694
1068
  },
695
1069
  stepfun: {
@@ -704,9 +1078,23 @@ var BUILTIN_PROVIDER_PRESETS = {
704
1078
  siliconflow: {
705
1079
  displayName: "SiliconFlow",
706
1080
  baseUrl: "https://api.siliconflow.cn/v1",
707
- // 聚合平台:模型列表动态,用户添加后通过 /v1/models 拉取。
708
- // 占位 0 容量模型避免 picker 显示空。
709
- models: []
1081
+ // 聚合平台 模型列表由平台动态维护(>100 个)。这里列的
1082
+ // 6 个是 2026 7-8 月各家最新的旗舰/代表型号,给 ProvidersTab
1083
+ // 一个 "一眼能看到" 的起点;用户添加 provider 后可继续通过
1084
+ // `/v1/models` 拉取完整列表。
1085
+ // 这里的 id 是 SiliconFlow API 用的 namespaced 字符串,必须
1086
+ // 与 MODEL_METADATA 的 alias 严格一致。
1087
+ models: [
1088
+ // DeepSeek V4 系列 (2026-04)
1089
+ buildPresetModel("deepseek-ai/DeepSeek-V4-Pro", "DeepSeek V4 Pro (via SiliconFlow)"),
1090
+ buildPresetModel("deepseek-ai/DeepSeek-V4-Flash", "DeepSeek V4 Flash (via SiliconFlow)"),
1091
+ // GLM-5.2 (2026-06-17) — open-weight 编程旗舰,1M context
1092
+ buildPresetModel("zai-org/GLM-5.2", "GLM-5.2 (via SiliconFlow)"),
1093
+ // Qwen3.6-35B-A3B (2026-04) — 35B MoE, 3B 激活,"小而强"
1094
+ buildPresetModel("Qwen/Qwen3.6-35B-A3B", "Qwen3.6-35B-A3B (via SiliconFlow)"),
1095
+ // Kimi K2.7-Code (2026-06-12) — Moonshot coding 旗舰
1096
+ buildPresetModel("moonshotai/Kimi-K2.7-Code", "Kimi K2.7 Code (via SiliconFlow)")
1097
+ ]
710
1098
  },
711
1099
  openrouter: {
712
1100
  displayName: "OpenRouter",
@@ -716,12 +1104,21 @@ var BUILTIN_PROVIDER_PRESETS = {
716
1104
  novita: {
717
1105
  displayName: "Novita",
718
1106
  baseUrl: "https://api.novita.ai/openai/v1",
719
- // 聚合平台:Novita 本身不产出自有模型,只是把 Kimi K3 / GLM 5.2 /
720
- // DeepSeek V4 / MiniMax M3 / Step 3.7 Flash 等第三方开源或授权模型
721
- // 挂到统一 OpenAI 兼容网关下(见 https://novita.ai/llm-api)。此前
722
- // 占位的 "novita-ai/novita-3.5-flash" 在其模型列表中查无此模型 id,
723
- // 已移除。用户添加 provider 后通过 /v1/models 拉取真实列表。
724
- models: []
1107
+ // 聚合平台:Novita 本身不产出自有模型,只是把 Kimi K3 / GLM 5.x /
1108
+ // DeepSeek V4 等第三方开源或授权模型挂到统一 OpenAI 兼容网关下
1109
+ // (见 https://novita.ai/llm-api)。这里列 5 个 2026 旗舰作为
1110
+ // preset 起点;用户添加 provider 后可继续通过 `/v1/models` 拉取
1111
+ // 完整列表。id 严格匹配 Novita API 的 namespaced 字符串。
1112
+ models: [
1113
+ // DeepSeek V4 系列 (2026-04)
1114
+ buildPresetModel("deepseek/deepseek-v4-pro", "DeepSeek V4 Pro (via Novita)"),
1115
+ buildPresetModel("deepseek/deepseek-v4-flash", "DeepSeek V4 Flash (via Novita)"),
1116
+ // GLM-5 系列 (2026-04/06)
1117
+ buildPresetModel("zai/glm-5.2", "GLM-5.2 (via Novita)"),
1118
+ buildPresetModel("zai/glm-5.1", "GLM-5.1 (via Novita)"),
1119
+ // Kimi K3 (2026-07-16 API, 2026-07-27 开源) — 1M context, 2.8T MoE
1120
+ buildPresetModel("moonshotai/kimi-k3", "Kimi K3 (via Novita)")
1121
+ ]
725
1122
  }
726
1123
  };
727
1124
  function getBuiltinProviderPreset(type) {
@@ -1266,6 +1663,7 @@ function safeJson(text, fallback) {
1266
1663
  checkGitHubOrgMembership,
1267
1664
  createConsoleLogger,
1268
1665
  currencyForBaseUrl,
1666
+ effectiveAdapterType,
1269
1667
  fetchGitHubUser,
1270
1668
  getBuiltinProviderPreset,
1271
1669
  getGitHubOrgMembership,
@@ -1278,6 +1676,7 @@ function safeJson(text, fallback) {
1278
1676
  normalizeErrorForLog,
1279
1677
  normalizeGitUrl,
1280
1678
  parsePayload,
1679
+ protocolForBaseUrl,
1281
1680
  resolvePrimaryEmail,
1282
1681
  safeJson
1283
1682
  });