@serviceme/devtools-shared 0.4.7 → 0.4.8

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.mjs CHANGED
@@ -50,8 +50,14 @@ var PROVIDER_BASE_URL_PRESETS = {
50
50
  // pasted `open.bigmodel.cn/api/paas/v4` into a Coding Plan
51
51
  // key, and Z.ai users had no preset to pick.
52
52
  // ── 国内 (open.bigmodel.cn — CNY) ───────────────────────
53
- { label: "\u56FD\u5185 \xB7 \u6807\u51C6 API", baseUrl: "https://open.bigmodel.cn/api/paas/v4" },
54
- { label: "\u56FD\u5185 \xB7 Coding Plan", baseUrl: "https://open.bigmodel.cn/api/coding/paas/v4" },
53
+ {
54
+ label: "\u56FD\u5185 \xB7 \u6807\u51C6 API",
55
+ baseUrl: "https://open.bigmodel.cn/api/paas/v4"
56
+ },
57
+ {
58
+ label: "\u56FD\u5185 \xB7 Coding Plan",
59
+ baseUrl: "https://open.bigmodel.cn/api/coding/paas/v4"
60
+ },
55
61
  // 重要:Anthropic 协议端点 **复用** Coding Plan 的 key(与
56
62
  // `/api/coding/paas/v4` 共用同一凭证;不是 Standard API key,
57
63
  // 也没有独立的 "Anthropic API key")。
@@ -68,8 +74,14 @@ var PROVIDER_BASE_URL_PRESETS = {
68
74
  },
69
75
  // ── 国际 (api.z.ai — USD) ───────────────────────────────
70
76
  { label: "\u56FD\u9645 \xB7 \u6807\u51C6 API", baseUrl: "https://api.z.ai/api/paas/v4" },
71
- { label: "\u56FD\u9645 \xB7 Coding Plan", baseUrl: "https://api.z.ai/api/coding/paas/v4" },
72
- { label: "\u56FD\u9645 \xB7 Coding Plan \xB7 Anthropic \u534F\u8BAE", baseUrl: "https://api.z.ai/api/anthropic" }
77
+ {
78
+ label: "\u56FD\u9645 \xB7 Coding Plan",
79
+ baseUrl: "https://api.z.ai/api/coding/paas/v4"
80
+ },
81
+ {
82
+ label: "\u56FD\u9645 \xB7 Coding Plan \xB7 Anthropic \u534F\u8BAE",
83
+ baseUrl: "https://api.z.ai/api/anthropic"
84
+ }
73
85
  ],
74
86
  stepfun: [{ label: "\u5B98\u65B9", baseUrl: "https://api.stepfun.com/v1" }],
75
87
  siliconflow: [
@@ -82,6 +94,8 @@ var PROVIDER_BASE_URL_PRESETS = {
82
94
  { label: "\u56FD\u5185", baseUrl: "https://api.agnes-ai.cn/v1" },
83
95
  { label: "\u5168\u7403", baseUrl: "https://apihub.agnes-ai.com/v1" }
84
96
  ],
97
+ // Medalsoft internal LLM gateway — single OpenAI-compatible endpoint.
98
+ medalsoft: [{ label: "\u5185\u90E8\u7F51\u5173", baseUrl: "https://llm.proxy.alio.wang/v1" }],
85
99
  "vscode-builtin": []
86
100
  };
87
101
  function getProviderBaseUrlPresets(type) {
@@ -109,6 +123,12 @@ var PROVIDER_CACHE_CONTROL_METADATA = {
109
123
  agnes: {
110
124
  supportsCacheControl: true
111
125
  },
126
+ // Medalsoft internal gateway — OpenAI-compatible pass-through; the
127
+ // upstream's prompt-cache behaviour is unknown from outside, so we
128
+ // don't declare support (no `prompt_cache_key` header is written).
129
+ // Flip to `supportsCacheControl: true` once the gateway is verified
130
+ // to honour stable prompt caching.
131
+ medalsoft: {},
112
132
  "vscode-builtin": {}
113
133
  };
114
134
  function isProviderCacheControlAware(type) {
@@ -254,6 +274,44 @@ var PRIMARY_METADATA = {
254
274
  maxInputTokens: 934976,
255
275
  maxOutputTokens: 65536
256
276
  },
277
+ "agnes-2.5-pro": {
278
+ detail: "Paid reasoning model \u2014 commercial stable of 2.5 Pro Alpha (advanced coding, scientific reasoning, long context, multimodal). 1M context / 65K max output",
279
+ imageInput: true,
280
+ toolCalling: true,
281
+ // Official pricing per https://wiki.agnes-ai.com/en/docs/agnes-25-pro.md
282
+ // (fetched 2026-08-19) — identical to 2.5 Pro Alpha:
283
+ // $0.45 input / $0.0038 cache read / $0.90 output per 1M tokens.
284
+ // No separate CNY tier is published, so pricingCNY mirrors USD.
285
+ pricingUSD: { input: 0.45, output: 0.9, cacheRead: 38e-4 },
286
+ pricingCNY: { input: 0.45, output: 0.9, cacheRead: 38e-4 },
287
+ priceCategory: "medium",
288
+ // Same binary Thinking on/off switch as the other Agnes models
289
+ // (`chat_template_kwargs.enable_thinking` on the OpenAI wire).
290
+ thinkingSchema: "thinkingEnabled",
291
+ // Same published window as 2.5 Pro Alpha: 1M context /
292
+ // 65536 max output — input cap mirrors the alpha entry.
293
+ maxInputTokens: 934976,
294
+ maxOutputTokens: 65536
295
+ },
296
+ "agnes-2.5-flash": {
297
+ detail: "GA upgrade of Agnes 2.0 Flash \u2014 stronger coding, agent workflows, tool calling, image understanding (512K context)",
298
+ imageInput: true,
299
+ toolCalling: true,
300
+ // Standard (post-promo) pricing per
301
+ // https://wiki.agnes-ai.com/en/docs/agnes-25-flash.md (fetched
302
+ // 2026-08-19) — same list price as 2.0 Flash ($0.03 / $0.15 per
303
+ // 1M tokens); the temporary $0 / $0 promo is ignored per the
304
+ // same policy as the 2.0 Flash entry. No separate CNY tier is
305
+ // published, so pricingCNY mirrors the USD numbers.
306
+ pricingUSD: { input: 0.03, output: 0.15, cacheRead: null },
307
+ pricingCNY: { input: 0.03, output: 0.15, cacheRead: null },
308
+ priceCategory: "low",
309
+ // Same binary Thinking on/off switch as 2.0 Flash
310
+ // (`chat_template_kwargs.enable_thinking` on the OpenAI wire).
311
+ thinkingSchema: "thinkingEnabled",
312
+ maxInputTokens: 512e3,
313
+ maxOutputTokens: 65536
314
+ },
257
315
  // ── Kimi (月之暗面 / Moonshot AI) ────────────────────────────────
258
316
  // Source: https://platform.kimi.com/docs/pricing/chat-k3,
259
317
  // chat-k27-code, chat-k26 (fetched 2026-07-27). Prices are per 1M
@@ -342,6 +400,13 @@ var PRIMARY_METADATA = {
342
400
  detail: "GLM-5.2 \u2014 1M \u4E0A\u4E0B\u6587\uFF0C\u6700\u5927\u8F93\u51FA 128K\uFF08\u5355\u6863 pricing\uFF09",
343
401
  imageInput: false,
344
402
  toolCalling: true,
403
+ // Thinking-mode dropdown + `reasoning_effort`. Zhipu official
404
+ // OpenAPI (fetched 2026-08-19): "仅 GLM-5.2 及其以上模型支持"
405
+ // reasoning_effort; for 5.2 the server maps none/minimal → give
406
+ // up thinking, low/medium → high, xhigh → max (we only send the
407
+ // native high/max so no client-side aliasing is needed).
408
+ thinkingSchema: "reasoningEffort",
409
+ supportsReasoningEffort: true,
345
410
  // Single rate (no input-length tier split) per
346
411
  // bigmodel.cn/pricing 2026-08-18:
347
412
  // ¥8 input / ¥28 output / ¥2 cache hit per 1M tokens
@@ -363,6 +428,14 @@ var PRIMARY_METADATA = {
363
428
  detail: "GLM-5.3 \u2014 1M \u4E0A\u4E0B\u6587\uFF0C\u540E\u8BAD\u7EC3\u589E\u5F3A\u4EE3\u7801 / \u7F51\u7EDC\u5B89\u5168",
364
429
  imageInput: false,
365
430
  toolCalling: true,
431
+ // Thinking-mode dropdown (思考模式 停用/标准/深度) + the
432
+ // `reasoning_effort` field. Zhipu official OpenAPI (fetched
433
+ // 2026-08-19): GLM-5.3 restricts `thinking.type` to "enabled"
434
+ // and controls depth via `reasoning_effort` (low/high/max
435
+ // only). Mirrors `supportsReasoningEffort: true` in
436
+ // `docs/references/GLM-for-copilot-main/src/consts.ts`.
437
+ thinkingSchema: "reasoningEffort",
438
+ supportsReasoningEffort: true,
366
439
  // Vendor-published USD price (Decrypt, 2026-08-14). Cache-hit price
367
440
  // has not been published — the picker shows "(not published)" rather
368
441
  // than fabricating a number (the rate usually diverges 4–10× from
@@ -384,6 +457,8 @@ var PRIMARY_METADATA = {
384
457
  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",
385
458
  imageInput: false,
386
459
  toolCalling: true,
460
+ // Thinking switch (no reasoning_effort — 5.1 < 5.2 threshold).
461
+ thinkingSchema: "reasoningEffort",
387
462
  // Mirrors GLM-5.1 [0, 32K) tier per bigmodel.cn/pricing 2026-08-18.
388
463
  // TileRT is a serving-side optim; the per-token rate is the same
389
464
  // architecture as the base model.
@@ -403,6 +478,8 @@ var PRIMARY_METADATA = {
403
478
  detail: "GLM-4.7 Flash \u2014 \u5B8C\u5168\u514D\u8D39\uFF08200K \u4E0A\u4E0B\u6587\uFF09",
404
479
  imageInput: false,
405
480
  toolCalling: true,
481
+ // Thinking switch (no reasoning_effort — 4.7 < 5.2 threshold).
482
+ thinkingSchema: "reasoningEffort",
406
483
  // Free tier — input / output / cache hit all 0 (bigmodel.cn
407
484
  // 2026-08-18 lists "免费" for every column). USD mirrors CNY
408
485
  // rather than inventing a rate.
@@ -416,6 +493,9 @@ var PRIMARY_METADATA = {
416
493
  detail: "GLM-4.7 \u2014 200K \u4E0A\u4E0B\u6587\uFF0C\u5DE5\u5177\u8C03\u7528\uFF083-tier pricing\uFF09",
417
494
  imageInput: false,
418
495
  toolCalling: true,
496
+ // Thinking switch (GLM-4.7 forces thinking when enabled per the
497
+ // official ChatThinking doc; no reasoning_effort — 4.7 < 5.2).
498
+ thinkingSchema: "reasoningEffort",
419
499
  // Pinned the LOWEST tier per bigmodel.cn/pricing 2026-08-18:
420
500
  // [0, 32K) input × [0, 0.2K) output — ¥2 / ¥8 / ¥0.4 cache hit
421
501
  // [0, 32K) input × [0.2K+) output — ¥3 / ¥14 / ¥0.6 cache hit
@@ -433,6 +513,8 @@ var PRIMARY_METADATA = {
433
513
  detail: "GLM-5.1 \u2014 200K \u4E0A\u4E0B\u6587\uFF0C\u6700\u5927\u8F93\u51FA 128K\uFF082-tier pricing\uFF09",
434
514
  imageInput: false,
435
515
  toolCalling: true,
516
+ // Thinking switch (no reasoning_effort — 5.1 < 5.2 threshold).
517
+ thinkingSchema: "reasoningEffort",
436
518
  // Pinned the LOWER tier per bigmodel.cn/pricing 2026-08-18:
437
519
  // [0, 32K) — ¥6 input / ¥24 output / ¥1.3 cache hit
438
520
  // [32K+) — ¥8 input / ¥28 output / ¥2 cache hit
@@ -448,6 +530,8 @@ var PRIMARY_METADATA = {
448
530
  detail: "GLM-5 \u2014 200K \u4E0A\u4E0B\u6587\uFF0CAgentic \u5DE5\u5177\u8C03\u7528\uFF0C\u6700\u5927\u8F93\u51FA 128K\uFF082-tier pricing\uFF09",
449
531
  imageInput: false,
450
532
  toolCalling: true,
533
+ // Thinking switch (no reasoning_effort — 5 < 5.2 threshold).
534
+ thinkingSchema: "reasoningEffort",
451
535
  // Pinned the LOWER tier per bigmodel.cn/pricing 2026-08-18:
452
536
  // [0, 32K) — ¥4 input / ¥18 output / ¥1 cache hit
453
537
  // [32K+) — ¥6 input / ¥22 output / ¥1.5 cache hit
@@ -461,6 +545,9 @@ var PRIMARY_METADATA = {
461
545
  detail: "GLM-5 Turbo \u2014 200K \u4E0A\u4E0B\u6587\uFF0C\u6700\u5927\u8F93\u51FA 128K\uFF082-tier pricing\uFF09",
462
546
  imageInput: false,
463
547
  toolCalling: true,
548
+ // Thinking switch (listed in the official ChatThinking doc's
549
+ // auto-think family; no reasoning_effort — 5-Turbo < 5.2).
550
+ thinkingSchema: "reasoningEffort",
464
551
  // Pinned the LOWER tier per bigmodel.cn/pricing 2026-08-18:
465
552
  // [0, 32K) — ¥5 input / ¥22 output / ¥1.2 cache hit
466
553
  // [32K+) — ¥7 input / ¥26 output / ¥1.8 cache hit
@@ -474,6 +561,8 @@ var PRIMARY_METADATA = {
474
561
  detail: "GLM-4.7 FlashX \u2014 \u5FEB\u901F\u7248",
475
562
  imageInput: false,
476
563
  toolCalling: false,
564
+ // Thinking switch (4.7 family; no reasoning_effort).
565
+ thinkingSchema: "reasoningEffort",
477
566
  // ¥0.5 input / ¥3 output / ¥0.1 cache hit per 1M tokens
478
567
  pricingUSD: { input: 0.07, output: 0.42, cacheRead: 0.014 },
479
568
  pricingCNY: { input: 0.5, output: 3, cacheRead: 0.1 },
@@ -485,6 +574,9 @@ var PRIMARY_METADATA = {
485
574
  detail: "GLM-4.6 \u2014 \u5DE5\u5177\u8C03\u7528",
486
575
  imageInput: false,
487
576
  toolCalling: true,
577
+ // Thinking switch (auto-think family per the official
578
+ // ChatThinking doc; no reasoning_effort — 4.6 < 5.2).
579
+ thinkingSchema: "reasoningEffort",
488
580
  pricingUSD: { input: 0.6, output: 2.2, cacheRead: 0.11 },
489
581
  pricingCNY: { input: 4.3, output: 15.7, cacheRead: 0.79 },
490
582
  priceCategory: "medium",
@@ -506,6 +598,9 @@ var PRIMARY_METADATA = {
506
598
  detail: "GLM-4.5 \u2014 \u5DE5\u5177\u8C03\u7528\uFF08\u88F8\u540D\uFF1BZhipu /v1/models \u66B4\u9732\u7684 legacy alias\uFF09",
507
599
  imageInput: false,
508
600
  toolCalling: true,
601
+ // Thinking switch (4.5 generation is the thinking-param floor
602
+ // per the official ChatThinking doc; no reasoning_effort).
603
+ thinkingSchema: "reasoningEffort",
509
604
  pricingUSD: { input: 0, output: 0, cacheRead: null },
510
605
  pricingCNY: { input: 0, output: 0, cacheRead: null },
511
606
  priceCategory: "low",
@@ -516,6 +611,8 @@ var PRIMARY_METADATA = {
516
611
  detail: "GLM-4.5 Air \u2014 \u5DE5\u5177\u8C03\u7528\uFF083-tier pricing\uFF09",
517
612
  imageInput: false,
518
613
  toolCalling: true,
614
+ // Thinking switch (4.5 family; no reasoning_effort).
615
+ thinkingSchema: "reasoningEffort",
519
616
  // Pinned the LOWEST tier per bigmodel.cn/pricing 2026-08-18:
520
617
  // [0, 32K) × [0, 0.2K) output — ¥0.8 / ¥2 / ¥0.16 cache hit
521
618
  // [0, 32K) × [0.2K+) output — ¥0.8 / ¥6 / ¥0.16 cache hit
@@ -532,6 +629,8 @@ var PRIMARY_METADATA = {
532
629
  detail: "GLM-4.5 AirX \u2014 \u5FEB\u901F\u7248\uFF08\xA510/M \u5355\u6863\uFF09",
533
630
  imageInput: false,
534
631
  toolCalling: false,
632
+ // Thinking switch (4.5 family; no reasoning_effort).
633
+ thinkingSchema: "reasoningEffort",
535
634
  // ¥10 / M tokens (single rate, input == output) per
536
635
  // bigmodel.cn/pricing 2026-08-18 — listed under the "模型推理
537
636
  // → Language Models" sub-tab, NOT the flagship text section.
@@ -580,6 +679,9 @@ var PRIMARY_METADATA = {
580
679
  detail: "GLM-4.5V \u89C6\u89C9\u63A8\u7406\u6A21\u578B \u2014 \u56FE\u50CF/\u89C6\u9891/\u6587\u6863/GUI\uFF082-tier pricing\uFF09",
581
680
  imageInput: true,
582
681
  toolCalling: true,
682
+ // Thinking switch (official ChatThinking doc: GLM-4.5V 为强制
683
+ // 思考 when enabled; no reasoning_effort).
684
+ thinkingSchema: "reasoningEffort",
583
685
  // Pinned the LOWER tier per bigmodel.cn/pricing 2026-08-18:
584
686
  // [0, 32K) — ¥2 input / ¥6 output / ¥0.4 cache hit
585
687
  // [32, 64K) — ¥4 input / ¥12 output / ¥0.8 cache hit
@@ -589,10 +691,47 @@ var PRIMARY_METADATA = {
589
691
  maxInputTokens: 64e3,
590
692
  maxOutputTokens: 8192
591
693
  },
694
+ // GLM-4.6V (2026 H1) — 视觉推理模型 (paid version, 2-tier
695
+ // pricing). Distinct from `glm-4.6v-flash` (免费版, 0/0/0) and
696
+ // `glm-4.6v-flashx` (快速版, ¥0.15/¥1.5/¥0.03). Per
697
+ // bigmodel.cn/pricing 2026-08-18 (the same snapshot the
698
+ // §7 table in `byom-glm-learnings.md` was sourced from, where
699
+ // this row was first documented but never landed in
700
+ // MODEL_METADATA until 2026-08-19):
701
+ // [0, 32K) — ¥1 input / ¥3 output / ¥0.2 cache hit
702
+ // [32, 128K) — ¥2 input / ¥6 output / ¥0.4 cache hit
703
+ // The lower tier is pinned per the project's "multi-tier →
704
+ // lowest tier" convention (most prompts < 32K input × < 0.2K
705
+ // output). 4.6V sits between glm-4.5v (¥2/¥6/¥0.4) and the
706
+ // flashx variant — the 4.6 generation is meaningfully cheaper
707
+ // per the 2026 mid-year price reset.
708
+ "glm-4.6v": {
709
+ detail: "GLM-4.6V \u89C6\u89C9\u63A8\u7406\u6A21\u578B \u2014 \u56FE\u50CF/\u89C6\u9891/\u6587\u6863/GUI\uFF082-tier pricing\uFF09",
710
+ imageInput: true,
711
+ toolCalling: true,
712
+ // Thinking switch (same auto-think family as glm-4.5v;
713
+ // 4.6 < 5.2 threshold, so no reasoning_effort).
714
+ thinkingSchema: "reasoningEffort",
715
+ // Pinned the LOWER tier [0, 32K) per bigmodel.cn/pricing
716
+ // 2026-08-18. USD mirrors the CNY/7 ratio with 2-decimal
717
+ // rounding (matches glm-4.5v's USD rounding style).
718
+ pricingUSD: { input: 0.14, output: 0.42, cacheRead: 0.028 },
719
+ pricingCNY: { input: 1, output: 3, cacheRead: 0.2 },
720
+ // Tier boundary is 128K (vs glm-4.5v's 64K), so a
721
+ // `medium` tier tag is still appropriate — the 4.6V is
722
+ // cheaper than glm-4.5v but not a "low" tier like the
723
+ // 0.5/3/0.1 flashx family.
724
+ priceCategory: "medium",
725
+ maxInputTokens: 128e3,
726
+ maxOutputTokens: 8192
727
+ },
592
728
  "glm-5v-turbo": {
593
729
  detail: "GLM-5V Turbo \u2014 \u591A\u6A21\u6001 Coding \u6A21\u578B\uFF082-tier pricing\uFF09",
594
730
  imageInput: true,
595
731
  toolCalling: true,
732
+ // Thinking switch (listed in the official ChatThinking doc's
733
+ // auto-think family; no reasoning_effort).
734
+ thinkingSchema: "reasoningEffort",
596
735
  // Pinned the LOWER tier per bigmodel.cn/pricing 2026-08-18:
597
736
  // [0, 32K) — ¥5 input / ¥22 output / ¥1.2 cache hit
598
737
  // [32K+) — ¥7 input / ¥26 output / ¥1.8 cache hit
@@ -771,6 +910,20 @@ var NAMESPACE_ALIASES = {
771
910
  // from the curated detail / pricing / capability columns.
772
911
  "glm-4-flashx-250414": "glm-4-flashx"
773
912
  };
913
+ var NAMESPACE_ALIAS_FAMILY = {
914
+ // SiliconFlow
915
+ "deepseek-ai/DeepSeek-V4-Pro": "SiliconFlow (aggregator)",
916
+ "deepseek-ai/DeepSeek-V4-Flash": "SiliconFlow (aggregator)",
917
+ "zai-org/GLM-5.2": "SiliconFlow (aggregator)",
918
+ "Qwen/Qwen3.6-35B-A3B": "SiliconFlow (aggregator)",
919
+ "moonshotai/Kimi-K2.7-Code": "SiliconFlow (aggregator)",
920
+ // Novita
921
+ "deepseek/deepseek-v4-pro": "Novita (aggregator)",
922
+ "deepseek/deepseek-v4-flash": "Novita (aggregator)",
923
+ "zai/glm-5.2": "Novita (aggregator)",
924
+ "zai/glm-5.1": "Novita (aggregator)",
925
+ "moonshotai/kimi-k3": "Novita (aggregator)"
926
+ };
774
927
  var MODEL_METADATA = (() => {
775
928
  const merged = {
776
929
  ...PRIMARY_METADATA
@@ -789,7 +942,7 @@ function lookupModelMetadata(modelId) {
789
942
  function currencyForBaseUrl(baseUrl) {
790
943
  try {
791
944
  const hostname = new URL(baseUrl).hostname.toLowerCase();
792
- 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
945
+ 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
793
946
  // (`docs/references/GLM-for-copilot-main/src/endpoint.ts:4`)
794
947
  // this was retired to `bigmodel.cn` but is still
795
948
  // resolvable for accounts that haven't migrated — we
@@ -819,13 +972,14 @@ function currencyForBaseUrl(baseUrl) {
819
972
  }
820
973
 
821
974
  // src/ai/providers.presets.ts
822
- function buildPresetModel(id, displayName) {
975
+ function buildPresetModel(id, displayName, baseUrl) {
823
976
  const meta = MODEL_METADATA[id];
824
977
  if (!meta) {
825
978
  throw new Error(
826
979
  `buildPresetModel: no curated MODEL_METADATA entry for '${id}' \u2014 add one before referencing it from BUILTIN_PROVIDER_PRESETS.`
827
980
  );
828
981
  }
982
+ const currency = baseUrl ? currencyForBaseUrl(baseUrl) : "USD";
829
983
  return {
830
984
  id,
831
985
  displayName,
@@ -836,11 +990,95 @@ function buildPresetModel(id, displayName) {
836
990
  supportsImageToText: meta.imageInput,
837
991
  supportsToolCalling: meta.toolCalling
838
992
  },
839
- pricing: meta.pricingUSD,
993
+ pricing: meta[`pricing${currency}`],
840
994
  priceCategory: meta.priceCategory,
841
995
  thinkingSchema: meta.thinkingSchema ?? "none"
842
996
  };
843
997
  }
998
+ function unionProviderModelWithPreset(fetched, baseUrl) {
999
+ const meta = MODEL_METADATA[fetched.id];
1000
+ if (!meta) {
1001
+ return fetched;
1002
+ }
1003
+ const currency = baseUrl ? currencyForBaseUrl(baseUrl) : "USD";
1004
+ const presetDisplayName = getPresetModelDisplayName(fetched.id);
1005
+ const displayName = typeof fetched.displayName === "string" && fetched.displayName.length > 0 ? fetched.displayName : presetDisplayName;
1006
+ return {
1007
+ // Spread fetched first so `id` wins, then overlay the
1008
+ // curated fields. (Curated fields ALWAYS win over fetched
1009
+ // per the precedence above — that's why they're explicit,
1010
+ // not relying on spread order.)
1011
+ ...fetched,
1012
+ displayName,
1013
+ detail: meta.detail,
1014
+ capabilities: {
1015
+ supportsImageToText: meta.imageInput,
1016
+ supportsToolCalling: meta.toolCalling
1017
+ },
1018
+ pricing: meta[`pricing${currency}`],
1019
+ priceCategory: meta.priceCategory,
1020
+ // thinkingSchema: prefer preset (curated), fall back to
1021
+ // fetched (in case the API publishes a schema the
1022
+ // preset doesn't know about), then "none" to match
1023
+ // `buildPresetModel`'s explicit-none convention so the
1024
+ // picker renders identically for preset vs fetched rows.
1025
+ thinkingSchema: meta.thinkingSchema ?? fetched.thinkingSchema ?? "none",
1026
+ // Token caps: preset is curated; if the preset doesn't
1027
+ // publish a cap, keep whatever fetched supplied (the
1028
+ // user may have entered it by hand earlier).
1029
+ maxInputTokens: meta.maxInputTokens ?? fetched.maxInputTokens,
1030
+ maxOutputTokens: meta.maxOutputTokens ?? fetched.maxOutputTokens
1031
+ };
1032
+ }
1033
+ var PRESET_MODEL_FAMILIES = [
1034
+ "GLM",
1035
+ "DeepSeek",
1036
+ "Kimi",
1037
+ "StepFun",
1038
+ "MiniMax",
1039
+ "Agnes",
1040
+ "Qwen",
1041
+ "SiliconFlow (aggregator)",
1042
+ "Novita (aggregator)",
1043
+ "OpenRouter (aggregator)"
1044
+ ];
1045
+ function vendorFamilyForId(id) {
1046
+ const aliasFamily = NAMESPACE_ALIAS_FAMILY[id];
1047
+ if (aliasFamily) return aliasFamily;
1048
+ if (id.startsWith("glm-")) return "GLM";
1049
+ if (id.startsWith("deepseek-")) return "DeepSeek";
1050
+ if (id.startsWith("kimi-")) return "Kimi";
1051
+ if (id.startsWith("step-")) return "StepFun";
1052
+ if (id.startsWith("MiniMax-")) return "MiniMax";
1053
+ if (id.startsWith("agnes-")) return "Agnes";
1054
+ if (id.startsWith("Qwen")) return "Qwen";
1055
+ if (id.startsWith("openrouter/")) return "OpenRouter (aggregator)";
1056
+ return "Other";
1057
+ }
1058
+ var LISTABLE_PRESET_MODELS = (() => {
1059
+ const aggregatorAliasKeys = new Set(Object.keys(NAMESPACE_ALIAS_FAMILY));
1060
+ const allIds = Object.keys(MODEL_METADATA).filter((id) => {
1061
+ if (NAMESPACE_ALIASES[id] === void 0) return true;
1062
+ return aggregatorAliasKeys.has(id);
1063
+ }).sort();
1064
+ return allIds.map((id) => ({
1065
+ id,
1066
+ displayName: id,
1067
+ vendorFamily: vendorFamilyForId(id)
1068
+ }));
1069
+ })();
1070
+ function listPresetModelGroups() {
1071
+ const byFamily = /* @__PURE__ */ new Map();
1072
+ for (const entry of LISTABLE_PRESET_MODELS) {
1073
+ const bucket = byFamily.get(entry.vendorFamily) ?? [];
1074
+ bucket.push(entry);
1075
+ byFamily.set(entry.vendorFamily, bucket);
1076
+ }
1077
+ return PRESET_MODEL_FAMILIES.filter((f) => byFamily.has(f)).map((family) => ({
1078
+ family,
1079
+ entries: byFamily.get(family) ?? []
1080
+ }));
1081
+ }
844
1082
  var BUILTIN_PROVIDER_PRESETS = {
845
1083
  minimax: {
846
1084
  displayName: "MiniMax",
@@ -866,14 +1104,18 @@ var BUILTIN_PROVIDER_PRESETS = {
866
1104
  // (otherwise the user's added model never shows up in the
867
1105
  // Copilot Chat picker).
868
1106
  models: [
869
- buildPresetModel("MiniMax-M3", "MiniMax-M3"),
870
- buildPresetModel("MiniMax-M2.7", "MiniMax-M2.7"),
871
- buildPresetModel("MiniMax-M2.7-highspeed", "MiniMax-M2.7-highspeed"),
1107
+ buildPresetModel("MiniMax-M3", "MiniMax-M3", "https://api.minimaxi.com/anthropic"),
1108
+ buildPresetModel("MiniMax-M2.7", "MiniMax-M2.7", "https://api.minimaxi.com/anthropic"),
1109
+ buildPresetModel(
1110
+ "MiniMax-M2.7-highspeed",
1111
+ "MiniMax-M2.7-highspeed",
1112
+ "https://api.minimaxi.com/anthropic"
1113
+ ),
872
1114
  // M2.5 (2026-02-13, 80.2% SWE-Bench Verified) — the
873
1115
  // predecessor of M2.7. Still in the catalog and often
874
1116
  // available on MiniMax's promotional $0.30/$1.20 rate, so
875
1117
  // keep it as a preset for users on the M2.5 plan tier.
876
- buildPresetModel("MiniMax-M2.5", "MiniMax-M2.5")
1118
+ buildPresetModel("MiniMax-M2.5", "MiniMax-M2.5", "https://api.minimaxi.com/anthropic")
877
1119
  ]
878
1120
  },
879
1121
  deepseek: {
@@ -895,8 +1137,8 @@ var BUILTIN_PROVIDER_PRESETS = {
895
1137
  // the recommended default — users still on V3 can override
896
1138
  // these defaults in the ProvidersTab form.
897
1139
  models: [
898
- buildPresetModel("deepseek-v4-flash", "DeepSeek V4 Flash"),
899
- buildPresetModel("deepseek-v4-pro", "DeepSeek V4 Pro")
1140
+ buildPresetModel("deepseek-v4-flash", "DeepSeek V4 Flash", "https://api.deepseek.com/v1"),
1141
+ buildPresetModel("deepseek-v4-pro", "DeepSeek V4 Pro", "https://api.deepseek.com/v1")
900
1142
  ]
901
1143
  },
902
1144
  agnes: {
@@ -904,19 +1146,34 @@ var BUILTIN_PROVIDER_PRESETS = {
904
1146
  // Sapiens AI's Agnes — OpenAI-compatible endpoint per
905
1147
  // https://wiki.agnes-ai.com (`POST /v1/chat/completions`).
906
1148
  baseUrl: "https://apihub.agnes-ai.com/v1",
1149
+ // Order mirrors the vendor docs index (wiki.agnes-ai.com,
1150
+ // fetched 2026-08-19): paid reasoning models first — the
1151
+ // commercial stable `agnes-2.5-pro` leads, then the
1152
+ // benchmark-listed alpha — followed by the flash tier
1153
+ // newest-first.
907
1154
  models: [
908
- buildPresetModel("agnes-2.5-pro-alpha", "Agnes 2.5 Pro Alpha"),
909
- buildPresetModel("agnes-2.0-flash", "Agnes 2.0 Flash")
1155
+ buildPresetModel("agnes-2.5-pro", "Agnes 2.5 Pro", "https://apihub.agnes-ai.com/v1"),
1156
+ buildPresetModel(
1157
+ "agnes-2.5-pro-alpha",
1158
+ "Agnes 2.5 Pro Alpha",
1159
+ "https://apihub.agnes-ai.com/v1"
1160
+ ),
1161
+ buildPresetModel("agnes-2.5-flash", "Agnes 2.5 Flash", "https://apihub.agnes-ai.com/v1"),
1162
+ buildPresetModel("agnes-2.0-flash", "Agnes 2.0 Flash", "https://apihub.agnes-ai.com/v1")
910
1163
  ]
911
1164
  },
912
1165
  kimi: {
913
1166
  displayName: "Kimi",
914
1167
  baseUrl: "https://api.moonshot.cn/v1",
915
1168
  models: [
916
- buildPresetModel("kimi-k3", "Kimi K3"),
917
- buildPresetModel("kimi-k2.7-code", "Kimi K2.7 Code"),
918
- buildPresetModel("kimi-k2.7-code-highspeed", "Kimi K2.7 Code HighSpeed"),
919
- buildPresetModel("kimi-k2.6", "Kimi K2.6")
1169
+ buildPresetModel("kimi-k3", "Kimi K3", "https://api.moonshot.cn/v1"),
1170
+ buildPresetModel("kimi-k2.7-code", "Kimi K2.7 Code", "https://api.moonshot.cn/v1"),
1171
+ buildPresetModel(
1172
+ "kimi-k2.7-code-highspeed",
1173
+ "Kimi K2.7 Code HighSpeed",
1174
+ "https://api.moonshot.cn/v1"
1175
+ ),
1176
+ buildPresetModel("kimi-k2.6", "Kimi K2.6", "https://api.moonshot.cn/v1")
920
1177
  ]
921
1178
  },
922
1179
  zhipu: {
@@ -988,24 +1245,28 @@ var BUILTIN_PROVIDER_PRESETS = {
988
1245
  // `MODEL_METADATA` entries are kept so the id is still
989
1246
  // resolvable for the curated detail / pricing columns.
990
1247
  models: [
991
- buildPresetModel("glm-5.3", "GLM-5.3"),
992
- buildPresetModel("glm-5.2", "GLM-5.2"),
993
- buildPresetModel("glm-5.1", "GLM-5.1"),
994
- buildPresetModel("glm-5", "GLM-5"),
995
- buildPresetModel("glm-5-turbo", "GLM-5 Turbo"),
996
- buildPresetModel("glm-4.7", "GLM-4.7"),
997
- buildPresetModel("glm-4.6", "GLM-4.6"),
998
- buildPresetModel("glm-4.5-air", "GLM-4.5 Air"),
999
- buildPresetModel("glm-4.5", "GLM-4.5")
1248
+ buildPresetModel("glm-5.3", "GLM-5.3", "https://open.bigmodel.cn/api/paas/v4"),
1249
+ buildPresetModel("glm-5.2", "GLM-5.2", "https://open.bigmodel.cn/api/paas/v4"),
1250
+ buildPresetModel("glm-5.1", "GLM-5.1", "https://open.bigmodel.cn/api/paas/v4"),
1251
+ buildPresetModel("glm-5", "GLM-5", "https://open.bigmodel.cn/api/paas/v4"),
1252
+ buildPresetModel("glm-5-turbo", "GLM-5 Turbo", "https://open.bigmodel.cn/api/paas/v4"),
1253
+ buildPresetModel("glm-4.7", "GLM-4.7", "https://open.bigmodel.cn/api/paas/v4"),
1254
+ buildPresetModel("glm-4.6", "GLM-4.6", "https://open.bigmodel.cn/api/paas/v4"),
1255
+ buildPresetModel("glm-4.5-air", "GLM-4.5 Air", "https://open.bigmodel.cn/api/paas/v4"),
1256
+ buildPresetModel("glm-4.5", "GLM-4.5", "https://open.bigmodel.cn/api/paas/v4")
1000
1257
  ]
1001
1258
  },
1002
1259
  stepfun: {
1003
1260
  displayName: "StepFun",
1004
1261
  baseUrl: "https://api.stepfun.com/v1",
1005
1262
  models: [
1006
- buildPresetModel("step-3.7-flash", "Step 3.7 Flash"),
1007
- buildPresetModel("step-3.5-flash", "Step 3.5 Flash"),
1008
- buildPresetModel("step-1o-turbo-vision", "Step 1o Turbo Vision")
1263
+ buildPresetModel("step-3.7-flash", "Step 3.7 Flash", "https://api.stepfun.com/v1"),
1264
+ buildPresetModel("step-3.5-flash", "Step 3.5 Flash", "https://api.stepfun.com/v1"),
1265
+ buildPresetModel(
1266
+ "step-1o-turbo-vision",
1267
+ "Step 1o Turbo Vision",
1268
+ "https://api.stepfun.com/v1"
1269
+ )
1009
1270
  ]
1010
1271
  },
1011
1272
  siliconflow: {
@@ -1019,20 +1280,42 @@ var BUILTIN_PROVIDER_PRESETS = {
1019
1280
  // 与 MODEL_METADATA 的 alias 严格一致。
1020
1281
  models: [
1021
1282
  // DeepSeek V4 系列 (2026-04)
1022
- buildPresetModel("deepseek-ai/DeepSeek-V4-Pro", "DeepSeek V4 Pro (via SiliconFlow)"),
1023
- buildPresetModel("deepseek-ai/DeepSeek-V4-Flash", "DeepSeek V4 Flash (via SiliconFlow)"),
1283
+ buildPresetModel(
1284
+ "deepseek-ai/DeepSeek-V4-Pro",
1285
+ "DeepSeek V4 Pro (via SiliconFlow)",
1286
+ "https://api.siliconflow.cn/v1"
1287
+ ),
1288
+ buildPresetModel(
1289
+ "deepseek-ai/DeepSeek-V4-Flash",
1290
+ "DeepSeek V4 Flash (via SiliconFlow)",
1291
+ "https://api.siliconflow.cn/v1"
1292
+ ),
1024
1293
  // GLM-5.2 (2026-06-17) — open-weight 编程旗舰,1M context
1025
- buildPresetModel("zai-org/GLM-5.2", "GLM-5.2 (via SiliconFlow)"),
1294
+ buildPresetModel(
1295
+ "zai-org/GLM-5.2",
1296
+ "GLM-5.2 (via SiliconFlow)",
1297
+ "https://api.siliconflow.cn/v1"
1298
+ ),
1026
1299
  // Qwen3.6-35B-A3B (2026-04) — 35B MoE, 3B 激活,"小而强"
1027
- buildPresetModel("Qwen/Qwen3.6-35B-A3B", "Qwen3.6-35B-A3B (via SiliconFlow)"),
1300
+ buildPresetModel(
1301
+ "Qwen/Qwen3.6-35B-A3B",
1302
+ "Qwen3.6-35B-A3B (via SiliconFlow)",
1303
+ "https://api.siliconflow.cn/v1"
1304
+ ),
1028
1305
  // Kimi K2.7-Code (2026-06-12) — Moonshot coding 旗舰
1029
- buildPresetModel("moonshotai/Kimi-K2.7-Code", "Kimi K2.7 Code (via SiliconFlow)")
1306
+ buildPresetModel(
1307
+ "moonshotai/Kimi-K2.7-Code",
1308
+ "Kimi K2.7 Code (via SiliconFlow)",
1309
+ "https://api.siliconflow.cn/v1"
1310
+ )
1030
1311
  ]
1031
1312
  },
1032
1313
  openrouter: {
1033
1314
  displayName: "OpenRouter",
1034
1315
  baseUrl: "https://openrouter.ai/api/v1",
1035
- models: [buildPresetModel("openrouter/auto", "OpenRouter Auto")]
1316
+ models: [
1317
+ buildPresetModel("openrouter/auto", "OpenRouter Auto", "https://openrouter.ai/api/v1")
1318
+ ]
1036
1319
  },
1037
1320
  novita: {
1038
1321
  displayName: "Novita",
@@ -1044,16 +1327,76 @@ var BUILTIN_PROVIDER_PRESETS = {
1044
1327
  // 完整列表。id 严格匹配 Novita API 的 namespaced 字符串。
1045
1328
  models: [
1046
1329
  // DeepSeek V4 系列 (2026-04)
1047
- buildPresetModel("deepseek/deepseek-v4-pro", "DeepSeek V4 Pro (via Novita)"),
1048
- buildPresetModel("deepseek/deepseek-v4-flash", "DeepSeek V4 Flash (via Novita)"),
1330
+ buildPresetModel(
1331
+ "deepseek/deepseek-v4-pro",
1332
+ "DeepSeek V4 Pro (via Novita)",
1333
+ "https://api.novita.ai/openai/v1"
1334
+ ),
1335
+ buildPresetModel(
1336
+ "deepseek/deepseek-v4-flash",
1337
+ "DeepSeek V4 Flash (via Novita)",
1338
+ "https://api.novita.ai/openai/v1"
1339
+ ),
1049
1340
  // GLM-5 系列 (2026-04/06)
1050
- buildPresetModel("zai/glm-5.2", "GLM-5.2 (via Novita)"),
1051
- buildPresetModel("zai/glm-5.1", "GLM-5.1 (via Novita)"),
1341
+ buildPresetModel("zai/glm-5.2", "GLM-5.2 (via Novita)", "https://api.novita.ai/openai/v1"),
1342
+ buildPresetModel("zai/glm-5.1", "GLM-5.1 (via Novita)", "https://api.novita.ai/openai/v1"),
1052
1343
  // Kimi K3 (2026-07-16 API, 2026-07-27 开源) — 1M context, 2.8T MoE
1053
- buildPresetModel("moonshotai/kimi-k3", "Kimi K3 (via Novita)")
1344
+ buildPresetModel(
1345
+ "moonshotai/kimi-k3",
1346
+ "Kimi K3 (via Novita)",
1347
+ "https://api.novita.ai/openai/v1"
1348
+ )
1054
1349
  ]
1350
+ },
1351
+ medalsoft: {
1352
+ displayName: "Medalsoft",
1353
+ // Medalsoft internal LLM gateway (公司内部代理) — OpenAI-compatible
1354
+ // `/v1/chat/completions`. The gateway forwards to upstream vendors
1355
+ // (GLM / DeepSeek / Kimi / ...), so the model catalogue is dynamic
1356
+ // and NOT curated here: the preset ships an EMPTY starter list and
1357
+ // the user populates it via "Fetch from API" (`GET /v1/models`) in
1358
+ // the ProvidersTab. `buildPresetModel`'s fail-loudly contract is
1359
+ // why we don't guess ids — a curated `MODEL_METADATA` entry only
1360
+ // exists for vendor-native ids, not the gateway's routing table.
1361
+ //
1362
+ // NOTE: models fetched from the gateway carry the upstream model
1363
+ // ids, so the curated metadata (pricing / thinking dropdown /
1364
+ // token caps) still resolves via `MODEL_METADATA` after the fetch.
1365
+ baseUrl: "https://llm.proxy.alio.wang/v1",
1366
+ models: []
1055
1367
  }
1056
1368
  };
1369
+ var PRESET_MODEL_DISPLAY_NAMES = (() => {
1370
+ const map = {};
1371
+ for (const preset of Object.values(BUILTIN_PROVIDER_PRESETS)) {
1372
+ for (const model of preset.models) {
1373
+ if (model.displayName !== void 0) {
1374
+ map[model.id] = model.displayName;
1375
+ }
1376
+ }
1377
+ }
1378
+ return Object.freeze(map);
1379
+ })();
1380
+ function getPresetModelDisplayName(id) {
1381
+ const explicit = PRESET_MODEL_DISPLAY_NAMES[id];
1382
+ if (explicit !== void 0) {
1383
+ return explicit;
1384
+ }
1385
+ const meta = MODEL_METADATA[id];
1386
+ if (meta === void 0) {
1387
+ return void 0;
1388
+ }
1389
+ const detail = meta.detail;
1390
+ if (typeof detail !== "string" || detail.trim() === "") {
1391
+ return void 0;
1392
+ }
1393
+ const dashIndex = detail.indexOf(" \u2014 ");
1394
+ if (dashIndex === -1) {
1395
+ return detail;
1396
+ }
1397
+ const head = detail.slice(0, dashIndex).trim();
1398
+ return head === "" ? void 0 : head;
1399
+ }
1057
1400
  function getBuiltinProviderPreset(type) {
1058
1401
  switch (type) {
1059
1402
  case "minimax":
@@ -1065,6 +1408,7 @@ function getBuiltinProviderPreset(type) {
1065
1408
  case "siliconflow":
1066
1409
  case "openrouter":
1067
1410
  case "novita":
1411
+ case "medalsoft":
1068
1412
  return BUILTIN_PROVIDER_PRESETS[type];
1069
1413
  default:
1070
1414
  return null;
@@ -1488,6 +1832,8 @@ var WebviewMessageType = /* @__PURE__ */ ((WebviewMessageType2) => {
1488
1832
  WebviewMessageType2["SetProviderOrder"] = "setProviderOrder";
1489
1833
  WebviewMessageType2["TestProvider"] = "testProvider";
1490
1834
  WebviewMessageType2["ProviderTestResultMessage"] = "providerTestResult";
1835
+ WebviewMessageType2["TestProviderModel"] = "testProviderModel";
1836
+ WebviewMessageType2["ProviderTestModelResultMessage"] = "providerTestModelResult";
1491
1837
  WebviewMessageType2["DefaultProviderChanged"] = "defaultProviderChanged";
1492
1838
  WebviewMessageType2["FetchProviderModels"] = "fetchProviderModels";
1493
1839
  WebviewMessageType2["FetchProviderModelsResult"] = "fetchProviderModelsResult";
@@ -1578,8 +1924,12 @@ export {
1578
1924
  GetCachedServerUrl,
1579
1925
  GetServerProxyState,
1580
1926
  GetUtilityModels,
1927
+ LISTABLE_PRESET_MODELS,
1581
1928
  LogLevel,
1582
1929
  MODEL_METADATA,
1930
+ NAMESPACE_ALIASES,
1931
+ NAMESPACE_ALIAS_FAMILY,
1932
+ PRESET_MODEL_FAMILIES,
1583
1933
  PROVIDER_BASE_URL_PRESETS,
1584
1934
  PROVIDER_CACHE_CONTROL_METADATA,
1585
1935
  ServerProxyStateResponse,
@@ -1592,6 +1942,7 @@ export {
1592
1942
  __internal,
1593
1943
  asAbortSignal,
1594
1944
  buildGitHubLocalEmail,
1945
+ buildPresetModel,
1595
1946
  checkGitHubOrgMembership,
1596
1947
  createConsoleLogger,
1597
1948
  currencyForBaseUrl,
@@ -1599,10 +1950,12 @@ export {
1599
1950
  fetchGitHubUser,
1600
1951
  getBuiltinProviderPreset,
1601
1952
  getGitHubOrgMembership,
1953
+ getPresetModelDisplayName,
1602
1954
  getProviderBaseUrlPresets,
1603
1955
  isGitHubLocalEmail,
1604
1956
  isProviderCacheControlAware,
1605
1957
  isValidCanonicalSlug,
1958
+ listPresetModelGroups,
1606
1959
  lookupModelMetadata,
1607
1960
  normalizeCanonicalSlug,
1608
1961
  normalizeErrorForLog,
@@ -1610,5 +1963,6 @@ export {
1610
1963
  parsePayload,
1611
1964
  protocolForBaseUrl,
1612
1965
  resolvePrimaryEmail,
1613
- safeJson
1966
+ safeJson,
1967
+ unionProviderModelWithPreset
1614
1968
  };