pi-tsgw 0.0.12 → 0.0.13

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/README.md CHANGED
@@ -40,7 +40,7 @@ Example:
40
40
  "tsSearch": "live",
41
41
  "traceHeaders": false,
42
42
  "excludeModels": ["gpt-*", "claude-*"],
43
- "includeModels": ["gpt-5.6-*"]
43
+ "includeModels": ["gpt-6-*"]
44
44
  }
45
45
  }
46
46
  ```
@@ -79,11 +79,41 @@ catalog may fall back to static models until Pi refreshes it.
79
79
  The catalog is assembled from per-vendor slices (`extensions/models/vendors/`),
80
80
  covering 11 vendor families: DeepSeek, GLM (Zhipu), MiMo (Xiaomi), MiniMax,
81
81
  Kimi (Moonshot), Qwen (Alibaba), GPT (OpenAI), Gemini (Google), Claude
82
- (Anthropic), LongCat, and Grok (xAI). The current static catalog contains 54 chat
82
+ (Anthropic), LongCat, and Grok (xAI). The current static catalog contains 36 chat
83
83
  model IDs, including retained aliases; this is not a live availability count.
84
84
  Vendor files carry documentation links and metadata caveats. Alias mappings,
85
85
  output limits, and shared thinking policies are not all individually verified
86
86
  against gateway endpoints; public-price estimates do not guarantee billing.
87
+ MiMo uses `mimo-v2.6-pro` and `mimo-v2.6-flash`; the former V2.5 IDs are not
88
+ registered. Update any explicit model selections or filter rules to the new IDs.
89
+
90
+ The curated catalog keeps DeepSeek `deepseek-flash` and V4 Pro; GLM 5.2+,
91
+ plus the explicit `glm-4.5-air` exception; MiniMax M3+; Kimi K3; GPT 6+;
92
+ and Gemini 3.5+ plus the unversioned `gemini-flash` / `gemini-pro` aliases.
93
+ Qwen, MiMo, LongCat, Claude, and Grok retain their existing registrations.
94
+ Removed IDs and their dedicated request policies are no longer registered;
95
+ include rules cannot restore them, even if a gateway still lists them. Existing
96
+ explicit model selections referencing removed IDs need to be updated.
97
+
98
+ Kimi offers `kimi-k3` and the gateway variant `kimi-k3-256k`, displayed as
99
+ **Kimi K3 (256K)** with a 262,144-token context window. Its other metadata,
100
+ price estimates, and thinking policy are inherited from K3; the 131,072-token
101
+ output setting is separate from context size. These inherited values are not
102
+ individual endpoint verification or a guarantee of the variant's billing rates.
103
+
104
+ The catalog also includes `MiniMax-M3.1-Flash-Preview`, `glm-5.3`,
105
+ `glm-5.3-flash`, and `glm-5.3-flashx`. All four require thinking: MiniMax
106
+ uses low/medium/high/xhigh/max; GLM uses low/high/max. Unsupported `off` is
107
+ disabled in model metadata, and stale off/minimal requests map to low rather
108
+ than silently selecting the default max. MiniMax and GLM Flash/FlashX support
109
+ image input; GLM 5.3 is text-only. Registration does not prove gateway
110
+ inference or tool-call support.
111
+
112
+ As checked on 2026-10-16, MiniMax publishes subscription access but no per-token
113
+ price for M3.1 Flash Preview. Its zero cost fields mean **unknown**, not free,
114
+ and usage cost totals therefore omit its actual charges. GLM 5.3 price estimates
115
+ use domestic public rates and the existing fixed USD/CNY conversion; temporary
116
+ free cache storage is recorded as zero, not a permanent billing guarantee.
87
117
 
88
118
  Use broad `excludeModels` rules to drop model families and precise
89
119
  `includeModels` rules to pull selected models back. `includeModels` is not a
@@ -47,7 +47,7 @@ export interface ModelFilter {
47
47
  exclude?: readonly string[];
48
48
  }
49
49
 
50
- /** 前缀通配匹配:`gpt-5.6-*` 命中该系列全部;不带 `*` 时精确匹配。 */
50
+ /** 前缀通配匹配:`gpt-6-*` 命中该系列全部;不带 `*` 时精确匹配。 */
51
51
  function matches(pattern: string, id: string): boolean {
52
52
  if (pattern.endsWith("*")) return id.startsWith(pattern.slice(0, -1));
53
53
  return pattern === id;
@@ -8,7 +8,7 @@ const DEEPSEEK_RESPONSES_COMPAT = {
8
8
  };
9
9
 
10
10
  /**
11
- * DeepSeek(深度求索)V4 系列。
11
+ * DeepSeek(深度求索)系列:V4.1 Flash 与 V4 Pro。
12
12
  * 官方文档:https://api-docs.deepseek.com/guides/responses_api
13
13
  */
14
14
  export function deepseekModels(root: string): ProviderModelConfig[] {
@@ -35,27 +35,6 @@ export function deepseekModels(root: string): ProviderModelConfig[] {
35
35
  max: "max",
36
36
  },
37
37
  },
38
- {
39
- id: "deepseek-v4-flash",
40
- name: "DeepSeek V4 Flash (Legacy Alias)",
41
- api: "openai-responses",
42
- baseUrl: v1,
43
- reasoning: true,
44
- input: ["text", "image"],
45
- cost: { input: 0.1475, output: 0.295, cacheRead: 0.00295, cacheWrite: 0 },
46
- contextWindow: 1000000,
47
- maxTokens: 384000,
48
- compat: DEEPSEEK_RESPONSES_COMPAT,
49
- thinkingLevelMap: {
50
- off: "none",
51
- minimal: "low",
52
- low: "low",
53
- medium: "high",
54
- high: "high",
55
- xhigh: "high",
56
- max: "max",
57
- },
58
- },
59
38
  {
60
39
  id: "deepseek-v4-pro",
61
40
  name: "DeepSeek V4 Pro",
@@ -5,7 +5,7 @@ import { type PayloadWriter, type ThinkingApplier, type ThinkingLevel } from "..
5
5
  * Google Gemini 系列(google-generative-ai 协议)。
6
6
  * 官方文档:https://ai.google.dev/gemini-api/docs
7
7
  * GenerateContent 档位/预算:https://docs.cloud.google.com/vertex-ai/generative-ai/docs/thinking
8
- * 2.5 使用 budget;3.x 使用 level。网关别名的路由仍需网关侧验证。
8
+ * gemini-flash 别名保留 budget 策略,其他保留型号使用 level。网关别名的路由仍需网关侧验证。
9
9
  */
10
10
  export function geminiModels(root: string): ProviderModelConfig[] {
11
11
  const gemini = `${root}/gemini`;
@@ -68,51 +68,6 @@ export function geminiModels(root: string): ProviderModelConfig[] {
68
68
  contextWindow: 1048576,
69
69
  maxTokens: 65536,
70
70
  },
71
- {
72
- id: "gemini-3.1-pro-low",
73
- name: "Gemini 3.1 Pro Preview",
74
- api: "google-generative-ai",
75
- baseUrl: gemini,
76
- reasoning: true,
77
- input: ["text", "image"],
78
- // 网关思考档位别名(low),规格继承 gemini-3.1-pro-preview。
79
- cost: { input: 2, output: 12, cacheRead: 0.2, cacheWrite: 0 },
80
- contextWindow: 1048576,
81
- maxTokens: 65536,
82
- },
83
- {
84
- id: "gemini-2.5-pro",
85
- name: "Gemini 2.5 Pro",
86
- api: "google-generative-ai",
87
- baseUrl: gemini,
88
- reasoning: true,
89
- input: ["text", "image"],
90
- cost: { input: 1.25, output: 10, cacheRead: 0.125, cacheWrite: 0 },
91
- contextWindow: 1048576,
92
- maxTokens: 65536,
93
- },
94
- {
95
- id: "gemini-2.5-flash",
96
- name: "Gemini 2.5 Flash",
97
- api: "google-generative-ai",
98
- baseUrl: gemini,
99
- reasoning: true,
100
- input: ["text", "image"],
101
- cost: { input: 0.3, output: 2.5, cacheRead: 0.03, cacheWrite: 0 },
102
- contextWindow: 1048576,
103
- maxTokens: 65536,
104
- },
105
- {
106
- id: "gemini-2.5-flash-lite",
107
- name: "Gemini 2.5 Flash-Lite",
108
- api: "google-generative-ai",
109
- baseUrl: gemini,
110
- reasoning: true,
111
- input: ["text", "image"],
112
- cost: { input: 0.1, output: 0.4, cacheRead: 0.01, cacheWrite: 0 },
113
- contextWindow: 1048576,
114
- maxTokens: 65536,
115
- },
116
71
  ];
117
72
  }
118
73
 
@@ -137,16 +92,7 @@ function applyGeminiPro(writer: PayloadWriter, level: ThinkingLevel): void {
137
92
  writer.setGoogleThinking({ includeThoughts: level !== "off", thinkingLevel }, ["thinkingBudget"]);
138
93
  }
139
94
 
140
- // 2.5 Pro 不可关闭思考,官方 budget 范围 128..32768。
141
- // 128/16000/32768 是项目档位映射选择,并非官方档位表;off 仅隐藏摘要并取最小预算。
142
- function applyGemini25Pro(writer: PayloadWriter, level: ThinkingLevel): void {
143
- writer.remove("reasoning_effort");
144
- const thinkingBudget = level === "off" || level === "minimal" || level === "low"
145
- ? 128 : level === "max" ? 32768 : 16000;
146
- writer.setGoogleThinking({ includeThoughts: level !== "off", thinkingBudget }, ["thinkingLevel"]);
147
- }
148
-
149
- // 3.5 Flash 支持 MINIMAL/LOW/MEDIUM/HIGH,不使用 2.5 的 token budget。
95
+ // 3.5 Flash 支持 MINIMAL/LOW/MEDIUM/HIGH,不使用 token budget。
150
96
  function applyGemini35Flash(writer: PayloadWriter, level: ThinkingLevel): void {
151
97
  writer.remove("reasoning_effort");
152
98
  const thinkingLevel = level === "off" || level === "minimal" ? "MINIMAL"
@@ -159,9 +105,5 @@ export const geminiThinking: Record<string, ThinkingApplier> = {
159
105
  "gemini-3.5-flash": (w, c) => applyGemini35Flash(w, c.thinkingLevel),
160
106
  "gemini-3.5-flash-low": (w, c) => applyGemini35Flash(w, c.thinkingLevel),
161
107
  "gemini-3.5-flash-extra-low": (w, c) => applyGemini35Flash(w, c.thinkingLevel),
162
- "gemini-2.5-flash": (w, c) => applyGeminiFlash(w, c.thinkingLevel),
163
- "gemini-2.5-flash-lite": (w, c) => applyGeminiFlash(w, c.thinkingLevel),
164
108
  "gemini-pro": (w, c) => applyGeminiPro(w, c.thinkingLevel),
165
- "gemini-3.1-pro-low": (w, c) => applyGeminiPro(w, c.thinkingLevel),
166
- "gemini-2.5-pro": (w, c) => applyGemini25Pro(w, c.thinkingLevel),
167
109
  };
@@ -7,10 +7,18 @@ import { isMaximum, type PayloadWriter, type ThinkingApplier, type ThinkingLevel
7
7
  * 国内官方依据:
8
8
  * https://docs.bigmodel.cn/cn/guide/capabilities/thinking (effort 仅 5.2+)
9
9
  * https://docs.bigmodel.cn/cn/guide/capabilities/thinking-mode (保留式思考)
10
+ * 2026-10-16 5.3 / Flash / FlashX:始终思考,仅 low/high/max。
11
+ * https://docs.bigmodel.cn/cn/guide/models/text/glm-5.3
12
+ * https://docs.bigmodel.cn/cn/guide/models/vlm/glm-5.3-flash
13
+ * https://docs.bigmodel.cn/cn/guide/start/pricing
14
+ * 国内 CNY/百万 tokens 按既有固定 0.1475 USD/CNY 估算(非实时汇率);
15
+ * 三型号输入/输出/缓存命中为 8/28/2、0.8/2.8/0.23、2/7/0.57,
16
+ * 缓存存储限时免费。1M 上下文与 128K 最大输出分别登记。
10
17
  */
11
18
  export function glmModels(root: string): ProviderModelConfig[] {
12
19
  const v1 = `${root}/v1`;
13
20
  return [
21
+ ...glm53Models(v1),
14
22
  {
15
23
  id: "glm-5.2",
16
24
  name: "GLM 5.2",
@@ -30,92 +38,6 @@ export function glmModels(root: string): ProviderModelConfig[] {
30
38
  maxTokens: 131072,
31
39
  compat: OPENAI_COMPLETIONS_COMPAT,
32
40
  },
33
- {
34
- id: "glm-5.1",
35
- name: "GLM 5.1",
36
- api: "openai-completions",
37
- baseUrl: v1,
38
- reasoning: true,
39
- input: ["text"],
40
- cost: { input: 0.885, output: 3.54, cacheRead: 0.19175, cacheWrite: 0 },
41
- contextWindow: 200000,
42
- maxTokens: 65536,
43
- compat: OPENAI_COMPLETIONS_COMPAT,
44
- },
45
- {
46
- id: "glm-5",
47
- name: "GLM-5",
48
- api: "openai-completions",
49
- baseUrl: v1,
50
- reasoning: true,
51
- thinkingLevelMap: {
52
- low: "low",
53
- medium: "medium",
54
- high: "high",
55
- xhigh: "xhigh",
56
- max: "max",
57
- },
58
- input: ["text"],
59
- cost: { input: 1, output: 3.2, cacheRead: 0.2, cacheWrite: 0 },
60
- contextWindow: 200000,
61
- maxTokens: 131072,
62
- compat: OPENAI_COMPLETIONS_COMPAT,
63
- },
64
- {
65
- id: "glm-5-turbo",
66
- name: "GLM-5-Turbo",
67
- api: "openai-completions",
68
- baseUrl: v1,
69
- reasoning: true,
70
- thinkingLevelMap: {
71
- low: "low",
72
- medium: "medium",
73
- high: "high",
74
- xhigh: "xhigh",
75
- max: "max",
76
- },
77
- input: ["text"],
78
- cost: { input: 1.2, output: 4, cacheRead: 0.24, cacheWrite: 0 },
79
- contextWindow: 200000,
80
- maxTokens: 131072,
81
- compat: OPENAI_COMPLETIONS_COMPAT,
82
- },
83
- {
84
- id: "glm-4.7",
85
- name: "GLM-4.7",
86
- api: "openai-completions",
87
- baseUrl: v1,
88
- reasoning: true,
89
- input: ["text"],
90
- cost: { input: 0.6, output: 2.2, cacheRead: 0.11, cacheWrite: 0 },
91
- contextWindow: 200000,
92
- maxTokens: 131072,
93
- compat: OPENAI_COMPLETIONS_COMPAT,
94
- },
95
- {
96
- id: "glm-4.6",
97
- name: "GLM-4.6",
98
- api: "openai-completions",
99
- baseUrl: v1,
100
- reasoning: true,
101
- input: ["text"],
102
- cost: { input: 0.6, output: 2.2, cacheRead: 0.11, cacheWrite: 0 },
103
- contextWindow: 200000,
104
- maxTokens: 131072,
105
- compat: OPENAI_COMPLETIONS_COMPAT,
106
- },
107
- {
108
- id: "glm-4.5",
109
- name: "GLM-4.5",
110
- api: "openai-completions",
111
- baseUrl: v1,
112
- reasoning: true,
113
- input: ["text"],
114
- cost: { input: 0.6, output: 2.2, cacheRead: 0.11, cacheWrite: 0 },
115
- contextWindow: 128000,
116
- maxTokens: 98304,
117
- compat: OPENAI_COMPLETIONS_COMPAT,
118
- },
119
41
  {
120
42
  id: "glm-4.5-air",
121
43
  name: "GLM-4.5-Air",
@@ -131,6 +53,35 @@ export function glmModels(root: string): ProviderModelConfig[] {
131
53
  ];
132
54
  }
133
55
 
56
+ /** 5.3 三型号只有模态和价格不同;具体契约由各自官方模型页确认。 */
57
+ function glm53Models(baseUrl: string): ProviderModelConfig[] {
58
+ const variants: Pick<ProviderModelConfig, "id" | "name" | "input" | "cost">[] = [
59
+ { id: "glm-5.3", name: "GLM 5.3", input: ["text"],
60
+ cost: { input: 1.18, output: 4.13, cacheRead: 0.295, cacheWrite: 0 } },
61
+ { id: "glm-5.3-flash", name: "GLM 5.3 Flash", input: ["text", "image"],
62
+ cost: { input: 0.118, output: 0.413, cacheRead: 0.033925, cacheWrite: 0 } },
63
+ { id: "glm-5.3-flashx", name: "GLM 5.3 FlashX", input: ["text", "image"],
64
+ cost: { input: 0.295, output: 1.0325, cacheRead: 0.084075, cacheWrite: 0 } },
65
+ ];
66
+ return variants.map((model) => ({
67
+ ...model,
68
+ api: "openai-completions",
69
+ baseUrl,
70
+ reasoning: true,
71
+ thinkingLevelMap: { off: null, minimal: "low", low: "low", medium: "high", high: "high", xhigh: "max", max: "max" },
72
+ contextWindow: 1000000,
73
+ maxTokens: 131072,
74
+ compat: OPENAI_COMPLETIONS_COMPAT,
75
+ } satisfies ProviderModelConfig));
76
+ }
77
+
78
+ function applyGlm53(writer: PayloadWriter, level: ThinkingLevel): void {
79
+ if (writer.get("stream") === true) writer.set("tool_stream", true);
80
+ writer.setThinking({ type: "enabled" });
81
+ if (level === "high" || isMaximum(level)) writer.setThinking({ clear_thinking: false });
82
+ writer.set("reasoning_effort", isMaximum(level) ? "max" : level === "medium" || level === "high" ? "high" : "low");
83
+ }
84
+
134
85
  // GLM 思维链:`tool_stream=true` 仅在流式请求时附加;高级档位加 `clear_thinking=false`。
135
86
  function applyGlm(writer: PayloadWriter, level: ThinkingLevel, effort = true, preserve = true): void {
136
87
  if (!effort) writer.remove("reasoning_effort");
@@ -149,12 +100,9 @@ function applyGlm(writer: PayloadWriter, level: ThinkingLevel, effort = true, pr
149
100
  }
150
101
 
151
102
  export const glmThinking: Record<string, ThinkingApplier> = {
103
+ "glm-5.3": (w, c) => applyGlm53(w, c.thinkingLevel),
104
+ "glm-5.3-flash": (w, c) => applyGlm53(w, c.thinkingLevel),
105
+ "glm-5.3-flashx": (w, c) => applyGlm53(w, c.thinkingLevel),
152
106
  "glm-5.2": (w, c) => applyGlm(w, c.thinkingLevel),
153
- "glm-5.1": (w, c) => applyGlm(w, c.thinkingLevel, false),
154
- "glm-5": (w, c) => applyGlm(w, c.thinkingLevel, false),
155
- "glm-5-turbo": (w, c) => applyGlm(w, c.thinkingLevel, false),
156
- "glm-4.7": (w, c) => applyGlm(w, c.thinkingLevel, false),
157
- "glm-4.6": (w, c) => applyGlm(w, c.thinkingLevel, false, false),
158
- "glm-4.5": (w, c) => applyGlm(w, c.thinkingLevel, false, false),
159
107
  "glm-4.5-air": (w, c) => applyGlm(w, c.thinkingLevel, false, false),
160
108
  };
@@ -1,105 +1,43 @@
1
1
  import type { ChatModelConfig as ProviderModelConfig } from "../_tools.ts";
2
2
  import { OPENAI_COMPLETIONS_COMPAT } from "./_protocols.ts";
3
- import { applyEnabledThinking, type PayloadWriter, type ThinkingApplier, type ThinkingLevel } from "../_tools.ts";
3
+ import { type PayloadWriter, type ThinkingApplier, type ThinkingLevel } from "../_tools.ts";
4
4
 
5
5
  /**
6
- * 月之暗面(Moonshot)Kimi 系列。
7
- * 官方文档:https://platform.moonshot.cn/docs
8
- * K2.7 Code 参数:https://platform.moonshot.cn/docs/api/models-overview
6
+ * 月之暗面(Moonshot)Kimi K3 系列。
7
+ * 官方文档:https://platform.kimi.ai/docs/guide/kimi-k3-quickstart
8
+ * 思考档位:https://platform.kimi.ai/docs/guide/use-reasoning-effort
9
+ * kimi-k3-256k 是网关变体:按已确认约定将上下文限制为 256 * 1024,
10
+ * 其余元数据/价格估算沿用 K3,不代表该变体已逐项通过端点验证。
11
+ * maxTokens 保留既有 131072,并非把 256K 上下文当成最大输出。
9
12
  */
10
13
  export function kimiModels(root: string): ProviderModelConfig[] {
11
- const v1 = `${root}/v1`;
12
- return [
13
- {
14
- id: "kimi-for-coding",
15
- name: "Kimi K2.7 Code",
16
- api: "openai-completions",
17
- baseUrl: v1,
18
- reasoning: true,
19
- input: ["text", "image"],
20
- cost: {
21
- input: 0.95875,
22
- output: 3.9825,
23
- cacheRead: 0.19175,
24
- cacheWrite: 0,
25
- },
26
- contextWindow: 262144,
27
- maxTokens: 32768,
28
- compat: OPENAI_COMPLETIONS_COMPAT,
29
- },
30
- {
31
- id: "kimi-k3",
32
- name: "Kimi K3",
33
- api: "openai-completions",
34
- baseUrl: v1,
35
- reasoning: true,
36
- thinkingLevelMap: {
37
- off: null,
38
- low: "low",
39
- medium: "medium",
40
- high: "high",
41
- xhigh: "xhigh",
42
- max: "max",
43
- },
44
- input: ["text", "image"],
45
- cost: { input: 3, output: 15, cacheRead: 2, cacheWrite: 0 },
46
- contextWindow: 1000000,
47
- maxTokens: 131072,
48
- compat: OPENAI_COMPLETIONS_COMPAT,
49
- },
50
- {
51
- id: "kimi-k2.7-code",
52
- name: "Kimi K2.7 Code",
53
- api: "openai-completions",
54
- baseUrl: v1,
55
- reasoning: true,
56
- thinkingLevelMap: { off: null },
57
- input: ["text", "image"],
58
- cost: { input: 0.95, output: 4, cacheRead: 0.19, cacheWrite: 0 },
59
- contextWindow: 262144,
60
- // 兼容性暂存值:独立输出上限未确认,并非官方确认的输出规格。
61
- maxTokens: 262144,
62
- compat: OPENAI_COMPLETIONS_COMPAT,
63
- },
64
- {
65
- id: "kimi-k2.7-code-highspeed",
66
- name: "Kimi K2.7 Code HighSpeed",
67
- api: "openai-completions",
68
- baseUrl: v1,
69
- reasoning: true,
70
- thinkingLevelMap: { off: null },
71
- input: ["text", "image"],
72
- cost: { input: 1.9, output: 8, cacheRead: 0.38, cacheWrite: 0 },
73
- contextWindow: 262144,
74
- // 兼容性暂存值:独立输出上限未确认,并非官方确认的输出规格。
75
- maxTokens: 262144,
76
- compat: OPENAI_COMPLETIONS_COMPAT,
77
- },
78
- {
79
- id: "kimi-k2.6",
80
- name: "Kimi K2.6",
81
- api: "openai-completions",
82
- baseUrl: v1,
83
- reasoning: true,
84
- input: ["text", "image"],
85
- cost: { input: 0.95, output: 4, cacheRead: 0.16, cacheWrite: 0 },
86
- contextWindow: 262144,
87
- // 兼容性暂存值:独立输出上限未确认,并非官方确认的输出规格。
88
- maxTokens: 262144,
89
- compat: OPENAI_COMPLETIONS_COMPAT,
14
+ const k3: ProviderModelConfig = {
15
+ id: "kimi-k3",
16
+ name: "Kimi K3",
17
+ api: "openai-completions",
18
+ baseUrl: `${root}/v1`,
19
+ reasoning: true,
20
+ thinkingLevelMap: {
21
+ off: null,
22
+ low: "low",
23
+ medium: "medium",
24
+ high: "high",
25
+ xhigh: "xhigh",
26
+ max: "max",
90
27
  },
28
+ input: ["text", "image"],
29
+ cost: { input: 3, output: 15, cacheRead: 2, cacheWrite: 0 },
30
+ contextWindow: 1000000,
31
+ maxTokens: 131072,
32
+ compat: OPENAI_COMPLETIONS_COMPAT,
33
+ };
34
+ return [
35
+ k3,
91
36
  {
92
- id: "kimi-k2.5",
93
- name: "Kimi K2.5",
94
- api: "openai-completions",
95
- baseUrl: v1,
96
- reasoning: true,
97
- input: ["text", "image"],
98
- cost: { input: 0.6, output: 3, cacheRead: 0.1, cacheWrite: 0 },
37
+ ...k3,
38
+ id: "kimi-k3-256k",
39
+ name: "Kimi K3 (256K)",
99
40
  contextWindow: 262144,
100
- // 兼容性暂存值:独立输出上限未确认,并非官方确认的输出规格。
101
- maxTokens: 262144,
102
- compat: OPENAI_COMPLETIONS_COMPAT,
103
41
  },
104
42
  ];
105
43
  }
@@ -115,17 +53,7 @@ function applyKimiK3(writer: PayloadWriter, level: ThinkingLevel): void {
115
53
  writer.set("reasoning_effort", level === "max" ? "max" : "high");
116
54
  }
117
55
 
118
- // canonical Code 与 highspeed 为同模型:不可关闭,显式 thinking 仅接受此组合。
119
- function applyKimiCode(writer: PayloadWriter): void {
120
- writer.remove("reasoning_effort");
121
- writer.setThinking({ type: "enabled", keep: "all" });
122
- }
123
-
124
56
  export const kimiThinking: Record<string, ThinkingApplier> = {
125
- "kimi-for-coding": (w, c) => applyEnabledThinking(w, c.thinkingLevel),
126
57
  "kimi-k3": (w, c) => applyKimiK3(w, c.thinkingLevel),
127
- "kimi-k2.7-code": (w) => applyKimiCode(w),
128
- "kimi-k2.7-code-highspeed": (w) => applyKimiCode(w),
129
- "kimi-k2.6": (w, c) => applyEnabledThinking(w, c.thinkingLevel),
130
- "kimi-k2.5": (w, c) => applyEnabledThinking(w, c.thinkingLevel),
58
+ "kimi-k3-256k": (w, c) => applyKimiK3(w, c.thinkingLevel),
131
59
  };
@@ -4,18 +4,22 @@ import { applyEnabledThinking, type ThinkingApplier } from "../_tools.ts";
4
4
 
5
5
  /**
6
6
  * 小米(Xiaomi)MiMo 系列。
7
- * 官方文档:https://platform.xiaomimimo.com/docs/
7
+ * 2026-10-10:直接迁移至 V2.6,不保留待下线的 V2.5 ID。
8
+ * 规格:https://mimo.mi.com/docs/zh-CN/quick-start/summary/model
9
+ * 思考:https://mimo.mi.com/docs/zh-CN/quick-start/usage-guide/text-generation/deep-thinking
10
+ * 定价:https://mimo.mi.com/docs/zh-CN/price/pay-as-you-go
11
+ * 国内 CNY/百万 tokens 按既有 0.1475 USD/CNY 估算;缓存写入限时免费。
8
12
  */
9
13
  export function mimoModels(root: string): ProviderModelConfig[] {
10
14
  const v1 = `${root}/v1`;
11
15
  return [
12
16
  {
13
- id: "mimo-v2.5-pro",
14
- name: "MiMo V2.5 Pro",
17
+ id: "mimo-v2.6-pro",
18
+ name: "MiMo V2.6 Pro",
15
19
  api: "openai-completions",
16
20
  baseUrl: v1,
17
21
  reasoning: true,
18
- input: ["text"],
22
+ input: ["text", "image"],
19
23
  cost: {
20
24
  input: 0.4425,
21
25
  output: 0.885,
@@ -27,8 +31,8 @@ export function mimoModels(root: string): ProviderModelConfig[] {
27
31
  compat: OPENAI_COMPLETIONS_COMPAT,
28
32
  },
29
33
  {
30
- id: "mimo-v2.5",
31
- name: "MiMo V2.5",
34
+ id: "mimo-v2.6-flash",
35
+ name: "MiMo V2.6 Flash",
32
36
  api: "openai-completions",
33
37
  baseUrl: v1,
34
38
  reasoning: true,
@@ -42,6 +46,6 @@ export function mimoModels(root: string): ProviderModelConfig[] {
42
46
  }
43
47
 
44
48
  export const mimoThinking: Record<string, ThinkingApplier> = {
45
- "mimo-v2.5-pro": (w, c) => applyEnabledThinking(w, c.thinkingLevel),
46
- "mimo-v2.5": (w, c) => applyEnabledThinking(w, c.thinkingLevel),
49
+ "mimo-v2.6-pro": (w, c) => applyEnabledThinking(w, c.thinkingLevel),
50
+ "mimo-v2.6-flash": (w, c) => applyEnabledThinking(w, c.thinkingLevel),
47
51
  };
@@ -6,11 +6,37 @@ import { type PayloadWriter, type ThinkingApplier, type ThinkingLevel } from "..
6
6
  * MiniMax 系列。
7
7
  * 国内官方依据:
8
8
  * https://platform.minimaxi.com/docs/api-reference/text-chat (输出上限)
9
- * https://platform.minimaxi.com/docs/api-reference/text-openai-api (M2.x 强制思考)
9
+ * 2026-10-16 M3.1 依据(不能关闭 thinking,支持五档 effort):
10
+ * https://platform.minimax.cn/docs/guides/text-generation
11
+ * https://platform.minimax.cn/docs/api-reference/text-openai-api
12
+ * https://platform.minimax.cn/docs/api-reference/text-chat (最大输出 524288)
13
+ * 预览版仅 M Plan / Code 提供;未公布 token 单价,cost=0 是未知占位,不是免费。
10
14
  */
11
15
  export function minimaxModels(root: string): ProviderModelConfig[] {
12
16
  const v1 = `${root}/v1`;
13
17
  return [
18
+ {
19
+ id: "MiniMax-M3.1-Flash-Preview",
20
+ name: "MiniMax-M3.1-Flash-Preview",
21
+ api: "openai-completions",
22
+ baseUrl: v1,
23
+ reasoning: true,
24
+ thinkingLevelMap: {
25
+ off: null,
26
+ minimal: "low",
27
+ low: "low",
28
+ medium: "medium",
29
+ high: "high",
30
+ xhigh: "xhigh",
31
+ max: "max",
32
+ },
33
+ input: ["text", "image"],
34
+ // No public per-token price; do not inherit M3 prices.
35
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
36
+ contextWindow: 1000000,
37
+ maxTokens: 524288,
38
+ compat: OPENAI_COMPLETIONS_COMPAT,
39
+ },
14
40
  {
15
41
  id: "MiniMax-M3",
16
42
  name: "MiniMax-M3",
@@ -28,62 +54,25 @@ export function minimaxModels(root: string): ProviderModelConfig[] {
28
54
  maxTokens: 524288,
29
55
  compat: OPENAI_COMPLETIONS_COMPAT,
30
56
  },
31
- {
32
- id: "MiniMax-M2.7",
33
- name: "MiniMax-M2.7",
34
- api: "openai-completions",
35
- baseUrl: v1,
36
- reasoning: true,
37
- thinkingLevelMap: { off: null },
38
- input: ["text"],
39
- cost: { input: 0.3, output: 1.2, cacheRead: 0.06, cacheWrite: 0.375 },
40
- contextWindow: 204800,
41
- // 官方 max_completion_tokens 上限,并非上下文估算。
42
- maxTokens: 204800,
43
- compat: OPENAI_COMPLETIONS_COMPAT,
44
- },
45
- {
46
- id: "MiniMax-M2.5",
47
- name: "MiniMax-M2.5",
48
- api: "openai-completions",
49
- baseUrl: v1,
50
- reasoning: true,
51
- thinkingLevelMap: { off: null },
52
- input: ["text"],
53
- cost: { input: 0.3, output: 1.2, cacheRead: 0.03, cacheWrite: 0.375 },
54
- contextWindow: 204800,
55
- // 官方 max_completion_tokens 上限,并非上下文估算。
56
- maxTokens: 204800,
57
- compat: OPENAI_COMPLETIONS_COMPAT,
58
- },
59
- {
60
- id: "MiniMax-M2.1",
61
- name: "MiniMax-M2.1",
62
- api: "openai-completions",
63
- baseUrl: v1,
64
- reasoning: true,
65
- thinkingLevelMap: { off: null },
66
- input: ["text"],
67
- cost: { input: 0.3, output: 1.2, cacheRead: 0.03, cacheWrite: 0.375 },
68
- contextWindow: 204800,
69
- // 官方 max_completion_tokens 上限,并非上下文估算。
70
- maxTokens: 204800,
71
- compat: OPENAI_COMPLETIONS_COMPAT,
72
- },
73
57
  ];
74
58
  }
75
59
 
76
60
  // MiniMax 思维链:`reasoning_split=true`,档位映射 disabled/adaptive。
77
- // 国内 OpenAI SDK 文档明确区分:M3 可关闭;M2.x disabled 被接受但不生效。
61
+ // 国内 OpenAI SDK 文档:M3 可关闭 thinking。
78
62
  function applyMiniMax(writer: PayloadWriter, level: ThinkingLevel): void {
79
63
  writer.remove("reasoning_effort");
80
64
  writer.set("reasoning_split", true);
81
65
  writer.setThinking({ type: level === "off" ? "disabled" : "adaptive" });
82
66
  }
83
67
 
68
+ function applyMiniMax31(writer: PayloadWriter, level: ThinkingLevel): void {
69
+ writer.set("reasoning_split", true);
70
+ writer.setThinking({ type: "adaptive" });
71
+ // Stale off/minimal snapshots must not select unsupported none or default max.
72
+ writer.set("reasoning_effort", level === "off" || level === "minimal" ? "low" : level);
73
+ }
74
+
84
75
  export const minimaxThinking = {
76
+ "MiniMax-M3.1-Flash-Preview": (w, c) => applyMiniMax31(w, c.thinkingLevel),
85
77
  "MiniMax-M3": (w, c) => applyMiniMax(w, c.thinkingLevel),
86
- "MiniMax-M2.7": (w) => applyMiniMax(w, "high"),
87
- "MiniMax-M2.5": (w) => applyMiniMax(w, "high"),
88
- "MiniMax-M2.1": (w) => applyMiniMax(w, "high"),
89
78
  } satisfies Record<string, ThinkingApplier>;
@@ -95,95 +95,19 @@ export function openaiModels(root: string): ProviderModelConfig[] {
95
95
  contextWindow: 1050000,
96
96
  maxTokens: 128000,
97
97
  },
98
- {
99
- id: "gpt-5.6-sol",
100
- name: "GPT 5.6 Sol",
101
- api: "openai-responses",
102
- baseUrl: v1,
103
- reasoning: true,
104
- thinkingLevelMap: {
105
- low: "low",
106
- medium: "medium",
107
- high: "high",
108
- xhigh: "xhigh",
109
- max: "max",
110
- },
111
- input: ["text", "image"],
112
- cost: { input: 5, output: 30, cacheRead: 0.5, cacheWrite: 6.25 },
113
- contextWindow: 372000,
114
- maxTokens: 128000,
115
- },
116
- {
117
- id: "gpt-5.6-terra",
118
- name: "GPT 5.6 Terra",
119
- api: "openai-responses",
120
- baseUrl: v1,
121
- reasoning: true,
122
- thinkingLevelMap: {
123
- low: "low",
124
- medium: "medium",
125
- high: "high",
126
- xhigh: "xhigh",
127
- max: "max",
128
- },
129
- input: ["text", "image"],
130
- cost: { input: 2.5, output: 15, cacheRead: 0.25, cacheWrite: 3.125 },
131
- contextWindow: 372000,
132
- maxTokens: 128000,
133
- },
134
- {
135
- id: "gpt-5.6-luna",
136
- name: "GPT 5.6 Luna",
137
- api: "openai-responses",
138
- baseUrl: v1,
139
- reasoning: true,
140
- thinkingLevelMap: {
141
- low: "low",
142
- medium: "medium",
143
- high: "high",
144
- xhigh: "xhigh",
145
- max: "max",
146
- },
147
- input: ["text", "image"],
148
- cost: { input: 1, output: 6, cacheRead: 0.01, cacheWrite: 1.25 },
149
- contextWindow: 372000,
150
- maxTokens: 128000,
151
- },
152
- {
153
- id: "gpt-5.5",
154
- name: "GPT-5.5",
155
- api: "openai-responses",
156
- baseUrl: v1,
157
- reasoning: true,
158
- thinkingLevelMap: {
159
- low: "low",
160
- medium: "medium",
161
- high: "high",
162
- xhigh: "xhigh",
163
- },
164
- input: ["text", "image"],
165
- cost: { input: 5, output: 30, cacheRead: 0.5, cacheWrite: 0 },
166
- contextWindow: 272000,
167
- maxTokens: 128000,
168
- },
169
98
  ];
170
99
  }
171
100
 
172
- // GPT Responses 思维链:保留 Pi 的 `reasoning`,按别名调文本 verbosity。
101
+ // GPT Responses 思维链:保留 Pi 的 `reasoning`,文本 verbosity 固定为 low。
173
102
  // 不写 service_tier:flex 为 beta 有限支持(受模型/账号限制),会被 OpenAI upstream 以
174
103
  // 400 "Unsupported service_tier: flex" 拒绝,让请求走项目默认 tier。
175
- function applyOpenAIResponses(writer: PayloadWriter, modelId: string): void {
176
- const verbosity = modelId === "gpt-5.6-terra" ? "medium" : "low";
177
- writer.setTextVerbosity(verbosity);
104
+ function applyOpenAIResponses(writer: PayloadWriter): void {
105
+ writer.setTextVerbosity("low");
178
106
  }
179
107
 
180
108
  export const openaiThinking = {
181
- "gpt-6-astra": (w, c) => applyOpenAIResponses(w, c.modelId),
182
- "gpt-6.1-sol": (w, c) => applyOpenAIResponses(w, c.modelId),
183
- "gpt-6-sol": (w, c) => applyOpenAIResponses(w, c.modelId),
184
- "gpt-6-luna": (w, c) => applyOpenAIResponses(w, c.modelId),
185
- "gpt-5.6-sol": (w, c) => applyOpenAIResponses(w, c.modelId),
186
- "gpt-5.6-terra": (w, c) => applyOpenAIResponses(w, c.modelId),
187
- "gpt-5.6-luna": (w, c) => applyOpenAIResponses(w, c.modelId),
188
- "gpt-5.5": (w, c) => applyOpenAIResponses(w, c.modelId),
109
+ "gpt-6-astra": (w, _c) => applyOpenAIResponses(w),
110
+ "gpt-6.1-sol": (w, _c) => applyOpenAIResponses(w),
111
+ "gpt-6-sol": (w, _c) => applyOpenAIResponses(w),
112
+ "gpt-6-luna": (w, _c) => applyOpenAIResponses(w),
189
113
  } satisfies Record<string, ThinkingApplier>;
@@ -28,10 +28,6 @@ const BUILTIN_SEARCH_MODELS = new Set([
28
28
  "gpt-6.1-sol",
29
29
  "gpt-6-sol",
30
30
  "gpt-6-luna",
31
- "gpt-5.6-sol",
32
- "gpt-5.6-terra",
33
- "gpt-5.6-luna",
34
- "gpt-5.5",
35
31
  ]);
36
32
 
37
33
  // 支持内置查询的 Grok 系列(openai-completions 协议,search_parameters 模式)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-tsgw",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "Pi extension for the TOSSP AIH gateway: per-vendor model catalog and thinking operations for openai-completions, openai-responses, anthropic-messages, and google-generative-ai wire protocols.",
5
5
  "type": "module",
6
6
  "keywords": [