pi-tsgw 0.0.11 → 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.
@@ -1,14 +1,24 @@
1
- import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
1
+ import type { ChatModelConfig as ProviderModelConfig } from "../_tools.ts";
2
2
  import { OPENAI_COMPLETIONS_COMPAT } from "./_protocols.ts";
3
3
  import { isMaximum, type PayloadWriter, type ThinkingApplier, type ThinkingLevel } from "../_tools.ts";
4
4
 
5
5
  /**
6
6
  * 智谱 AI(Zhipu)GLM 系列。
7
- * 官方文档:https://open.bigmodel.cn/(国际站 docs.z.ai)
7
+ * 国内官方依据:
8
+ * https://docs.bigmodel.cn/cn/guide/capabilities/thinking (effort 仅 5.2+)
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 最大输出分别登记。
8
17
  */
9
18
  export function glmModels(root: string): ProviderModelConfig[] {
10
19
  const v1 = `${root}/v1`;
11
20
  return [
21
+ ...glm53Models(v1),
12
22
  {
13
23
  id: "glm-5.2",
14
24
  name: "GLM 5.2",
@@ -28,92 +38,6 @@ export function glmModels(root: string): ProviderModelConfig[] {
28
38
  maxTokens: 131072,
29
39
  compat: OPENAI_COMPLETIONS_COMPAT,
30
40
  },
31
- {
32
- id: "glm-5.1",
33
- name: "GLM 5.1",
34
- api: "openai-completions",
35
- baseUrl: v1,
36
- reasoning: true,
37
- input: ["text"],
38
- cost: { input: 0.885, output: 3.54, cacheRead: 0.19175, cacheWrite: 0 },
39
- contextWindow: 200000,
40
- maxTokens: 65536,
41
- compat: OPENAI_COMPLETIONS_COMPAT,
42
- },
43
- {
44
- id: "glm-5",
45
- name: "GLM-5",
46
- api: "openai-completions",
47
- baseUrl: v1,
48
- reasoning: true,
49
- thinkingLevelMap: {
50
- low: "low",
51
- medium: "medium",
52
- high: "high",
53
- xhigh: "xhigh",
54
- max: "max",
55
- },
56
- input: ["text"],
57
- cost: { input: 1, output: 3.2, cacheRead: 0.2, cacheWrite: 0 },
58
- contextWindow: 200000,
59
- maxTokens: 131072,
60
- compat: OPENAI_COMPLETIONS_COMPAT,
61
- },
62
- {
63
- id: "glm-5-turbo",
64
- name: "GLM-5-Turbo",
65
- api: "openai-completions",
66
- baseUrl: v1,
67
- reasoning: true,
68
- thinkingLevelMap: {
69
- low: "low",
70
- medium: "medium",
71
- high: "high",
72
- xhigh: "xhigh",
73
- max: "max",
74
- },
75
- input: ["text"],
76
- cost: { input: 1.2, output: 4, cacheRead: 0.24, cacheWrite: 0 },
77
- contextWindow: 200000,
78
- maxTokens: 131072,
79
- compat: OPENAI_COMPLETIONS_COMPAT,
80
- },
81
- {
82
- id: "glm-4.7",
83
- name: "GLM-4.7",
84
- api: "openai-completions",
85
- baseUrl: v1,
86
- reasoning: true,
87
- input: ["text"],
88
- cost: { input: 0.6, output: 2.2, cacheRead: 0.11, cacheWrite: 0 },
89
- contextWindow: 200000,
90
- maxTokens: 131072,
91
- compat: OPENAI_COMPLETIONS_COMPAT,
92
- },
93
- {
94
- id: "glm-4.6",
95
- name: "GLM-4.6",
96
- api: "openai-completions",
97
- baseUrl: v1,
98
- reasoning: true,
99
- input: ["text"],
100
- cost: { input: 0.6, output: 2.2, cacheRead: 0.11, cacheWrite: 0 },
101
- contextWindow: 200000,
102
- maxTokens: 131072,
103
- compat: OPENAI_COMPLETIONS_COMPAT,
104
- },
105
- {
106
- id: "glm-4.5",
107
- name: "GLM-4.5",
108
- api: "openai-completions",
109
- baseUrl: v1,
110
- reasoning: true,
111
- input: ["text"],
112
- cost: { input: 0.6, output: 2.2, cacheRead: 0.11, cacheWrite: 0 },
113
- contextWindow: 128000,
114
- maxTokens: 98304,
115
- compat: OPENAI_COMPLETIONS_COMPAT,
116
- },
117
41
  {
118
42
  id: "glm-4.5-air",
119
43
  name: "GLM-4.5-Air",
@@ -129,29 +53,56 @@ export function glmModels(root: string): ProviderModelConfig[] {
129
53
  ];
130
54
  }
131
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
+
132
85
  // GLM 思维链:`tool_stream=true` 仅在流式请求时附加;高级档位加 `clear_thinking=false`。
133
- function applyGlm(writer: PayloadWriter, level: ThinkingLevel): void {
86
+ function applyGlm(writer: PayloadWriter, level: ThinkingLevel, effort = true, preserve = true): void {
87
+ if (!effort) writer.remove("reasoning_effort");
134
88
  if (writer.get("stream") === true) writer.set("tool_stream", true);
135
89
  if (level === "off") {
136
90
  writer.setThinking({ type: "disabled" });
137
- writer.set("reasoning_effort", "none");
91
+ if (effort) writer.set("reasoning_effort", "none");
138
92
  return;
139
93
  }
140
94
 
141
95
  writer.setThinking({ type: "enabled" });
142
96
  if (level === "high" || isMaximum(level)) {
143
- writer.setThinking({ clear_thinking: false });
144
- writer.set("reasoning_effort", isMaximum(level) ? "max" : "high");
97
+ if (preserve) writer.setThinking({ clear_thinking: false });
98
+ if (effort) writer.set("reasoning_effort", isMaximum(level) ? "max" : "high");
145
99
  }
146
100
  }
147
101
 
148
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),
149
106
  "glm-5.2": (w, c) => applyGlm(w, c.thinkingLevel),
150
- "glm-5.1": (w, c) => applyGlm(w, c.thinkingLevel),
151
- "glm-5": (w, c) => applyGlm(w, c.thinkingLevel),
152
- "glm-5-turbo": (w, c) => applyGlm(w, c.thinkingLevel),
153
- "glm-4.7": (w, c) => applyGlm(w, c.thinkingLevel),
154
- "glm-4.6": (w, c) => applyGlm(w, c.thinkingLevel),
155
- "glm-4.5": (w, c) => applyGlm(w, c.thinkingLevel),
156
- "glm-4.5-air": (w, c) => applyGlm(w, c.thinkingLevel),
107
+ "glm-4.5-air": (w, c) => applyGlm(w, c.thinkingLevel, false, false),
157
108
  };
@@ -1,4 +1,4 @@
1
- import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
1
+ import type { ChatModelConfig as ProviderModelConfig } from "../_tools.ts";
2
2
  import { OPENAI_COMPLETIONS_COMPAT } from "./_protocols.ts";
3
3
  import { type PayloadWriter, type ThinkingApplier, type ThinkingLevel } from "../_tools.ts";
4
4
 
@@ -91,8 +91,10 @@ export function grokModels(root: string): ProviderModelConfig[] {
91
91
  ];
92
92
  }
93
93
 
94
- // Grok 思维链:`reasoning_effort`(none/low/medium/high)。
95
- // 注意:grok-4.5 不支持禁用 reasoning(none),off 档映射到最小 effort "low"。
94
+ // 官方:https://docs.x.ai/developers/model-capabilities/text/reasoning
95
+ // grok-4.5 支持 low/medium/high,不支持禁用 reasoning,off 映射到 low。
96
+ // 4.20 / 4.3 网关别名暂保留既有映射;上述官方指南没有确认其 effort 支持,
97
+ // 不应将同族回归测试视为这些别名已通过端点验证。
96
98
  function applyGrok(writer: PayloadWriter, level: ThinkingLevel): void {
97
99
  writer.remove("thinking");
98
100
  if (level === "off") {
@@ -1,101 +1,43 @@
1
- import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
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
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 上下文当成最大输出。
8
12
  */
9
13
  export function kimiModels(root: string): ProviderModelConfig[] {
10
- const v1 = `${root}/v1`;
11
- return [
12
- {
13
- id: "kimi-for-coding",
14
- name: "Kimi K2.7 Code",
15
- api: "openai-completions",
16
- baseUrl: v1,
17
- reasoning: true,
18
- input: ["text", "image"],
19
- cost: {
20
- input: 0.95875,
21
- output: 3.9825,
22
- cacheRead: 0.19175,
23
- cacheWrite: 0,
24
- },
25
- contextWindow: 262144,
26
- maxTokens: 32768,
27
- compat: OPENAI_COMPLETIONS_COMPAT,
28
- },
29
- {
30
- id: "kimi-k3",
31
- name: "Kimi K3",
32
- api: "openai-completions",
33
- baseUrl: v1,
34
- reasoning: true,
35
- thinkingLevelMap: {
36
- low: "low",
37
- medium: "medium",
38
- high: "high",
39
- xhigh: "xhigh",
40
- max: "max",
41
- },
42
- input: ["text", "image"],
43
- cost: { input: 3, output: 15, cacheRead: 2, cacheWrite: 0 },
44
- contextWindow: 1000000,
45
- maxTokens: 131072,
46
- compat: OPENAI_COMPLETIONS_COMPAT,
47
- },
48
- {
49
- id: "kimi-k2.7-code",
50
- name: "Kimi K2.7 Code",
51
- api: "openai-completions",
52
- baseUrl: v1,
53
- reasoning: true,
54
- input: ["text", "image"],
55
- cost: { input: 0.95, output: 4, cacheRead: 0.19, cacheWrite: 0 },
56
- contextWindow: 262144,
57
- // 官方未公布最大输出上限,保守取上下文窗口。
58
- maxTokens: 262144,
59
- compat: OPENAI_COMPLETIONS_COMPAT,
60
- },
61
- {
62
- id: "kimi-k2.7-code-highspeed",
63
- name: "Kimi K2.7 Code HighSpeed",
64
- api: "openai-completions",
65
- baseUrl: v1,
66
- reasoning: true,
67
- input: ["text", "image"],
68
- cost: { input: 1.9, output: 8, cacheRead: 0.38, cacheWrite: 0 },
69
- contextWindow: 262144,
70
- // 官方未公布最大输出上限,保守取上下文窗口。
71
- maxTokens: 262144,
72
- compat: OPENAI_COMPLETIONS_COMPAT,
73
- },
74
- {
75
- id: "kimi-k2.6",
76
- name: "Kimi K2.6",
77
- api: "openai-completions",
78
- baseUrl: v1,
79
- reasoning: true,
80
- input: ["text", "image"],
81
- cost: { input: 0.95, output: 4, cacheRead: 0.16, cacheWrite: 0 },
82
- contextWindow: 262144,
83
- // 官方未公布最大输出上限,保守取上下文窗口。
84
- maxTokens: 262144,
85
- 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",
86
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,
87
36
  {
88
- id: "kimi-k2.5",
89
- name: "Kimi K2.5",
90
- api: "openai-completions",
91
- baseUrl: v1,
92
- reasoning: true,
93
- input: ["text", "image"],
94
- cost: { input: 0.6, output: 3, cacheRead: 0.1, cacheWrite: 0 },
37
+ ...k3,
38
+ id: "kimi-k3-256k",
39
+ name: "Kimi K3 (256K)",
95
40
  contextWindow: 262144,
96
- // 官方未公布最大输出上限,保守取上下文窗口。
97
- maxTokens: 262144,
98
- compat: OPENAI_COMPLETIONS_COMPAT,
99
41
  },
100
42
  ];
101
43
  }
@@ -103,11 +45,8 @@ export function kimiModels(root: string): ProviderModelConfig[] {
103
45
  // Kimi K3 思维链:移除 `thinking` 字段,改用 `reasoning_effort` 表达深度。
104
46
  function applyKimiK3(writer: PayloadWriter, level: ThinkingLevel): void {
105
47
  writer.remove("thinking");
106
- if (level === "off") {
107
- writer.remove("reasoning_effort");
108
- return;
109
- }
110
- if (level === "minimal" || level === "low") {
48
+ // K3 始终思考,省略 effort 默认 max;直接或迟到的 off 请求降至 low。
49
+ if (level === "off" || level === "minimal" || level === "low") {
111
50
  writer.set("reasoning_effort", "low");
112
51
  return;
113
52
  }
@@ -115,10 +54,6 @@ function applyKimiK3(writer: PayloadWriter, level: ThinkingLevel): void {
115
54
  }
116
55
 
117
56
  export const kimiThinking: Record<string, ThinkingApplier> = {
118
- "kimi-for-coding": (w, c) => applyEnabledThinking(w, c.thinkingLevel),
119
57
  "kimi-k3": (w, c) => applyKimiK3(w, c.thinkingLevel),
120
- "kimi-k2.7-code": (w, c) => applyEnabledThinking(w, c.thinkingLevel),
121
- "kimi-k2.7-code-highspeed": (w, c) => applyEnabledThinking(w, c.thinkingLevel),
122
- "kimi-k2.6": (w, c) => applyEnabledThinking(w, c.thinkingLevel),
123
- "kimi-k2.5": (w, c) => applyEnabledThinking(w, c.thinkingLevel),
58
+ "kimi-k3-256k": (w, c) => applyKimiK3(w, c.thinkingLevel),
124
59
  };
@@ -1,4 +1,4 @@
1
- import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
1
+ import type { ChatModelConfig as ProviderModelConfig } from "../_tools.ts";
2
2
  import { OPENAI_COMPLETIONS_COMPAT } from "./_protocols.ts";
3
3
  import { applyEnabledThinking, type ThinkingApplier } from "../_tools.ts";
4
4
 
@@ -1,21 +1,25 @@
1
- import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
1
+ import type { ChatModelConfig as ProviderModelConfig } from "../_tools.ts";
2
2
  import { OPENAI_COMPLETIONS_COMPAT } from "./_protocols.ts";
3
3
  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
  };
@@ -1,14 +1,42 @@
1
- import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
1
+ import type { ChatModelConfig as ProviderModelConfig } from "../_tools.ts";
2
2
  import { OPENAI_COMPLETIONS_COMPAT } from "./_protocols.ts";
3
3
  import { type PayloadWriter, type ThinkingApplier, type ThinkingLevel } from "../_tools.ts";
4
4
 
5
5
  /**
6
6
  * MiniMax 系列。
7
- * 官方文档:https://platform.minimaxi.com/(国际站 platform.minimax.io)
7
+ * 国内官方依据:
8
+ * https://platform.minimaxi.com/docs/api-reference/text-chat (输出上限)
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 是未知占位,不是免费。
8
14
  */
9
15
  export function minimaxModels(root: string): ProviderModelConfig[] {
10
16
  const v1 = `${root}/v1`;
11
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
+ },
12
40
  {
13
41
  id: "MiniMax-M3",
14
42
  name: "MiniMax-M3",
@@ -23,62 +51,28 @@ export function minimaxModels(root: string): ProviderModelConfig[] {
23
51
  cacheWrite: 0,
24
52
  },
25
53
  contextWindow: 1000000,
26
- maxTokens: 500000,
27
- compat: OPENAI_COMPLETIONS_COMPAT,
28
- },
29
- {
30
- id: "MiniMax-M2.7",
31
- name: "MiniMax-M2.7",
32
- api: "openai-completions",
33
- baseUrl: v1,
34
- reasoning: true,
35
- input: ["text"],
36
- cost: { input: 0.3, output: 1.2, cacheRead: 0.06, cacheWrite: 0.375 },
37
- contextWindow: 204800,
38
- // 官方未公布最大输出上限,保守取上下文窗口。
39
- maxTokens: 204800,
40
- compat: OPENAI_COMPLETIONS_COMPAT,
41
- },
42
- {
43
- id: "MiniMax-M2.5",
44
- name: "MiniMax-M2.5",
45
- api: "openai-completions",
46
- baseUrl: v1,
47
- reasoning: true,
48
- input: ["text"],
49
- cost: { input: 0.3, output: 1.2, cacheRead: 0.03, cacheWrite: 0.375 },
50
- contextWindow: 204800,
51
- // 官方未公布最大输出上限,保守取上下文窗口。
52
- maxTokens: 204800,
53
- compat: OPENAI_COMPLETIONS_COMPAT,
54
- },
55
- {
56
- id: "MiniMax-M2.1",
57
- name: "MiniMax-M2.1",
58
- api: "openai-completions",
59
- baseUrl: v1,
60
- reasoning: true,
61
- input: ["text"],
62
- cost: { input: 0.3, output: 1.2, cacheRead: 0.03, cacheWrite: 0.375 },
63
- contextWindow: 204800,
64
- // 官方未公布最大输出上限,保守取上下文窗口。
65
- maxTokens: 204800,
54
+ maxTokens: 524288,
66
55
  compat: OPENAI_COMPLETIONS_COMPAT,
67
56
  },
68
57
  ];
69
58
  }
70
59
 
71
60
  // MiniMax 思维链:`reasoning_split=true`,档位映射 disabled/adaptive。
72
- // M2.x 沿用 M3 策略(同族,未逐一验证)。
61
+ // 国内 OpenAI SDK 文档:M3 可关闭 thinking。
73
62
  function applyMiniMax(writer: PayloadWriter, level: ThinkingLevel): void {
74
63
  writer.remove("reasoning_effort");
75
64
  writer.set("reasoning_split", true);
76
65
  writer.setThinking({ type: level === "off" ? "disabled" : "adaptive" });
77
66
  }
78
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
+
79
75
  export const minimaxThinking = {
76
+ "MiniMax-M3.1-Flash-Preview": (w, c) => applyMiniMax31(w, c.thinkingLevel),
80
77
  "MiniMax-M3": (w, c) => applyMiniMax(w, c.thinkingLevel),
81
- "MiniMax-M2.7": (w, c) => applyMiniMax(w, c.thinkingLevel),
82
- "MiniMax-M2.5": (w, c) => applyMiniMax(w, c.thinkingLevel),
83
- "MiniMax-M2.1": (w, c) => applyMiniMax(w, c.thinkingLevel),
84
78
  } satisfies Record<string, ThinkingApplier>;
@@ -1,4 +1,4 @@
1
- import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
1
+ import type { ChatModelConfig as ProviderModelConfig } from "../_tools.ts";
2
2
  import { type PayloadWriter, type ThinkingApplier } from "../_tools.ts";
3
3
 
4
4
  /**
@@ -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>;
@@ -1,4 +1,4 @@
1
- import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
1
+ import type { ChatModelConfig as ProviderModelConfig } from "../_tools.ts";
2
2
  import { OPENAI_COMPLETIONS_COMPAT } from "./_protocols.ts";
3
3
  import { isAtLeastHigh, type PayloadWriter, type ThinkingApplier, type ThinkingLevel } from "../_tools.ts";
4
4