pi-tsgw 3.5.1 → 3.6.0
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.
|
@@ -3,11 +3,17 @@ import { OPENAI_COMPLETIONS_COMPAT } from "./_protocols.ts";
|
|
|
3
3
|
import { type PayloadWriter, type ThinkingApplier, type ThinkingLevel } from "../_tools.ts";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* 月之暗面(Moonshot)Kimi K3
|
|
6
|
+
* 月之暗面(Moonshot)Kimi K3 与 K2.8。
|
|
7
|
+
* Kimi Code 模型 ID 与思考档位(2026-11-16):
|
|
8
|
+
* https://www.kimi.com/code/docs/kimi-code/models.html
|
|
9
|
+
* kimi-for-coding 对应 K2.8 Preview,支持 low/high/max;关闭思考仍为 K2.8。
|
|
10
|
+
* K2.8 的 1M 上下文、32768 最大输出取自本次网关目录;宿主仅登记文字和图片输入。
|
|
11
|
+
* 官方未公开该 Code 型号的独立词元价格,cost=0 表示未知,不代表免费。
|
|
12
|
+
* K3 系列本次只适配 Code 模型 ID,保留既有规格和思考策略。
|
|
7
13
|
* 官方文档:https://platform.kimi.ai/docs/guide/kimi-k3-quickstart
|
|
8
14
|
* 思考档位:https://platform.kimi.ai/docs/guide/use-reasoning-effort
|
|
9
|
-
*
|
|
10
|
-
*
|
|
15
|
+
* k3-256k 上下文按 Code 官方规格限制为 256 * 1024,
|
|
16
|
+
* 其余元数据/价格估算保留既有 K3 登记,不代表该变体已逐项通过端点验证。
|
|
11
17
|
* maxTokens 保留既有 131072,并非把 256K 上下文当成最大输出。
|
|
12
18
|
* 2026-10-24 K3.1 Pro 国内官方核验:
|
|
13
19
|
* https://platform.kimi.com/docs/guide/kimi-k3-1-pro-quickstart (输入、上下文与最大输出)
|
|
@@ -20,7 +26,7 @@ import { type PayloadWriter, type ThinkingApplier, type ThinkingLevel } from "..
|
|
|
20
26
|
*/
|
|
21
27
|
export function kimiModels(root: string): ProviderModelConfig[] {
|
|
22
28
|
const k3: ProviderModelConfig = {
|
|
23
|
-
id: "
|
|
29
|
+
id: "k3",
|
|
24
30
|
name: "Kimi K3",
|
|
25
31
|
api: "openai-completions",
|
|
26
32
|
baseUrl: `${root}/v1`,
|
|
@@ -42,7 +48,7 @@ export function kimiModels(root: string): ProviderModelConfig[] {
|
|
|
42
48
|
return [
|
|
43
49
|
{
|
|
44
50
|
...k3,
|
|
45
|
-
id: "
|
|
51
|
+
id: "k3.1-pro",
|
|
46
52
|
name: "Kimi K3.1 Pro",
|
|
47
53
|
thinkingLevelMap: {
|
|
48
54
|
off: null,
|
|
@@ -60,18 +66,38 @@ export function kimiModels(root: string): ProviderModelConfig[] {
|
|
|
60
66
|
k3,
|
|
61
67
|
{
|
|
62
68
|
...k3,
|
|
63
|
-
id: "
|
|
69
|
+
id: "k3-256k",
|
|
64
70
|
name: "Kimi K3 (256K)",
|
|
65
71
|
contextWindow: 262144,
|
|
66
72
|
},
|
|
73
|
+
{
|
|
74
|
+
...k3,
|
|
75
|
+
id: "kimi-for-coding",
|
|
76
|
+
name: "Kimi K2.8 Preview",
|
|
77
|
+
thinkingLevelMap: {
|
|
78
|
+
off: "none",
|
|
79
|
+
minimal: "low",
|
|
80
|
+
low: "low",
|
|
81
|
+
medium: "high",
|
|
82
|
+
high: "high",
|
|
83
|
+
xhigh: "high",
|
|
84
|
+
max: "max",
|
|
85
|
+
},
|
|
86
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
87
|
+
contextWindow: 1048576,
|
|
88
|
+
maxTokens: 32768,
|
|
89
|
+
},
|
|
67
90
|
];
|
|
68
91
|
}
|
|
69
92
|
|
|
70
|
-
//
|
|
71
|
-
function
|
|
93
|
+
// Code 模型使用 reasoning_effort;K3 保留 off 降至 low,避免路由到另一型号。
|
|
94
|
+
function applyKimiEffort(writer: PayloadWriter, level: ThinkingLevel, offEffort: "low" | "none" = "low"): void {
|
|
72
95
|
writer.remove("thinking");
|
|
73
|
-
|
|
74
|
-
|
|
96
|
+
if (level === "off") {
|
|
97
|
+
writer.set("reasoning_effort", offEffort);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (level === "minimal" || level === "low") {
|
|
75
101
|
writer.set("reasoning_effort", "low");
|
|
76
102
|
return;
|
|
77
103
|
}
|
|
@@ -79,7 +105,8 @@ function applyKimiK3(writer: PayloadWriter, level: ThinkingLevel): void {
|
|
|
79
105
|
}
|
|
80
106
|
|
|
81
107
|
export const kimiThinking: Record<string, ThinkingApplier> = {
|
|
82
|
-
"
|
|
83
|
-
|
|
84
|
-
"
|
|
108
|
+
"k3.1-pro": (w, c) => applyKimiEffort(w, c.thinkingLevel),
|
|
109
|
+
k3: (w, c) => applyKimiEffort(w, c.thinkingLevel),
|
|
110
|
+
"k3-256k": (w, c) => applyKimiEffort(w, c.thinkingLevel),
|
|
111
|
+
"kimi-for-coding": (w, c) => applyKimiEffort(w, c.thinkingLevel, "none"),
|
|
85
112
|
};
|