@serviceme/devtools-shared 0.4.7 → 0.4.9

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
@@ -29,8 +29,12 @@ __export(index_exports, {
29
29
  GetCachedServerUrl: () => GetCachedServerUrl,
30
30
  GetServerProxyState: () => GetServerProxyState,
31
31
  GetUtilityModels: () => GetUtilityModels,
32
+ LISTABLE_PRESET_MODELS: () => LISTABLE_PRESET_MODELS,
32
33
  LogLevel: () => LogLevel,
33
34
  MODEL_METADATA: () => MODEL_METADATA,
35
+ NAMESPACE_ALIASES: () => NAMESPACE_ALIASES,
36
+ NAMESPACE_ALIAS_FAMILY: () => NAMESPACE_ALIAS_FAMILY,
37
+ PRESET_MODEL_FAMILIES: () => PRESET_MODEL_FAMILIES,
34
38
  PROVIDER_BASE_URL_PRESETS: () => PROVIDER_BASE_URL_PRESETS,
35
39
  PROVIDER_CACHE_CONTROL_METADATA: () => PROVIDER_CACHE_CONTROL_METADATA,
36
40
  ServerProxyStateResponse: () => ServerProxyStateResponse,
@@ -43,6 +47,7 @@ __export(index_exports, {
43
47
  __internal: () => __internal,
44
48
  asAbortSignal: () => asAbortSignal,
45
49
  buildGitHubLocalEmail: () => buildGitHubLocalEmail,
50
+ buildPresetModel: () => buildPresetModel,
46
51
  checkGitHubOrgMembership: () => checkGitHubOrgMembership,
47
52
  createConsoleLogger: () => createConsoleLogger,
48
53
  currencyForBaseUrl: () => currencyForBaseUrl,
@@ -50,10 +55,12 @@ __export(index_exports, {
50
55
  fetchGitHubUser: () => fetchGitHubUser,
51
56
  getBuiltinProviderPreset: () => getBuiltinProviderPreset,
52
57
  getGitHubOrgMembership: () => getGitHubOrgMembership,
58
+ getPresetModelDisplayName: () => getPresetModelDisplayName,
53
59
  getProviderBaseUrlPresets: () => getProviderBaseUrlPresets,
54
60
  isGitHubLocalEmail: () => isGitHubLocalEmail,
55
61
  isProviderCacheControlAware: () => isProviderCacheControlAware,
56
62
  isValidCanonicalSlug: () => isValidCanonicalSlug,
63
+ listPresetModelGroups: () => listPresetModelGroups,
57
64
  lookupModelMetadata: () => lookupModelMetadata,
58
65
  normalizeCanonicalSlug: () => normalizeCanonicalSlug,
59
66
  normalizeErrorForLog: () => normalizeErrorForLog,
@@ -61,7 +68,8 @@ __export(index_exports, {
61
68
  parsePayload: () => parsePayload,
62
69
  protocolForBaseUrl: () => protocolForBaseUrl,
63
70
  resolvePrimaryEmail: () => resolvePrimaryEmail,
64
- safeJson: () => safeJson
71
+ safeJson: () => safeJson,
72
+ unionProviderModelWithPreset: () => unionProviderModelWithPreset
65
73
  });
66
74
  module.exports = __toCommonJS(index_exports);
67
75
 
@@ -117,8 +125,14 @@ var PROVIDER_BASE_URL_PRESETS = {
117
125
  // pasted `open.bigmodel.cn/api/paas/v4` into a Coding Plan
118
126
  // key, and Z.ai users had no preset to pick.
119
127
  // ── 国内 (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" },
128
+ {
129
+ label: "\u56FD\u5185 \xB7 \u6807\u51C6 API",
130
+ baseUrl: "https://open.bigmodel.cn/api/paas/v4"
131
+ },
132
+ {
133
+ label: "\u56FD\u5185 \xB7 Coding Plan",
134
+ baseUrl: "https://open.bigmodel.cn/api/coding/paas/v4"
135
+ },
122
136
  // 重要:Anthropic 协议端点 **复用** Coding Plan 的 key(与
123
137
  // `/api/coding/paas/v4` 共用同一凭证;不是 Standard API key,
124
138
  // 也没有独立的 "Anthropic API key")。
@@ -135,8 +149,14 @@ var PROVIDER_BASE_URL_PRESETS = {
135
149
  },
136
150
  // ── 国际 (api.z.ai — USD) ───────────────────────────────
137
151
  { 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" }
152
+ {
153
+ label: "\u56FD\u9645 \xB7 Coding Plan",
154
+ baseUrl: "https://api.z.ai/api/coding/paas/v4"
155
+ },
156
+ {
157
+ label: "\u56FD\u9645 \xB7 Coding Plan \xB7 Anthropic \u534F\u8BAE",
158
+ baseUrl: "https://api.z.ai/api/anthropic"
159
+ }
140
160
  ],
141
161
  stepfun: [{ label: "\u5B98\u65B9", baseUrl: "https://api.stepfun.com/v1" }],
142
162
  siliconflow: [
@@ -149,6 +169,8 @@ var PROVIDER_BASE_URL_PRESETS = {
149
169
  { label: "\u56FD\u5185", baseUrl: "https://api.agnes-ai.cn/v1" },
150
170
  { label: "\u5168\u7403", baseUrl: "https://apihub.agnes-ai.com/v1" }
151
171
  ],
172
+ // Medalsoft internal LLM gateway — single OpenAI-compatible endpoint.
173
+ medalsoft: [{ label: "\u5185\u90E8\u7F51\u5173", baseUrl: "https://llm.proxy.alio.wang/v1" }],
152
174
  "vscode-builtin": []
153
175
  };
154
176
  function getProviderBaseUrlPresets(type) {
@@ -168,7 +190,18 @@ var PROVIDER_CACHE_CONTROL_METADATA = {
168
190
  // OpenAI-compat prompt_cache_key
169
191
  },
170
192
  kimi: {},
171
- zhipu: {},
193
+ // 2026-08-20 — Zhipu joins the cache-aware set (learnings doc §9
194
+ // task #6). Zhipu's OpenAI-compatible endpoint performs automatic
195
+ // prefix caching on stable request prefixes; the `prompt_cache_key`
196
+ // header the OpenAI adapter writes for cache-aware types gives the
197
+ // upstream a stable per-conversation bucket (mirrors the reference's
198
+ // Coding-Plan prompt-cache behaviour). The Anthropic-protocol
199
+ // `/api/anthropic` routes are unaffected — that path uses the
200
+ // AnthropicAdapter's own 4-breakpoint `cache_control` logic and
201
+ // ignores this flag.
202
+ zhipu: {
203
+ supportsCacheControl: true
204
+ },
172
205
  stepfun: {},
173
206
  siliconflow: {},
174
207
  openrouter: {},
@@ -176,6 +209,12 @@ var PROVIDER_CACHE_CONTROL_METADATA = {
176
209
  agnes: {
177
210
  supportsCacheControl: true
178
211
  },
212
+ // Medalsoft internal gateway — OpenAI-compatible pass-through; the
213
+ // upstream's prompt-cache behaviour is unknown from outside, so we
214
+ // don't declare support (no `prompt_cache_key` header is written).
215
+ // Flip to `supportsCacheControl: true` once the gateway is verified
216
+ // to honour stable prompt caching.
217
+ medalsoft: {},
179
218
  "vscode-builtin": {}
180
219
  };
181
220
  function isProviderCacheControlAware(type) {
@@ -236,20 +275,20 @@ var PRIMARY_METADATA = {
236
275
  detail: "Fast, general-purpose model",
237
276
  imageInput: true,
238
277
  toolCalling: true,
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 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 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 },
278
+ // Per https://api-docs.deepseek.com/zh-cn/quick_start/pricing
279
+ // (re-fetched 2026-08-20): peak/off-peak tiered pricing since
280
+ // the 2026-08-17 调价. Pinned the PEAK rate (2026-08-20 product
281
+ // decision user request): DeepSeek is surfaced as a CNY
282
+ // provider for China accounts, whose working hours
283
+ // (09:00–12:00 + 14:00–18:00 Beijing) fall entirely inside
284
+ // the peak window — peak is the conservative worst-case
285
+ // estimate (cost never exceeds it; off-peak turns are billed
286
+ // at exactly half).
287
+ // Peak: $0.014 cache hit / $0.44 input / $1.32 output
288
+ // ¥0.1 cache hit / ¥3 input / ¥9 output
289
+ // Off-peak: exactly 1/2 of peak (¥1.5 / ¥4.5 / ¥0.05).
290
+ pricingUSD: { input: 0.44, output: 1.32, cacheRead: 0.014 },
291
+ pricingCNY: { input: 3, output: 9, cacheRead: 0.1 },
253
292
  priceCategory: "low",
254
293
  // Official docs (api-docs.deepseek.com/quick_start/pricing, fetched
255
294
  // 2026-07-27): "THINKING MODE: Supports both non-thinking and
@@ -265,20 +304,13 @@ var PRIMARY_METADATA = {
265
304
  detail: "Most capable reasoning model",
266
305
  imageInput: true,
267
306
  toolCalling: true,
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 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 },
307
+ // Same source + same PEAK-tier decision as deepseek-v4-flash
308
+ // (2026-08-20): conservative worst-case estimate; off-peak is
309
+ // exactly half (¥4.5 / ¥13.5 / ¥0.15).
310
+ // Peak: $0.044 cache hit / $1.32 input / $3.96 output
311
+ // ¥0.3 cache hit / ¥9 input / ¥27 output
312
+ pricingUSD: { input: 1.32, output: 3.96, cacheRead: 0.044 },
313
+ pricingCNY: { input: 9, output: 27, cacheRead: 0.3 },
282
314
  priceCategory: "low",
283
315
  thinkingSchema: "thinkingEnabled",
284
316
  maxInputTokens: 655360,
@@ -321,6 +353,44 @@ var PRIMARY_METADATA = {
321
353
  maxInputTokens: 934976,
322
354
  maxOutputTokens: 65536
323
355
  },
356
+ "agnes-2.5-pro": {
357
+ detail: "Paid reasoning model \u2014 commercial stable of 2.5 Pro Alpha (advanced coding, scientific reasoning, long context, multimodal). 1M context / 65K max output",
358
+ imageInput: true,
359
+ toolCalling: true,
360
+ // Official pricing per https://wiki.agnes-ai.com/en/docs/agnes-25-pro.md
361
+ // (fetched 2026-08-19) — identical to 2.5 Pro Alpha:
362
+ // $0.45 input / $0.0038 cache read / $0.90 output per 1M tokens.
363
+ // No separate CNY tier is published, so pricingCNY mirrors USD.
364
+ pricingUSD: { input: 0.45, output: 0.9, cacheRead: 38e-4 },
365
+ pricingCNY: { input: 0.45, output: 0.9, cacheRead: 38e-4 },
366
+ priceCategory: "medium",
367
+ // Same binary Thinking on/off switch as the other Agnes models
368
+ // (`chat_template_kwargs.enable_thinking` on the OpenAI wire).
369
+ thinkingSchema: "thinkingEnabled",
370
+ // Same published window as 2.5 Pro Alpha: 1M context /
371
+ // 65536 max output — input cap mirrors the alpha entry.
372
+ maxInputTokens: 934976,
373
+ maxOutputTokens: 65536
374
+ },
375
+ "agnes-2.5-flash": {
376
+ detail: "GA upgrade of Agnes 2.0 Flash \u2014 stronger coding, agent workflows, tool calling, image understanding (512K context)",
377
+ imageInput: true,
378
+ toolCalling: true,
379
+ // Standard (post-promo) pricing per
380
+ // https://wiki.agnes-ai.com/en/docs/agnes-25-flash.md (fetched
381
+ // 2026-08-19) — same list price as 2.0 Flash ($0.03 / $0.15 per
382
+ // 1M tokens); the temporary $0 / $0 promo is ignored per the
383
+ // same policy as the 2.0 Flash entry. No separate CNY tier is
384
+ // published, so pricingCNY mirrors the USD numbers.
385
+ pricingUSD: { input: 0.03, output: 0.15, cacheRead: null },
386
+ pricingCNY: { input: 0.03, output: 0.15, cacheRead: null },
387
+ priceCategory: "low",
388
+ // Same binary Thinking on/off switch as 2.0 Flash
389
+ // (`chat_template_kwargs.enable_thinking` on the OpenAI wire).
390
+ thinkingSchema: "thinkingEnabled",
391
+ maxInputTokens: 512e3,
392
+ maxOutputTokens: 65536
393
+ },
324
394
  // ── Kimi (月之暗面 / Moonshot AI) ────────────────────────────────
325
395
  // Source: https://platform.kimi.com/docs/pricing/chat-k3,
326
396
  // chat-k27-code, chat-k26 (fetched 2026-07-27). Prices are per 1M
@@ -409,6 +479,13 @@ var PRIMARY_METADATA = {
409
479
  detail: "GLM-5.2 \u2014 1M \u4E0A\u4E0B\u6587\uFF0C\u6700\u5927\u8F93\u51FA 128K\uFF08\u5355\u6863 pricing\uFF09",
410
480
  imageInput: false,
411
481
  toolCalling: true,
482
+ // Thinking-mode dropdown + `reasoning_effort`. Zhipu official
483
+ // OpenAPI (fetched 2026-08-19): "仅 GLM-5.2 及其以上模型支持"
484
+ // reasoning_effort; for 5.2 the server maps none/minimal → give
485
+ // up thinking, low/medium → high, xhigh → max (we only send the
486
+ // native high/max so no client-side aliasing is needed).
487
+ thinkingSchema: "reasoningEffort",
488
+ supportsReasoningEffort: true,
412
489
  // Single rate (no input-length tier split) per
413
490
  // bigmodel.cn/pricing 2026-08-18:
414
491
  // ¥8 input / ¥28 output / ¥2 cache hit per 1M tokens
@@ -430,12 +507,23 @@ var PRIMARY_METADATA = {
430
507
  detail: "GLM-5.3 \u2014 1M \u4E0A\u4E0B\u6587\uFF0C\u540E\u8BAD\u7EC3\u589E\u5F3A\u4EE3\u7801 / \u7F51\u7EDC\u5B89\u5168",
431
508
  imageInput: false,
432
509
  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 },
510
+ // Thinking-mode dropdown (思考模式 停用/标准/深度) + the
511
+ // `reasoning_effort` field. Zhipu official OpenAPI (fetched
512
+ // 2026-08-19): GLM-5.3 restricts `thinking.type` to "enabled"
513
+ // and controls depth via `reasoning_effort` (low/high/max
514
+ // only). Mirrors `supportsReasoningEffort: true` in
515
+ // `docs/references/GLM-for-copilot-main/src/consts.ts`.
516
+ thinkingSchema: "reasoningEffort",
517
+ supportsReasoningEffort: true,
518
+ // Vendor pricing (corrected 2026-08-20): bigmodel.cn/pricing
519
+ // now lists GLM-5.3 at the SAME rate as GLM-5.2 —
520
+ // ¥8 input / ¥28 output / ¥2 cache hit per 1M tokens
521
+ // The previous CNY 10/31 was a mis-read of the Decrypt launch
522
+ // article (2026-08-14). USD comes from Z.ai's independently-
523
+ // set international list ($1.4 / $4.4 / $0.26 — not the ×0.14
524
+ // CNY mirror), matching the reference consts.ts USD block.
525
+ pricingUSD: { input: 1.4, output: 4.4, cacheRead: 0.26 },
526
+ pricingCNY: { input: 8, output: 28, cacheRead: 2 },
439
527
  priceCategory: "high",
440
528
  maxInputTokens: 1e6,
441
529
  maxOutputTokens: 128e3
@@ -451,10 +539,14 @@ var PRIMARY_METADATA = {
451
539
  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",
452
540
  imageInput: false,
453
541
  toolCalling: true,
542
+ // Thinking switch (no reasoning_effort — 5.1 < 5.2 threshold).
543
+ thinkingSchema: "reasoningEffort",
454
544
  // Mirrors GLM-5.1 [0, 32K) tier per bigmodel.cn/pricing 2026-08-18.
455
545
  // TileRT is a serving-side optim; the per-token rate is the same
456
- // architecture as the base model.
457
- pricingUSD: { input: 0.6, output: 2.2, cacheRead: 0.11 },
546
+ // architecture as the base model. USD = the standard ×0.14 mirror
547
+ // of 6/24/1.3 (2026-08-20 fixed a copy-paste slip that had
548
+ // cloned glm-4.6's 0.6/2.2/0.11 USD block here, a ×0.10 rate).
549
+ pricingUSD: { input: 0.84, output: 3.36, cacheRead: 0.182 },
458
550
  pricingCNY: { input: 6, output: 24, cacheRead: 1.3 },
459
551
  priceCategory: "medium",
460
552
  maxInputTokens: 2e5,
@@ -470,6 +562,8 @@ var PRIMARY_METADATA = {
470
562
  detail: "GLM-4.7 Flash \u2014 \u5B8C\u5168\u514D\u8D39\uFF08200K \u4E0A\u4E0B\u6587\uFF09",
471
563
  imageInput: false,
472
564
  toolCalling: true,
565
+ // Thinking switch (no reasoning_effort — 4.7 < 5.2 threshold).
566
+ thinkingSchema: "reasoningEffort",
473
567
  // Free tier — input / output / cache hit all 0 (bigmodel.cn
474
568
  // 2026-08-18 lists "免费" for every column). USD mirrors CNY
475
569
  // rather than inventing a rate.
@@ -483,6 +577,9 @@ var PRIMARY_METADATA = {
483
577
  detail: "GLM-4.7 \u2014 200K \u4E0A\u4E0B\u6587\uFF0C\u5DE5\u5177\u8C03\u7528\uFF083-tier pricing\uFF09",
484
578
  imageInput: false,
485
579
  toolCalling: true,
580
+ // Thinking switch (GLM-4.7 forces thinking when enabled per the
581
+ // official ChatThinking doc; no reasoning_effort — 4.7 < 5.2).
582
+ thinkingSchema: "reasoningEffort",
486
583
  // Pinned the LOWEST tier per bigmodel.cn/pricing 2026-08-18:
487
584
  // [0, 32K) input × [0, 0.2K) output — ¥2 / ¥8 / ¥0.4 cache hit
488
585
  // [0, 32K) input × [0.2K+) output — ¥3 / ¥14 / ¥0.6 cache hit
@@ -500,6 +597,8 @@ var PRIMARY_METADATA = {
500
597
  detail: "GLM-5.1 \u2014 200K \u4E0A\u4E0B\u6587\uFF0C\u6700\u5927\u8F93\u51FA 128K\uFF082-tier pricing\uFF09",
501
598
  imageInput: false,
502
599
  toolCalling: true,
600
+ // Thinking switch (no reasoning_effort — 5.1 < 5.2 threshold).
601
+ thinkingSchema: "reasoningEffort",
503
602
  // Pinned the LOWER tier per bigmodel.cn/pricing 2026-08-18:
504
603
  // [0, 32K) — ¥6 input / ¥24 output / ¥1.3 cache hit
505
604
  // [32K+) — ¥8 input / ¥28 output / ¥2 cache hit
@@ -515,6 +614,8 @@ var PRIMARY_METADATA = {
515
614
  detail: "GLM-5 \u2014 200K \u4E0A\u4E0B\u6587\uFF0CAgentic \u5DE5\u5177\u8C03\u7528\uFF0C\u6700\u5927\u8F93\u51FA 128K\uFF082-tier pricing\uFF09",
516
615
  imageInput: false,
517
616
  toolCalling: true,
617
+ // Thinking switch (no reasoning_effort — 5 < 5.2 threshold).
618
+ thinkingSchema: "reasoningEffort",
518
619
  // Pinned the LOWER tier per bigmodel.cn/pricing 2026-08-18:
519
620
  // [0, 32K) — ¥4 input / ¥18 output / ¥1 cache hit
520
621
  // [32K+) — ¥6 input / ¥22 output / ¥1.5 cache hit
@@ -528,6 +629,9 @@ var PRIMARY_METADATA = {
528
629
  detail: "GLM-5 Turbo \u2014 200K \u4E0A\u4E0B\u6587\uFF0C\u6700\u5927\u8F93\u51FA 128K\uFF082-tier pricing\uFF09",
529
630
  imageInput: false,
530
631
  toolCalling: true,
632
+ // Thinking switch (listed in the official ChatThinking doc's
633
+ // auto-think family; no reasoning_effort — 5-Turbo < 5.2).
634
+ thinkingSchema: "reasoningEffort",
531
635
  // Pinned the LOWER tier per bigmodel.cn/pricing 2026-08-18:
532
636
  // [0, 32K) — ¥5 input / ¥22 output / ¥1.2 cache hit
533
637
  // [32K+) — ¥7 input / ¥26 output / ¥1.8 cache hit
@@ -541,6 +645,8 @@ var PRIMARY_METADATA = {
541
645
  detail: "GLM-4.7 FlashX \u2014 \u5FEB\u901F\u7248",
542
646
  imageInput: false,
543
647
  toolCalling: false,
648
+ // Thinking switch (4.7 family; no reasoning_effort).
649
+ thinkingSchema: "reasoningEffort",
544
650
  // ¥0.5 input / ¥3 output / ¥0.1 cache hit per 1M tokens
545
651
  pricingUSD: { input: 0.07, output: 0.42, cacheRead: 0.014 },
546
652
  pricingCNY: { input: 0.5, output: 3, cacheRead: 0.1 },
@@ -552,6 +658,9 @@ var PRIMARY_METADATA = {
552
658
  detail: "GLM-4.6 \u2014 \u5DE5\u5177\u8C03\u7528",
553
659
  imageInput: false,
554
660
  toolCalling: true,
661
+ // Thinking switch (auto-think family per the official
662
+ // ChatThinking doc; no reasoning_effort — 4.6 < 5.2).
663
+ thinkingSchema: "reasoningEffort",
555
664
  pricingUSD: { input: 0.6, output: 2.2, cacheRead: 0.11 },
556
665
  pricingCNY: { input: 4.3, output: 15.7, cacheRead: 0.79 },
557
666
  priceCategory: "medium",
@@ -573,6 +682,9 @@ var PRIMARY_METADATA = {
573
682
  detail: "GLM-4.5 \u2014 \u5DE5\u5177\u8C03\u7528\uFF08\u88F8\u540D\uFF1BZhipu /v1/models \u66B4\u9732\u7684 legacy alias\uFF09",
574
683
  imageInput: false,
575
684
  toolCalling: true,
685
+ // Thinking switch (4.5 generation is the thinking-param floor
686
+ // per the official ChatThinking doc; no reasoning_effort).
687
+ thinkingSchema: "reasoningEffort",
576
688
  pricingUSD: { input: 0, output: 0, cacheRead: null },
577
689
  pricingCNY: { input: 0, output: 0, cacheRead: null },
578
690
  priceCategory: "low",
@@ -583,6 +695,8 @@ var PRIMARY_METADATA = {
583
695
  detail: "GLM-4.5 Air \u2014 \u5DE5\u5177\u8C03\u7528\uFF083-tier pricing\uFF09",
584
696
  imageInput: false,
585
697
  toolCalling: true,
698
+ // Thinking switch (4.5 family; no reasoning_effort).
699
+ thinkingSchema: "reasoningEffort",
586
700
  // Pinned the LOWEST tier per bigmodel.cn/pricing 2026-08-18:
587
701
  // [0, 32K) × [0, 0.2K) output — ¥0.8 / ¥2 / ¥0.16 cache hit
588
702
  // [0, 32K) × [0.2K+) output — ¥0.8 / ¥6 / ¥0.16 cache hit
@@ -599,6 +713,8 @@ var PRIMARY_METADATA = {
599
713
  detail: "GLM-4.5 AirX \u2014 \u5FEB\u901F\u7248\uFF08\xA510/M \u5355\u6863\uFF09",
600
714
  imageInput: false,
601
715
  toolCalling: false,
716
+ // Thinking switch (4.5 family; no reasoning_effort).
717
+ thinkingSchema: "reasoningEffort",
602
718
  // ¥10 / M tokens (single rate, input == output) per
603
719
  // bigmodel.cn/pricing 2026-08-18 — listed under the "模型推理
604
720
  // → Language Models" sub-tab, NOT the flagship text section.
@@ -647,6 +763,9 @@ var PRIMARY_METADATA = {
647
763
  detail: "GLM-4.5V \u89C6\u89C9\u63A8\u7406\u6A21\u578B \u2014 \u56FE\u50CF/\u89C6\u9891/\u6587\u6863/GUI\uFF082-tier pricing\uFF09",
648
764
  imageInput: true,
649
765
  toolCalling: true,
766
+ // Thinking switch (official ChatThinking doc: GLM-4.5V 为强制
767
+ // 思考 when enabled; no reasoning_effort).
768
+ thinkingSchema: "reasoningEffort",
650
769
  // Pinned the LOWER tier per bigmodel.cn/pricing 2026-08-18:
651
770
  // [0, 32K) — ¥2 input / ¥6 output / ¥0.4 cache hit
652
771
  // [32, 64K) — ¥4 input / ¥12 output / ¥0.8 cache hit
@@ -656,10 +775,103 @@ var PRIMARY_METADATA = {
656
775
  maxInputTokens: 64e3,
657
776
  maxOutputTokens: 8192
658
777
  },
778
+ // GLM-4.6V (2026 H1) — 视觉推理模型 (paid version, 2-tier
779
+ // pricing). Distinct from `glm-4.6v-flash` (免费版, 0/0/0) and
780
+ // `glm-4.6v-flashx` (快速版, ¥0.15/¥1.5/¥0.03). Per
781
+ // bigmodel.cn/pricing 2026-08-18 (the same snapshot the
782
+ // §7 table in `byom-glm-learnings.md` was sourced from, where
783
+ // this row was first documented but never landed in
784
+ // MODEL_METADATA until 2026-08-19):
785
+ // [0, 32K) — ¥1 input / ¥3 output / ¥0.2 cache hit
786
+ // [32, 128K) — ¥2 input / ¥6 output / ¥0.4 cache hit
787
+ // The lower tier is pinned per the project's "multi-tier →
788
+ // lowest tier" convention (most prompts < 32K input × < 0.2K
789
+ // output). 4.6V sits between glm-4.5v (¥2/¥6/¥0.4) and the
790
+ // flashx variant — the 4.6 generation is meaningfully cheaper
791
+ // per the 2026 mid-year price reset.
792
+ "glm-4.6v": {
793
+ detail: "GLM-4.6V \u89C6\u89C9\u63A8\u7406\u6A21\u578B \u2014 \u56FE\u50CF/\u89C6\u9891/\u6587\u6863/GUI\uFF082-tier pricing\uFF09",
794
+ imageInput: true,
795
+ toolCalling: true,
796
+ // Thinking switch (same auto-think family as glm-4.5v;
797
+ // 4.6 < 5.2 threshold, so no reasoning_effort).
798
+ thinkingSchema: "reasoningEffort",
799
+ // Pinned the LOWER tier [0, 32K) per bigmodel.cn/pricing
800
+ // 2026-08-18. USD mirrors the CNY/7 ratio with 2-decimal
801
+ // rounding (matches glm-4.5v's USD rounding style).
802
+ pricingUSD: { input: 0.14, output: 0.42, cacheRead: 0.028 },
803
+ pricingCNY: { input: 1, output: 3, cacheRead: 0.2 },
804
+ // Tier boundary is 128K (vs glm-4.5v's 64K), so a
805
+ // `medium` tier tag is still appropriate — the 4.6V is
806
+ // cheaper than glm-4.5v but not a "low" tier like the
807
+ // 0.5/3/0.1 flashx family.
808
+ priceCategory: "medium",
809
+ maxInputTokens: 128e3,
810
+ maxOutputTokens: 8192
811
+ },
812
+ // GLM-4.6V-Flash — the FULLY-FREE vision model on
813
+ // bigmodel.cn/pricing's 视觉理解 tab (every column 免费,
814
+ // 2026-08-18 snapshot). This is the exact model the GLM-for-
815
+ // copilot reference uses as its transparent vision proxy
816
+ // (`DEFAULT_GLM_VISION_MODEL_ID` in its consts.ts — "the
817
+ // extension accepts images for text models through the
818
+ // GLM-4.6V-Flash vision proxy"). Zero cost makes it the
819
+ // natural candidate for our future ProxyVisionAdapter (v2).
820
+ // Token caps mirror the reference's entry (96K input + 32K
821
+ // output = the 128K shared window). Not in the zhipu preset —
822
+ // multimodal models aren't exposed via the public
823
+ // `/v1/chat/completions` models list (same trim rationale as
824
+ // glm-5v-turbo / glm-4.5v); users add it by hand.
825
+ "glm-4.6v-flash": {
826
+ detail: "GLM-4.6V Flash \u2014 \u5B8C\u5168\u514D\u8D39\u89C6\u89C9\u7406\u89E3\u6A21\u578B",
827
+ imageInput: true,
828
+ // Reference consts.ts declares GLM_TOOLS_LIMIT (128) tool
829
+ // calling for this model — the flash vision tier keeps the
830
+ // full function-call surface.
831
+ toolCalling: true,
832
+ // Thinking switch (auto-think family per the reference's
833
+ // `requiresThinkingParam: true`; no reasoning_effort —
834
+ // 4.6 < 5.2 threshold).
835
+ thinkingSchema: "reasoningEffort",
836
+ // Free tier — input / output / cache hit all 0 per
837
+ // bigmodel.cn 2026-08-18. USD mirrors CNY at 0 rather than
838
+ // inventing a rate.
839
+ pricingUSD: { input: 0, output: 0, cacheRead: 0 },
840
+ pricingCNY: { input: 0, output: 0, cacheRead: 0 },
841
+ priceCategory: "low",
842
+ maxInputTokens: 98304,
843
+ maxOutputTokens: 32768
844
+ },
845
+ // GLM-4.6V-FlashX — the 快速版 (quick) paid sibling of the free
846
+ // glm-4.6v-flash. Per bigmodel.cn/pricing 视觉理解 tab
847
+ // (2026-08-18):
848
+ // [0, 32K) — ¥0.15 input / ¥1.5 output / ¥0.03 cache hit
849
+ // [32K, 128K) — ¥0.3 input / ¥3 output / ¥0.03 cache hit
850
+ // The LOWER tier is pinned per the project's multi-tier
851
+ // convention. Not in the zhipu preset (same multimodal trim
852
+ // rationale as glm-4.6v-flash). Token caps are a best-guess
853
+ // from sibling glm-4.6v (128K context / 8K output) — Zhipu
854
+ // publishes no dedicated spec for the flashx vision tier.
855
+ "glm-4.6v-flashx": {
856
+ detail: "GLM-4.6V FlashX \u2014 \u5FEB\u901F\u7248\u89C6\u89C9\u7406\u89E3\uFF082-tier pricing\uFF09",
857
+ imageInput: true,
858
+ // 快速版 convention: the flashx siblings (glm-4.7-flashx,
859
+ // glm-4.5-airx) drop tool calling.
860
+ toolCalling: false,
861
+ thinkingSchema: "reasoningEffort",
862
+ pricingUSD: { input: 0.021, output: 0.21, cacheRead: 42e-4 },
863
+ pricingCNY: { input: 0.15, output: 1.5, cacheRead: 0.03 },
864
+ priceCategory: "low",
865
+ maxInputTokens: 128e3,
866
+ maxOutputTokens: 8192
867
+ },
659
868
  "glm-5v-turbo": {
660
869
  detail: "GLM-5V Turbo \u2014 \u591A\u6A21\u6001 Coding \u6A21\u578B\uFF082-tier pricing\uFF09",
661
870
  imageInput: true,
662
871
  toolCalling: true,
872
+ // Thinking switch (listed in the official ChatThinking doc's
873
+ // auto-think family; no reasoning_effort).
874
+ thinkingSchema: "reasoningEffort",
663
875
  // Pinned the LOWER tier per bigmodel.cn/pricing 2026-08-18:
664
876
  // [0, 32K) — ¥5 input / ¥22 output / ¥1.2 cache hit
665
877
  // [32K+) — ¥7 input / ¥26 output / ¥1.8 cache hit
@@ -805,9 +1017,13 @@ var PRIMARY_METADATA = {
805
1017
  detail: "Qwen3.6-35B-A3B \u2014 35B MoE (3B \u6FC0\u6D3B)\uFF0C\u601D\u8003/\u975E\u601D\u8003\u53CC\u6A21\uFF0C256K \u4E0A\u4E0B\u6587",
806
1018
  imageInput: true,
807
1019
  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 },
1020
+ // SiliconFlow 官方价格页(https://siliconflow.cn/pricing,
1021
+ // re-fetched 2026-08-20):¥1.8 input / ¥10.8 output per 1M
1022
+ // tokens,无缓存价格列。此前 ¥1.612.8 来自发布新闻稿,
1023
+ // 已过时(输入上调、输出下调)。USD = CNY ÷7 镜像取两位
1024
+ // 小数(0.26 / 1.54)。
1025
+ pricingUSD: { input: 0.26, output: 1.54, cacheRead: null },
1026
+ pricingCNY: { input: 1.8, output: 10.8, cacheRead: null },
811
1027
  priceCategory: "low",
812
1028
  // Qwen3.6-35B-A3B 官方 256K context;output 上限按同代 27B
813
1029
  // 同样 32K 取值(Qwen3.6 系列 max output 未单独公布)。
@@ -838,6 +1054,20 @@ var NAMESPACE_ALIASES = {
838
1054
  // from the curated detail / pricing / capability columns.
839
1055
  "glm-4-flashx-250414": "glm-4-flashx"
840
1056
  };
1057
+ var NAMESPACE_ALIAS_FAMILY = {
1058
+ // SiliconFlow
1059
+ "deepseek-ai/DeepSeek-V4-Pro": "SiliconFlow (aggregator)",
1060
+ "deepseek-ai/DeepSeek-V4-Flash": "SiliconFlow (aggregator)",
1061
+ "zai-org/GLM-5.2": "SiliconFlow (aggregator)",
1062
+ "Qwen/Qwen3.6-35B-A3B": "SiliconFlow (aggregator)",
1063
+ "moonshotai/Kimi-K2.7-Code": "SiliconFlow (aggregator)",
1064
+ // Novita
1065
+ "deepseek/deepseek-v4-pro": "Novita (aggregator)",
1066
+ "deepseek/deepseek-v4-flash": "Novita (aggregator)",
1067
+ "zai/glm-5.2": "Novita (aggregator)",
1068
+ "zai/glm-5.1": "Novita (aggregator)",
1069
+ "moonshotai/kimi-k3": "Novita (aggregator)"
1070
+ };
841
1071
  var MODEL_METADATA = (() => {
842
1072
  const merged = {
843
1073
  ...PRIMARY_METADATA
@@ -856,14 +1086,26 @@ function lookupModelMetadata(modelId) {
856
1086
  function currencyForBaseUrl(baseUrl) {
857
1087
  try {
858
1088
  const hostname = new URL(baseUrl).hostname.toLowerCase();
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
1089
+ if (hostname === "api.minimaxi.com" || hostname === "api.minimaxi.cn" || hostname === "api.moonshot.cn" || hostname === "open.bigmodel.cn" || // Zhipu legacy v3 host. Per the GLM-for-copilot reference
860
1090
  // (`docs/references/GLM-for-copilot-main/src/endpoint.ts:4`)
861
1091
  // this was retired to `bigmodel.cn` but is still
862
1092
  // resolvable for accounts that haven't migrated — we
863
1093
  // don't surface it in the baseUrl dropdown, but a user
864
1094
  // may paste it from a saved settings.json, so the
865
1095
  // currency has to match (CNY, same as the new host).
866
- hostname === "dev.bigmodel.cn") {
1096
+ hostname === "dev.bigmodel.cn" || // DeepSeek — 2026-08-20 product decision (user request):
1097
+ // surface the domestic ¥ prices. The `.com` endpoint
1098
+ // serves both regions, but our user base bills in CNY on
1099
+ // it (the official zh-cn pricing page publishes the ¥
1100
+ // table for this endpoint), so the picker now shows the
1101
+ // CNY block. This REVERSES the 2026-08-19 mapping that
1102
+ // left it in the USD catch-all ("$ block corresponds to
1103
+ // the .com endpoint") — with a CNY-billed user base, the
1104
+ // ¥ block is the relevant one. The pricingCNY block in
1105
+ // MODEL_METADATA pins the PEAK tier for these entries
1106
+ // (conservative worst-case; see the deepseek-v4-flash
1107
+ // comment).
1108
+ hostname === "api.deepseek.com") {
867
1109
  return "CNY";
868
1110
  }
869
1111
  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
@@ -886,13 +1128,14 @@ function currencyForBaseUrl(baseUrl) {
886
1128
  }
887
1129
 
888
1130
  // src/ai/providers.presets.ts
889
- function buildPresetModel(id, displayName) {
1131
+ function buildPresetModel(id, displayName, baseUrl) {
890
1132
  const meta = MODEL_METADATA[id];
891
1133
  if (!meta) {
892
1134
  throw new Error(
893
1135
  `buildPresetModel: no curated MODEL_METADATA entry for '${id}' \u2014 add one before referencing it from BUILTIN_PROVIDER_PRESETS.`
894
1136
  );
895
1137
  }
1138
+ const currency = baseUrl ? currencyForBaseUrl(baseUrl) : "USD";
896
1139
  return {
897
1140
  id,
898
1141
  displayName,
@@ -903,11 +1146,95 @@ function buildPresetModel(id, displayName) {
903
1146
  supportsImageToText: meta.imageInput,
904
1147
  supportsToolCalling: meta.toolCalling
905
1148
  },
906
- pricing: meta.pricingUSD,
1149
+ pricing: meta[`pricing${currency}`],
907
1150
  priceCategory: meta.priceCategory,
908
1151
  thinkingSchema: meta.thinkingSchema ?? "none"
909
1152
  };
910
1153
  }
1154
+ function unionProviderModelWithPreset(fetched, baseUrl) {
1155
+ const meta = MODEL_METADATA[fetched.id];
1156
+ if (!meta) {
1157
+ return fetched;
1158
+ }
1159
+ const currency = baseUrl ? currencyForBaseUrl(baseUrl) : "USD";
1160
+ const presetDisplayName = getPresetModelDisplayName(fetched.id);
1161
+ const displayName = typeof fetched.displayName === "string" && fetched.displayName.length > 0 ? fetched.displayName : presetDisplayName;
1162
+ return {
1163
+ // Spread fetched first so `id` wins, then overlay the
1164
+ // curated fields. (Curated fields ALWAYS win over fetched
1165
+ // per the precedence above — that's why they're explicit,
1166
+ // not relying on spread order.)
1167
+ ...fetched,
1168
+ displayName,
1169
+ detail: meta.detail,
1170
+ capabilities: {
1171
+ supportsImageToText: meta.imageInput,
1172
+ supportsToolCalling: meta.toolCalling
1173
+ },
1174
+ pricing: meta[`pricing${currency}`],
1175
+ priceCategory: meta.priceCategory,
1176
+ // thinkingSchema: prefer preset (curated), fall back to
1177
+ // fetched (in case the API publishes a schema the
1178
+ // preset doesn't know about), then "none" to match
1179
+ // `buildPresetModel`'s explicit-none convention so the
1180
+ // picker renders identically for preset vs fetched rows.
1181
+ thinkingSchema: meta.thinkingSchema ?? fetched.thinkingSchema ?? "none",
1182
+ // Token caps: preset is curated; if the preset doesn't
1183
+ // publish a cap, keep whatever fetched supplied (the
1184
+ // user may have entered it by hand earlier).
1185
+ maxInputTokens: meta.maxInputTokens ?? fetched.maxInputTokens,
1186
+ maxOutputTokens: meta.maxOutputTokens ?? fetched.maxOutputTokens
1187
+ };
1188
+ }
1189
+ var PRESET_MODEL_FAMILIES = [
1190
+ "GLM",
1191
+ "DeepSeek",
1192
+ "Kimi",
1193
+ "StepFun",
1194
+ "MiniMax",
1195
+ "Agnes",
1196
+ "Qwen",
1197
+ "SiliconFlow (aggregator)",
1198
+ "Novita (aggregator)",
1199
+ "OpenRouter (aggregator)"
1200
+ ];
1201
+ function vendorFamilyForId(id) {
1202
+ const aliasFamily = NAMESPACE_ALIAS_FAMILY[id];
1203
+ if (aliasFamily) return aliasFamily;
1204
+ if (id.startsWith("glm-")) return "GLM";
1205
+ if (id.startsWith("deepseek-")) return "DeepSeek";
1206
+ if (id.startsWith("kimi-")) return "Kimi";
1207
+ if (id.startsWith("step-")) return "StepFun";
1208
+ if (id.startsWith("MiniMax-")) return "MiniMax";
1209
+ if (id.startsWith("agnes-")) return "Agnes";
1210
+ if (id.startsWith("Qwen")) return "Qwen";
1211
+ if (id.startsWith("openrouter/")) return "OpenRouter (aggregator)";
1212
+ return "Other";
1213
+ }
1214
+ var LISTABLE_PRESET_MODELS = (() => {
1215
+ const aggregatorAliasKeys = new Set(Object.keys(NAMESPACE_ALIAS_FAMILY));
1216
+ const allIds = Object.keys(MODEL_METADATA).filter((id) => {
1217
+ if (NAMESPACE_ALIASES[id] === void 0) return true;
1218
+ return aggregatorAliasKeys.has(id);
1219
+ }).sort();
1220
+ return allIds.map((id) => ({
1221
+ id,
1222
+ displayName: id,
1223
+ vendorFamily: vendorFamilyForId(id)
1224
+ }));
1225
+ })();
1226
+ function listPresetModelGroups() {
1227
+ const byFamily = /* @__PURE__ */ new Map();
1228
+ for (const entry of LISTABLE_PRESET_MODELS) {
1229
+ const bucket = byFamily.get(entry.vendorFamily) ?? [];
1230
+ bucket.push(entry);
1231
+ byFamily.set(entry.vendorFamily, bucket);
1232
+ }
1233
+ return PRESET_MODEL_FAMILIES.filter((f) => byFamily.has(f)).map((family) => ({
1234
+ family,
1235
+ entries: byFamily.get(family) ?? []
1236
+ }));
1237
+ }
911
1238
  var BUILTIN_PROVIDER_PRESETS = {
912
1239
  minimax: {
913
1240
  displayName: "MiniMax",
@@ -933,14 +1260,18 @@ var BUILTIN_PROVIDER_PRESETS = {
933
1260
  // (otherwise the user's added model never shows up in the
934
1261
  // Copilot Chat picker).
935
1262
  models: [
936
- buildPresetModel("MiniMax-M3", "MiniMax-M3"),
937
- buildPresetModel("MiniMax-M2.7", "MiniMax-M2.7"),
938
- buildPresetModel("MiniMax-M2.7-highspeed", "MiniMax-M2.7-highspeed"),
1263
+ buildPresetModel("MiniMax-M3", "MiniMax-M3", "https://api.minimaxi.com/anthropic"),
1264
+ buildPresetModel("MiniMax-M2.7", "MiniMax-M2.7", "https://api.minimaxi.com/anthropic"),
1265
+ buildPresetModel(
1266
+ "MiniMax-M2.7-highspeed",
1267
+ "MiniMax-M2.7-highspeed",
1268
+ "https://api.minimaxi.com/anthropic"
1269
+ ),
939
1270
  // M2.5 (2026-02-13, 80.2% SWE-Bench Verified) — the
940
1271
  // predecessor of M2.7. Still in the catalog and often
941
1272
  // available on MiniMax's promotional $0.30/$1.20 rate, so
942
1273
  // keep it as a preset for users on the M2.5 plan tier.
943
- buildPresetModel("MiniMax-M2.5", "MiniMax-M2.5")
1274
+ buildPresetModel("MiniMax-M2.5", "MiniMax-M2.5", "https://api.minimaxi.com/anthropic")
944
1275
  ]
945
1276
  },
946
1277
  deepseek: {
@@ -962,8 +1293,8 @@ var BUILTIN_PROVIDER_PRESETS = {
962
1293
  // the recommended default — users still on V3 can override
963
1294
  // these defaults in the ProvidersTab form.
964
1295
  models: [
965
- buildPresetModel("deepseek-v4-flash", "DeepSeek V4 Flash"),
966
- buildPresetModel("deepseek-v4-pro", "DeepSeek V4 Pro")
1296
+ buildPresetModel("deepseek-v4-flash", "DeepSeek V4 Flash", "https://api.deepseek.com/v1"),
1297
+ buildPresetModel("deepseek-v4-pro", "DeepSeek V4 Pro", "https://api.deepseek.com/v1")
967
1298
  ]
968
1299
  },
969
1300
  agnes: {
@@ -971,19 +1302,34 @@ var BUILTIN_PROVIDER_PRESETS = {
971
1302
  // Sapiens AI's Agnes — OpenAI-compatible endpoint per
972
1303
  // https://wiki.agnes-ai.com (`POST /v1/chat/completions`).
973
1304
  baseUrl: "https://apihub.agnes-ai.com/v1",
1305
+ // Order mirrors the vendor docs index (wiki.agnes-ai.com,
1306
+ // fetched 2026-08-19): paid reasoning models first — the
1307
+ // commercial stable `agnes-2.5-pro` leads, then the
1308
+ // benchmark-listed alpha — followed by the flash tier
1309
+ // newest-first.
974
1310
  models: [
975
- buildPresetModel("agnes-2.5-pro-alpha", "Agnes 2.5 Pro Alpha"),
976
- buildPresetModel("agnes-2.0-flash", "Agnes 2.0 Flash")
1311
+ buildPresetModel("agnes-2.5-pro", "Agnes 2.5 Pro", "https://apihub.agnes-ai.com/v1"),
1312
+ buildPresetModel(
1313
+ "agnes-2.5-pro-alpha",
1314
+ "Agnes 2.5 Pro Alpha",
1315
+ "https://apihub.agnes-ai.com/v1"
1316
+ ),
1317
+ buildPresetModel("agnes-2.5-flash", "Agnes 2.5 Flash", "https://apihub.agnes-ai.com/v1"),
1318
+ buildPresetModel("agnes-2.0-flash", "Agnes 2.0 Flash", "https://apihub.agnes-ai.com/v1")
977
1319
  ]
978
1320
  },
979
1321
  kimi: {
980
1322
  displayName: "Kimi",
981
1323
  baseUrl: "https://api.moonshot.cn/v1",
982
1324
  models: [
983
- buildPresetModel("kimi-k3", "Kimi K3"),
984
- buildPresetModel("kimi-k2.7-code", "Kimi K2.7 Code"),
985
- buildPresetModel("kimi-k2.7-code-highspeed", "Kimi K2.7 Code HighSpeed"),
986
- buildPresetModel("kimi-k2.6", "Kimi K2.6")
1325
+ buildPresetModel("kimi-k3", "Kimi K3", "https://api.moonshot.cn/v1"),
1326
+ buildPresetModel("kimi-k2.7-code", "Kimi K2.7 Code", "https://api.moonshot.cn/v1"),
1327
+ buildPresetModel(
1328
+ "kimi-k2.7-code-highspeed",
1329
+ "Kimi K2.7 Code HighSpeed",
1330
+ "https://api.moonshot.cn/v1"
1331
+ ),
1332
+ buildPresetModel("kimi-k2.6", "Kimi K2.6", "https://api.moonshot.cn/v1")
987
1333
  ]
988
1334
  },
989
1335
  zhipu: {
@@ -1055,24 +1401,28 @@ var BUILTIN_PROVIDER_PRESETS = {
1055
1401
  // `MODEL_METADATA` entries are kept so the id is still
1056
1402
  // resolvable for the curated detail / pricing columns.
1057
1403
  models: [
1058
- buildPresetModel("glm-5.3", "GLM-5.3"),
1059
- buildPresetModel("glm-5.2", "GLM-5.2"),
1060
- buildPresetModel("glm-5.1", "GLM-5.1"),
1061
- buildPresetModel("glm-5", "GLM-5"),
1062
- buildPresetModel("glm-5-turbo", "GLM-5 Turbo"),
1063
- buildPresetModel("glm-4.7", "GLM-4.7"),
1064
- buildPresetModel("glm-4.6", "GLM-4.6"),
1065
- buildPresetModel("glm-4.5-air", "GLM-4.5 Air"),
1066
- buildPresetModel("glm-4.5", "GLM-4.5")
1404
+ buildPresetModel("glm-5.3", "GLM-5.3", "https://open.bigmodel.cn/api/paas/v4"),
1405
+ buildPresetModel("glm-5.2", "GLM-5.2", "https://open.bigmodel.cn/api/paas/v4"),
1406
+ buildPresetModel("glm-5.1", "GLM-5.1", "https://open.bigmodel.cn/api/paas/v4"),
1407
+ buildPresetModel("glm-5", "GLM-5", "https://open.bigmodel.cn/api/paas/v4"),
1408
+ buildPresetModel("glm-5-turbo", "GLM-5 Turbo", "https://open.bigmodel.cn/api/paas/v4"),
1409
+ buildPresetModel("glm-4.7", "GLM-4.7", "https://open.bigmodel.cn/api/paas/v4"),
1410
+ buildPresetModel("glm-4.6", "GLM-4.6", "https://open.bigmodel.cn/api/paas/v4"),
1411
+ buildPresetModel("glm-4.5-air", "GLM-4.5 Air", "https://open.bigmodel.cn/api/paas/v4"),
1412
+ buildPresetModel("glm-4.5", "GLM-4.5", "https://open.bigmodel.cn/api/paas/v4")
1067
1413
  ]
1068
1414
  },
1069
1415
  stepfun: {
1070
1416
  displayName: "StepFun",
1071
1417
  baseUrl: "https://api.stepfun.com/v1",
1072
1418
  models: [
1073
- buildPresetModel("step-3.7-flash", "Step 3.7 Flash"),
1074
- buildPresetModel("step-3.5-flash", "Step 3.5 Flash"),
1075
- buildPresetModel("step-1o-turbo-vision", "Step 1o Turbo Vision")
1419
+ buildPresetModel("step-3.7-flash", "Step 3.7 Flash", "https://api.stepfun.com/v1"),
1420
+ buildPresetModel("step-3.5-flash", "Step 3.5 Flash", "https://api.stepfun.com/v1"),
1421
+ buildPresetModel(
1422
+ "step-1o-turbo-vision",
1423
+ "Step 1o Turbo Vision",
1424
+ "https://api.stepfun.com/v1"
1425
+ )
1076
1426
  ]
1077
1427
  },
1078
1428
  siliconflow: {
@@ -1086,20 +1436,42 @@ var BUILTIN_PROVIDER_PRESETS = {
1086
1436
  // 与 MODEL_METADATA 的 alias 严格一致。
1087
1437
  models: [
1088
1438
  // 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)"),
1439
+ buildPresetModel(
1440
+ "deepseek-ai/DeepSeek-V4-Pro",
1441
+ "DeepSeek V4 Pro (via SiliconFlow)",
1442
+ "https://api.siliconflow.cn/v1"
1443
+ ),
1444
+ buildPresetModel(
1445
+ "deepseek-ai/DeepSeek-V4-Flash",
1446
+ "DeepSeek V4 Flash (via SiliconFlow)",
1447
+ "https://api.siliconflow.cn/v1"
1448
+ ),
1091
1449
  // GLM-5.2 (2026-06-17) — open-weight 编程旗舰,1M context
1092
- buildPresetModel("zai-org/GLM-5.2", "GLM-5.2 (via SiliconFlow)"),
1450
+ buildPresetModel(
1451
+ "zai-org/GLM-5.2",
1452
+ "GLM-5.2 (via SiliconFlow)",
1453
+ "https://api.siliconflow.cn/v1"
1454
+ ),
1093
1455
  // Qwen3.6-35B-A3B (2026-04) — 35B MoE, 3B 激活,"小而强"
1094
- buildPresetModel("Qwen/Qwen3.6-35B-A3B", "Qwen3.6-35B-A3B (via SiliconFlow)"),
1456
+ buildPresetModel(
1457
+ "Qwen/Qwen3.6-35B-A3B",
1458
+ "Qwen3.6-35B-A3B (via SiliconFlow)",
1459
+ "https://api.siliconflow.cn/v1"
1460
+ ),
1095
1461
  // Kimi K2.7-Code (2026-06-12) — Moonshot coding 旗舰
1096
- buildPresetModel("moonshotai/Kimi-K2.7-Code", "Kimi K2.7 Code (via SiliconFlow)")
1462
+ buildPresetModel(
1463
+ "moonshotai/Kimi-K2.7-Code",
1464
+ "Kimi K2.7 Code (via SiliconFlow)",
1465
+ "https://api.siliconflow.cn/v1"
1466
+ )
1097
1467
  ]
1098
1468
  },
1099
1469
  openrouter: {
1100
1470
  displayName: "OpenRouter",
1101
1471
  baseUrl: "https://openrouter.ai/api/v1",
1102
- models: [buildPresetModel("openrouter/auto", "OpenRouter Auto")]
1472
+ models: [
1473
+ buildPresetModel("openrouter/auto", "OpenRouter Auto", "https://openrouter.ai/api/v1")
1474
+ ]
1103
1475
  },
1104
1476
  novita: {
1105
1477
  displayName: "Novita",
@@ -1111,16 +1483,76 @@ var BUILTIN_PROVIDER_PRESETS = {
1111
1483
  // 完整列表。id 严格匹配 Novita API 的 namespaced 字符串。
1112
1484
  models: [
1113
1485
  // 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)"),
1486
+ buildPresetModel(
1487
+ "deepseek/deepseek-v4-pro",
1488
+ "DeepSeek V4 Pro (via Novita)",
1489
+ "https://api.novita.ai/openai/v1"
1490
+ ),
1491
+ buildPresetModel(
1492
+ "deepseek/deepseek-v4-flash",
1493
+ "DeepSeek V4 Flash (via Novita)",
1494
+ "https://api.novita.ai/openai/v1"
1495
+ ),
1116
1496
  // 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)"),
1497
+ buildPresetModel("zai/glm-5.2", "GLM-5.2 (via Novita)", "https://api.novita.ai/openai/v1"),
1498
+ buildPresetModel("zai/glm-5.1", "GLM-5.1 (via Novita)", "https://api.novita.ai/openai/v1"),
1119
1499
  // Kimi K3 (2026-07-16 API, 2026-07-27 开源) — 1M context, 2.8T MoE
1120
- buildPresetModel("moonshotai/kimi-k3", "Kimi K3 (via Novita)")
1500
+ buildPresetModel(
1501
+ "moonshotai/kimi-k3",
1502
+ "Kimi K3 (via Novita)",
1503
+ "https://api.novita.ai/openai/v1"
1504
+ )
1121
1505
  ]
1506
+ },
1507
+ medalsoft: {
1508
+ displayName: "Medalsoft",
1509
+ // Medalsoft internal LLM gateway (公司内部代理) — OpenAI-compatible
1510
+ // `/v1/chat/completions`. The gateway forwards to upstream vendors
1511
+ // (GLM / DeepSeek / Kimi / ...), so the model catalogue is dynamic
1512
+ // and NOT curated here: the preset ships an EMPTY starter list and
1513
+ // the user populates it via "Fetch from API" (`GET /v1/models`) in
1514
+ // the ProvidersTab. `buildPresetModel`'s fail-loudly contract is
1515
+ // why we don't guess ids — a curated `MODEL_METADATA` entry only
1516
+ // exists for vendor-native ids, not the gateway's routing table.
1517
+ //
1518
+ // NOTE: models fetched from the gateway carry the upstream model
1519
+ // ids, so the curated metadata (pricing / thinking dropdown /
1520
+ // token caps) still resolves via `MODEL_METADATA` after the fetch.
1521
+ baseUrl: "https://llm.proxy.alio.wang/v1",
1522
+ models: []
1122
1523
  }
1123
1524
  };
1525
+ var PRESET_MODEL_DISPLAY_NAMES = (() => {
1526
+ const map = {};
1527
+ for (const preset of Object.values(BUILTIN_PROVIDER_PRESETS)) {
1528
+ for (const model of preset.models) {
1529
+ if (model.displayName !== void 0) {
1530
+ map[model.id] = model.displayName;
1531
+ }
1532
+ }
1533
+ }
1534
+ return Object.freeze(map);
1535
+ })();
1536
+ function getPresetModelDisplayName(id) {
1537
+ const explicit = PRESET_MODEL_DISPLAY_NAMES[id];
1538
+ if (explicit !== void 0) {
1539
+ return explicit;
1540
+ }
1541
+ const meta = MODEL_METADATA[id];
1542
+ if (meta === void 0) {
1543
+ return void 0;
1544
+ }
1545
+ const detail = meta.detail;
1546
+ if (typeof detail !== "string" || detail.trim() === "") {
1547
+ return void 0;
1548
+ }
1549
+ const dashIndex = detail.indexOf(" \u2014 ");
1550
+ if (dashIndex === -1) {
1551
+ return detail;
1552
+ }
1553
+ const head = detail.slice(0, dashIndex).trim();
1554
+ return head === "" ? void 0 : head;
1555
+ }
1124
1556
  function getBuiltinProviderPreset(type) {
1125
1557
  switch (type) {
1126
1558
  case "minimax":
@@ -1132,6 +1564,7 @@ function getBuiltinProviderPreset(type) {
1132
1564
  case "siliconflow":
1133
1565
  case "openrouter":
1134
1566
  case "novita":
1567
+ case "medalsoft":
1135
1568
  return BUILTIN_PROVIDER_PRESETS[type];
1136
1569
  default:
1137
1570
  return null;
@@ -1555,6 +1988,8 @@ var WebviewMessageType = /* @__PURE__ */ ((WebviewMessageType2) => {
1555
1988
  WebviewMessageType2["SetProviderOrder"] = "setProviderOrder";
1556
1989
  WebviewMessageType2["TestProvider"] = "testProvider";
1557
1990
  WebviewMessageType2["ProviderTestResultMessage"] = "providerTestResult";
1991
+ WebviewMessageType2["TestProviderModel"] = "testProviderModel";
1992
+ WebviewMessageType2["ProviderTestModelResultMessage"] = "providerTestModelResult";
1558
1993
  WebviewMessageType2["DefaultProviderChanged"] = "defaultProviderChanged";
1559
1994
  WebviewMessageType2["FetchProviderModels"] = "fetchProviderModels";
1560
1995
  WebviewMessageType2["FetchProviderModelsResult"] = "fetchProviderModelsResult";
@@ -1646,8 +2081,12 @@ function safeJson(text, fallback) {
1646
2081
  GetCachedServerUrl,
1647
2082
  GetServerProxyState,
1648
2083
  GetUtilityModels,
2084
+ LISTABLE_PRESET_MODELS,
1649
2085
  LogLevel,
1650
2086
  MODEL_METADATA,
2087
+ NAMESPACE_ALIASES,
2088
+ NAMESPACE_ALIAS_FAMILY,
2089
+ PRESET_MODEL_FAMILIES,
1651
2090
  PROVIDER_BASE_URL_PRESETS,
1652
2091
  PROVIDER_CACHE_CONTROL_METADATA,
1653
2092
  ServerProxyStateResponse,
@@ -1660,6 +2099,7 @@ function safeJson(text, fallback) {
1660
2099
  __internal,
1661
2100
  asAbortSignal,
1662
2101
  buildGitHubLocalEmail,
2102
+ buildPresetModel,
1663
2103
  checkGitHubOrgMembership,
1664
2104
  createConsoleLogger,
1665
2105
  currencyForBaseUrl,
@@ -1667,10 +2107,12 @@ function safeJson(text, fallback) {
1667
2107
  fetchGitHubUser,
1668
2108
  getBuiltinProviderPreset,
1669
2109
  getGitHubOrgMembership,
2110
+ getPresetModelDisplayName,
1670
2111
  getProviderBaseUrlPresets,
1671
2112
  isGitHubLocalEmail,
1672
2113
  isProviderCacheControlAware,
1673
2114
  isValidCanonicalSlug,
2115
+ listPresetModelGroups,
1674
2116
  lookupModelMetadata,
1675
2117
  normalizeCanonicalSlug,
1676
2118
  normalizeErrorForLog,
@@ -1678,5 +2120,6 @@ function safeJson(text, fallback) {
1678
2120
  parsePayload,
1679
2121
  protocolForBaseUrl,
1680
2122
  resolvePrimaryEmail,
1681
- safeJson
2123
+ safeJson,
2124
+ unionProviderModelWithPreset
1682
2125
  });