@eum-agent/llm-provider-kimi 0.0.0-stage → 1.2.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.
package/dist/index.js ADDED
@@ -0,0 +1,1328 @@
1
+ //#endregion
2
+ //#region src/catalog.ts
3
+ const catalog = {
4
+ vendors: [
5
+ {
6
+ kind: "vendor",
7
+ id: "moonshot-cn",
8
+ logo: "data:image/svg+xml,%3Csvg%20fill%3D%22currentColor%22%20fill-rule%3D%22evenodd%22%20height%3D%2224%22%20style%3D%22flex%3Anone%3Bline-height%3A1%22%20viewBox%3D%220%200%2024%2024%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ctitle%3EMoonshotAI%3C%2Ftitle%3E%3Cpath%20d%3D%22M1.052%2016.916l9.539%202.552a21.007%2021.007%200%2000.06%202.033l5.956%201.593a11.997%2011.997%200%2001-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605%2011.605%200%2001-.157-.02l-.107-.014-.11-.016a11.962%2011.962%200%2001-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293%206.293%200%2001-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655%205.655%200%2001-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49%206.49%200%2001-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785%207.785%200%2001-.054-.036l-.044-.03-.044-.03a6.066%206.066%200%2001-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516%207.516%200%2001-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28%2013.28%200%2001-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457%206.457%200%2001-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175%207.175%200%2001-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99%2011.99%200%2001-1.44-2.402zm-1.02-5.794l11.353%203.037a20.468%2020.468%200%2000-.469%202.011l10.817%202.894a12.076%2012.076%200%2001-1.845%202.005L.657%2015.923l-.016-.046-.035-.104a11.965%2011.965%200%2001-.05-.153l-.007-.023a11.896%2011.896%200%2001-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01%2012.01%200%2001-.019-.161l-.005-.047a12.12%2012.12%200%2001-.034-2.145zm1.593-5.15l11.948%203.196c-.368.605-.705%201.231-1.01%201.875l11.295%203.022c-.142.82-.368%201.612-.668%202.365l-11.55-3.09L.124%2010.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896%2011.896%200%20011.01-2.232zm4.442-4.4L17.352%204.59a20.77%2020.77%200%2000-1.688%201.721l7.823%202.093c.267.852.442%201.744.513%202.665L2.106%205.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084%2012.084%200%20012.272-1.677zM12.017%200h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6%201.353%201.283%201.909%202.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E",
9
+ name: "\u6708\u4e4b\u6697\u9762 Kimi",
10
+ region: "\u56fd\u5185",
11
+ market: "domestic",
12
+ catalogKey: "moonshotai-cn",
13
+ canListModels: true,
14
+ endpoints: [{
15
+ baseUrl: "https://api.moonshot.cn/v1",
16
+ thinkingSwitch: true,
17
+ alwaysThinking: ["kimi-k3"],
18
+ type: "kimi",
19
+ endpointId: "moonshot-cn",
20
+ protocolIds: [
21
+ "openai",
22
+ "openai-responses",
23
+ "anthropic"
24
+ ]
25
+ }]
26
+ },
27
+ {
28
+ kind: "vendor",
29
+ id: "moonshot",
30
+ logo: "data:image/svg+xml,%3Csvg%20fill%3D%22currentColor%22%20fill-rule%3D%22evenodd%22%20height%3D%2224%22%20style%3D%22flex%3Anone%3Bline-height%3A1%22%20viewBox%3D%220%200%2024%2024%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ctitle%3EMoonshotAI%3C%2Ftitle%3E%3Cpath%20d%3D%22M1.052%2016.916l9.539%202.552a21.007%2021.007%200%2000.06%202.033l5.956%201.593a11.997%2011.997%200%2001-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605%2011.605%200%2001-.157-.02l-.107-.014-.11-.016a11.962%2011.962%200%2001-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293%206.293%200%2001-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655%205.655%200%2001-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49%206.49%200%2001-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785%207.785%200%2001-.054-.036l-.044-.03-.044-.03a6.066%206.066%200%2001-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516%207.516%200%2001-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28%2013.28%200%2001-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457%206.457%200%2001-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175%207.175%200%2001-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99%2011.99%200%2001-1.44-2.402zm-1.02-5.794l11.353%203.037a20.468%2020.468%200%2000-.469%202.011l10.817%202.894a12.076%2012.076%200%2001-1.845%202.005L.657%2015.923l-.016-.046-.035-.104a11.965%2011.965%200%2001-.05-.153l-.007-.023a11.896%2011.896%200%2001-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01%2012.01%200%2001-.019-.161l-.005-.047a12.12%2012.12%200%2001-.034-2.145zm1.593-5.15l11.948%203.196c-.368.605-.705%201.231-1.01%201.875l11.295%203.022c-.142.82-.368%201.612-.668%202.365l-11.55-3.09L.124%2010.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896%2011.896%200%20011.01-2.232zm4.442-4.4L17.352%204.59a20.77%2020.77%200%2000-1.688%201.721l7.823%202.093c.267.852.442%201.744.513%202.665L2.106%205.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084%2012.084%200%20012.272-1.677zM12.017%200h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6%201.353%201.283%201.909%202.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E",
31
+ name: "\u6708\u4e4b\u6697\u9762 Kimi",
32
+ region: "\u56fd\u9645",
33
+ market: "international",
34
+ catalogKey: "moonshotai",
35
+ canListModels: true,
36
+ endpoints: [{
37
+ baseUrl: "https://api.moonshot.ai/v1",
38
+ thinkingSwitch: true,
39
+ alwaysThinking: ["kimi-k3"],
40
+ type: "kimi",
41
+ endpointId: "moonshot",
42
+ protocolIds: [
43
+ "openai",
44
+ "openai-responses",
45
+ "anthropic"
46
+ ]
47
+ }]
48
+ },
49
+ {
50
+ kind: "vendor",
51
+ id: "kimi-coding-cn",
52
+ logo: "data:image/svg+xml,%3Csvg%20height%3D%2224%22%20style%3D%22flex%3Anone%3Bline-height%3A1%22%20viewBox%3D%220%200%2024%2024%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ctitle%3EKimi%3C%2Ftitle%3E%3Cpath%20d%3D%22M21.846%200a1.923%201.923%200%20110%203.846H20.15a.226.226%200%2001-.227-.226V1.923C19.923.861%2020.784%200%2021.846%200z%22%20fill%3D%22%231783FF%22%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M11.065%2011.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164%200%2000-.117.051l-7.82%207.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103%200-.186.103-.186.23V19.77c0%20.128.083.23.186.23h2.69c.103%200%20.186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158%200%2001.205-.023l6.484%204.772a7.677%207.677%200%20003.453%201.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028%205.028%200%2001-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z%22%20fill%3D%22%23000%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E",
53
+ name: "Kimi For Coding",
54
+ region: "\u56fd\u5185",
55
+ market: "domestic",
56
+ catalogKey: "kimi-code-plan-cn",
57
+ canListModels: true,
58
+ endpoints: [{
59
+ baseUrl: "https://api.kimi.com/coding/v1",
60
+ thinkingSwitch: true,
61
+ type: "kimi",
62
+ endpointId: "kimi-coding-cn",
63
+ protocolIds: [
64
+ "openai",
65
+ "openai-responses",
66
+ "anthropic"
67
+ ]
68
+ }]
69
+ },
70
+ {
71
+ kind: "vendor",
72
+ id: "kimi-coding",
73
+ logo: "data:image/svg+xml,%3Csvg%20height%3D%2224%22%20style%3D%22flex%3Anone%3Bline-height%3A1%22%20viewBox%3D%220%200%2024%2024%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ctitle%3EKimi%3C%2Ftitle%3E%3Cpath%20d%3D%22M21.846%200a1.923%201.923%200%20110%203.846H20.15a.226.226%200%2001-.227-.226V1.923C19.923.861%2020.784%200%2021.846%200z%22%20fill%3D%22%231783FF%22%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M11.065%2011.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164%200%2000-.117.051l-7.82%207.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103%200-.186.103-.186.23V19.77c0%20.128.083.23.186.23h2.69c.103%200%20.186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158%200%2001.205-.023l6.484%204.772a7.677%207.677%200%20003.453%201.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028%205.028%200%2001-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z%22%20fill%3D%22%23000%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E",
74
+ name: "Kimi For Coding",
75
+ region: "\u56fd\u9645",
76
+ market: "international",
77
+ catalogKey: "kimi-code-plan-global",
78
+ canListModels: true,
79
+ endpoints: [{
80
+ baseUrl: "https://api.kimi.ai/coding/v1",
81
+ thinkingSwitch: true,
82
+ type: "kimi",
83
+ endpointId: "kimi-coding",
84
+ protocolIds: [
85
+ "openai",
86
+ "openai-responses",
87
+ "anthropic"
88
+ ]
89
+ }]
90
+ }
91
+ ],
92
+ snapshot: {
93
+ "moonshot-cn": {
94
+ "kimi-k3.1-pro-highspeed": {
95
+ "id": "kimi-k3.1-pro-highspeed",
96
+ "name": "Kimi K3.1 Pro Highspeed",
97
+ "family": "kimi-k3",
98
+ "reasoning": true,
99
+ "reasoning_options": [{
100
+ "type": "effort",
101
+ "values": [
102
+ "low",
103
+ "high",
104
+ "max"
105
+ ]
106
+ }],
107
+ "temperature": false,
108
+ "tool_call": true,
109
+ "attachment": true,
110
+ "modalities": {
111
+ "input": [
112
+ "text",
113
+ "image",
114
+ "video"
115
+ ],
116
+ "output": ["text"]
117
+ },
118
+ "limit": {
119
+ "context": 1048576,
120
+ "output": 1048576
121
+ },
122
+ "release_date": "2026-10-23"
123
+ },
124
+ "kimi-k2.6": {
125
+ "id": "kimi-k2.6",
126
+ "name": "Kimi K2.6",
127
+ "family": "kimi-k2",
128
+ "reasoning": true,
129
+ "reasoning_options": [{ "type": "toggle" }],
130
+ "temperature": false,
131
+ "tool_call": true,
132
+ "attachment": true,
133
+ "modalities": {
134
+ "input": [
135
+ "text",
136
+ "image",
137
+ "video"
138
+ ],
139
+ "output": ["text"]
140
+ },
141
+ "limit": {
142
+ "context": 262144,
143
+ "output": 262144
144
+ },
145
+ "release_date": "2026-04-20"
146
+ },
147
+ "kimi-k3.1-pro": {
148
+ "id": "kimi-k3.1-pro",
149
+ "name": "Kimi K3.1 Pro",
150
+ "family": "kimi-k3",
151
+ "reasoning": true,
152
+ "reasoning_options": [{
153
+ "type": "effort",
154
+ "values": [
155
+ "low",
156
+ "high",
157
+ "max"
158
+ ]
159
+ }],
160
+ "temperature": false,
161
+ "tool_call": true,
162
+ "attachment": true,
163
+ "modalities": {
164
+ "input": [
165
+ "text",
166
+ "image",
167
+ "video"
168
+ ],
169
+ "output": ["text"]
170
+ },
171
+ "limit": {
172
+ "context": 1048576,
173
+ "output": 1048576
174
+ },
175
+ "release_date": "2026-10-23"
176
+ },
177
+ "kimi-k3": {
178
+ "id": "kimi-k3",
179
+ "name": "Kimi K3",
180
+ "family": "kimi-k3",
181
+ "reasoning": true,
182
+ "reasoning_options": [{
183
+ "type": "effort",
184
+ "values": [
185
+ "low",
186
+ "high",
187
+ "max"
188
+ ]
189
+ }],
190
+ "temperature": false,
191
+ "tool_call": true,
192
+ "attachment": true,
193
+ "modalities": {
194
+ "input": [
195
+ "text",
196
+ "image",
197
+ "video"
198
+ ],
199
+ "output": ["text"]
200
+ },
201
+ "limit": {
202
+ "context": 1048576,
203
+ "output": 1048576
204
+ },
205
+ "release_date": "2026-07-16"
206
+ },
207
+ "kimi-k2.7-code-highspeed": {
208
+ "id": "kimi-k2.7-code-highspeed",
209
+ "name": "Kimi K2.7 Code HighSpeed",
210
+ "family": "kimi-k2",
211
+ "reasoning": true,
212
+ "reasoning_options": [],
213
+ "temperature": false,
214
+ "tool_call": true,
215
+ "attachment": true,
216
+ "modalities": {
217
+ "input": [
218
+ "text",
219
+ "image",
220
+ "video"
221
+ ],
222
+ "output": ["text"]
223
+ },
224
+ "limit": {
225
+ "context": 262144,
226
+ "output": 262144
227
+ },
228
+ "release_date": "2026-06-12"
229
+ },
230
+ "kimi-k2.7-code": {
231
+ "id": "kimi-k2.7-code",
232
+ "name": "Kimi K2.7 Code",
233
+ "family": "kimi-k2",
234
+ "reasoning": true,
235
+ "reasoning_options": [],
236
+ "temperature": false,
237
+ "tool_call": true,
238
+ "attachment": true,
239
+ "modalities": {
240
+ "input": [
241
+ "text",
242
+ "image",
243
+ "video"
244
+ ],
245
+ "output": ["text"]
246
+ },
247
+ "limit": {
248
+ "context": 262144,
249
+ "output": 262144
250
+ },
251
+ "release_date": "2026-06-12"
252
+ }
253
+ },
254
+ "moonshot": {
255
+ "kimi-k3.1-pro-highspeed": {
256
+ "id": "kimi-k3.1-pro-highspeed",
257
+ "name": "Kimi K3.1 Pro Highspeed",
258
+ "family": "kimi-k3",
259
+ "reasoning": true,
260
+ "reasoning_options": [{
261
+ "type": "effort",
262
+ "values": [
263
+ "low",
264
+ "high",
265
+ "max"
266
+ ]
267
+ }],
268
+ "temperature": false,
269
+ "tool_call": true,
270
+ "attachment": true,
271
+ "modalities": {
272
+ "input": [
273
+ "text",
274
+ "image",
275
+ "video"
276
+ ],
277
+ "output": ["text"]
278
+ },
279
+ "limit": {
280
+ "context": 1048576,
281
+ "output": 1048576
282
+ },
283
+ "release_date": "2026-10-23"
284
+ },
285
+ "kimi-k2.6": {
286
+ "id": "kimi-k2.6",
287
+ "name": "Kimi K2.6",
288
+ "family": "kimi-k2",
289
+ "reasoning": true,
290
+ "reasoning_options": [{ "type": "toggle" }],
291
+ "temperature": false,
292
+ "tool_call": true,
293
+ "attachment": true,
294
+ "modalities": {
295
+ "input": [
296
+ "text",
297
+ "image",
298
+ "video"
299
+ ],
300
+ "output": ["text"]
301
+ },
302
+ "limit": {
303
+ "context": 262144,
304
+ "output": 262144
305
+ },
306
+ "release_date": "2026-04-20"
307
+ },
308
+ "kimi-k3.1-pro": {
309
+ "id": "kimi-k3.1-pro",
310
+ "name": "Kimi K3.1 Pro",
311
+ "family": "kimi-k3",
312
+ "reasoning": true,
313
+ "reasoning_options": [{
314
+ "type": "effort",
315
+ "values": [
316
+ "low",
317
+ "high",
318
+ "max"
319
+ ]
320
+ }],
321
+ "temperature": false,
322
+ "tool_call": true,
323
+ "attachment": true,
324
+ "modalities": {
325
+ "input": [
326
+ "text",
327
+ "image",
328
+ "video"
329
+ ],
330
+ "output": ["text"]
331
+ },
332
+ "limit": {
333
+ "context": 1048576,
334
+ "output": 1048576
335
+ },
336
+ "release_date": "2026-10-23"
337
+ },
338
+ "kimi-k3": {
339
+ "id": "kimi-k3",
340
+ "name": "Kimi K3",
341
+ "family": "kimi-k3",
342
+ "reasoning": true,
343
+ "reasoning_options": [{
344
+ "type": "effort",
345
+ "values": [
346
+ "low",
347
+ "high",
348
+ "max"
349
+ ]
350
+ }],
351
+ "temperature": false,
352
+ "tool_call": true,
353
+ "attachment": true,
354
+ "modalities": {
355
+ "input": [
356
+ "text",
357
+ "image",
358
+ "video"
359
+ ],
360
+ "output": ["text"]
361
+ },
362
+ "limit": {
363
+ "context": 1048576,
364
+ "output": 1048576
365
+ },
366
+ "release_date": "2026-07-16"
367
+ },
368
+ "kimi-k2.7-code-highspeed": {
369
+ "id": "kimi-k2.7-code-highspeed",
370
+ "name": "Kimi K2.7 Code HighSpeed",
371
+ "family": "kimi-k2",
372
+ "reasoning": true,
373
+ "reasoning_options": [],
374
+ "temperature": false,
375
+ "tool_call": true,
376
+ "attachment": true,
377
+ "modalities": {
378
+ "input": [
379
+ "text",
380
+ "image",
381
+ "video"
382
+ ],
383
+ "output": ["text"]
384
+ },
385
+ "limit": {
386
+ "context": 262144,
387
+ "output": 262144
388
+ },
389
+ "release_date": "2026-06-12"
390
+ },
391
+ "kimi-k2.7-code": {
392
+ "id": "kimi-k2.7-code",
393
+ "name": "Kimi K2.7 Code",
394
+ "family": "kimi-k2",
395
+ "reasoning": true,
396
+ "reasoning_options": [],
397
+ "temperature": false,
398
+ "tool_call": true,
399
+ "attachment": true,
400
+ "modalities": {
401
+ "input": [
402
+ "text",
403
+ "image",
404
+ "video"
405
+ ],
406
+ "output": ["text"]
407
+ },
408
+ "limit": {
409
+ "context": 262144,
410
+ "output": 262144
411
+ },
412
+ "release_date": "2026-06-12"
413
+ }
414
+ },
415
+ "kimi-coding-cn": {
416
+ "k3": {
417
+ "id": "k3",
418
+ "name": "Kimi K3",
419
+ "family": "kimi-k3",
420
+ "reasoning": true,
421
+ "reasoning_options": [{
422
+ "type": "effort",
423
+ "values": [
424
+ "none",
425
+ "low",
426
+ "high",
427
+ "max"
428
+ ]
429
+ }],
430
+ "temperature": false,
431
+ "tool_call": true,
432
+ "attachment": true,
433
+ "modalities": {
434
+ "input": [
435
+ "text",
436
+ "image",
437
+ "video"
438
+ ],
439
+ "output": ["text"]
440
+ },
441
+ "limit": {
442
+ "context": 1048576,
443
+ "output": 1048576
444
+ },
445
+ "release_date": "2026-07-16"
446
+ },
447
+ "k3.1-pro-highspeed": {
448
+ "id": "k3.1-pro-highspeed",
449
+ "name": "Kimi K3.1 Pro Highspeed",
450
+ "family": "kimi-k3",
451
+ "reasoning": true,
452
+ "reasoning_options": [{
453
+ "type": "effort",
454
+ "values": [
455
+ "low",
456
+ "high",
457
+ "max"
458
+ ]
459
+ }],
460
+ "temperature": false,
461
+ "tool_call": true,
462
+ "attachment": true,
463
+ "modalities": {
464
+ "input": [
465
+ "text",
466
+ "image",
467
+ "video"
468
+ ],
469
+ "output": ["text"]
470
+ },
471
+ "limit": {
472
+ "context": 1048576,
473
+ "output": 1048576
474
+ },
475
+ "release_date": "2026-10-23"
476
+ },
477
+ "kimi-for-coding-highspeed": {
478
+ "id": "kimi-for-coding-highspeed",
479
+ "name": "Kimi For Coding HighSpeed",
480
+ "family": "kimi-k2",
481
+ "reasoning": true,
482
+ "reasoning_options": [],
483
+ "temperature": false,
484
+ "tool_call": true,
485
+ "attachment": true,
486
+ "modalities": {
487
+ "input": [
488
+ "text",
489
+ "image",
490
+ "video"
491
+ ],
492
+ "output": ["text"]
493
+ },
494
+ "limit": {
495
+ "context": 262144,
496
+ "output": 32768
497
+ },
498
+ "release_date": "2026-06-12"
499
+ },
500
+ "k3-256k": {
501
+ "id": "k3-256k",
502
+ "name": "Kimi K3-256K",
503
+ "family": "kimi-k3",
504
+ "reasoning": true,
505
+ "reasoning_options": [{
506
+ "type": "effort",
507
+ "values": [
508
+ "none",
509
+ "low",
510
+ "high",
511
+ "max"
512
+ ]
513
+ }],
514
+ "temperature": false,
515
+ "tool_call": true,
516
+ "attachment": true,
517
+ "modalities": {
518
+ "input": ["text", "image"],
519
+ "output": ["text"]
520
+ },
521
+ "limit": {
522
+ "context": 262144,
523
+ "output": 262144
524
+ },
525
+ "release_date": "2026-07-16"
526
+ },
527
+ "k3.1-pro": {
528
+ "id": "k3.1-pro",
529
+ "name": "Kimi K3.1 Pro",
530
+ "family": "kimi-k3",
531
+ "reasoning": true,
532
+ "reasoning_options": [{
533
+ "type": "effort",
534
+ "values": [
535
+ "low",
536
+ "high",
537
+ "max"
538
+ ]
539
+ }],
540
+ "temperature": false,
541
+ "tool_call": true,
542
+ "attachment": true,
543
+ "modalities": {
544
+ "input": [
545
+ "text",
546
+ "image",
547
+ "video"
548
+ ],
549
+ "output": ["text"]
550
+ },
551
+ "limit": {
552
+ "context": 1048576,
553
+ "output": 1048576
554
+ },
555
+ "release_date": "2026-10-23"
556
+ },
557
+ "kimi-for-coding": {
558
+ "id": "kimi-for-coding",
559
+ "name": "Kimi K2.8 Preview",
560
+ "family": "kimi-k2",
561
+ "reasoning": true,
562
+ "reasoning_options": [{
563
+ "type": "effort",
564
+ "values": [
565
+ "none",
566
+ "low",
567
+ "high",
568
+ "max"
569
+ ]
570
+ }],
571
+ "temperature": false,
572
+ "tool_call": true,
573
+ "attachment": true,
574
+ "modalities": {
575
+ "input": [
576
+ "text",
577
+ "image",
578
+ "video"
579
+ ],
580
+ "output": ["text"]
581
+ },
582
+ "limit": {
583
+ "context": 1048576,
584
+ "output": 32768
585
+ },
586
+ "release_date": "2026-09-11"
587
+ }
588
+ },
589
+ "kimi-coding": {
590
+ "k3": {
591
+ "id": "k3",
592
+ "name": "Kimi K3",
593
+ "family": "kimi-k3",
594
+ "reasoning": true,
595
+ "reasoning_options": [{
596
+ "type": "effort",
597
+ "values": [
598
+ "none",
599
+ "low",
600
+ "high",
601
+ "max"
602
+ ]
603
+ }],
604
+ "temperature": false,
605
+ "tool_call": true,
606
+ "attachment": true,
607
+ "modalities": {
608
+ "input": [
609
+ "text",
610
+ "image",
611
+ "video"
612
+ ],
613
+ "output": ["text"]
614
+ },
615
+ "limit": {
616
+ "context": 1048576,
617
+ "output": 1048576
618
+ },
619
+ "release_date": "2026-07-16"
620
+ },
621
+ "k3.1-pro-highspeed": {
622
+ "id": "k3.1-pro-highspeed",
623
+ "name": "Kimi K3.1 Pro Highspeed",
624
+ "family": "kimi-k3",
625
+ "reasoning": true,
626
+ "reasoning_options": [{
627
+ "type": "effort",
628
+ "values": [
629
+ "low",
630
+ "high",
631
+ "max"
632
+ ]
633
+ }],
634
+ "temperature": false,
635
+ "tool_call": true,
636
+ "attachment": true,
637
+ "modalities": {
638
+ "input": [
639
+ "text",
640
+ "image",
641
+ "video"
642
+ ],
643
+ "output": ["text"]
644
+ },
645
+ "limit": {
646
+ "context": 1048576,
647
+ "output": 1048576
648
+ },
649
+ "release_date": "2026-10-23"
650
+ },
651
+ "kimi-for-coding-highspeed": {
652
+ "id": "kimi-for-coding-highspeed",
653
+ "name": "Kimi For Coding HighSpeed",
654
+ "family": "kimi-k2",
655
+ "reasoning": true,
656
+ "reasoning_options": [],
657
+ "temperature": false,
658
+ "tool_call": true,
659
+ "attachment": true,
660
+ "modalities": {
661
+ "input": [
662
+ "text",
663
+ "image",
664
+ "video"
665
+ ],
666
+ "output": ["text"]
667
+ },
668
+ "limit": {
669
+ "context": 262144,
670
+ "output": 32768
671
+ },
672
+ "release_date": "2026-06-12"
673
+ },
674
+ "k3-256k": {
675
+ "id": "k3-256k",
676
+ "name": "Kimi K3-256K",
677
+ "family": "kimi-k3",
678
+ "reasoning": true,
679
+ "reasoning_options": [{
680
+ "type": "effort",
681
+ "values": [
682
+ "none",
683
+ "low",
684
+ "high",
685
+ "max"
686
+ ]
687
+ }],
688
+ "temperature": false,
689
+ "tool_call": true,
690
+ "attachment": true,
691
+ "modalities": {
692
+ "input": ["text", "image"],
693
+ "output": ["text"]
694
+ },
695
+ "limit": {
696
+ "context": 262144,
697
+ "output": 262144
698
+ },
699
+ "release_date": "2026-07-16"
700
+ },
701
+ "k3.1-pro": {
702
+ "id": "k3.1-pro",
703
+ "name": "Kimi K3.1 Pro",
704
+ "family": "kimi-k3",
705
+ "reasoning": true,
706
+ "reasoning_options": [{
707
+ "type": "effort",
708
+ "values": [
709
+ "low",
710
+ "high",
711
+ "max"
712
+ ]
713
+ }],
714
+ "temperature": false,
715
+ "tool_call": true,
716
+ "attachment": true,
717
+ "modalities": {
718
+ "input": [
719
+ "text",
720
+ "image",
721
+ "video"
722
+ ],
723
+ "output": ["text"]
724
+ },
725
+ "limit": {
726
+ "context": 1048576,
727
+ "output": 1048576
728
+ },
729
+ "release_date": "2026-10-23"
730
+ },
731
+ "kimi-for-coding": {
732
+ "id": "kimi-for-coding",
733
+ "name": "kimi-for-coding",
734
+ "family": "kimi-k2",
735
+ "reasoning": true,
736
+ "reasoning_options": [{
737
+ "type": "effort",
738
+ "values": [
739
+ "none",
740
+ "low",
741
+ "high",
742
+ "max"
743
+ ]
744
+ }],
745
+ "temperature": false,
746
+ "tool_call": true,
747
+ "attachment": true,
748
+ "modalities": {
749
+ "input": [
750
+ "text",
751
+ "image",
752
+ "video"
753
+ ],
754
+ "output": ["text"]
755
+ },
756
+ "limit": {
757
+ "context": 1048576,
758
+ "output": 32768
759
+ },
760
+ "release_date": "2026-09-11"
761
+ }
762
+ }
763
+ },
764
+ snapshotAt: Date.parse("2026-11-18")
765
+ };
766
+ //#endregion
767
+ //#region src/facts.ts
768
+ const verifiedAt = "2026-10-29";
769
+ const apiEndpoints = ["moonshot-cn", "moonshot"];
770
+ const codingEndpoints = ["kimi-coding-cn", "kimi-coding"];
771
+ const k3Models = [
772
+ "kimi-k3",
773
+ "kimi-k3.1-pro",
774
+ "kimi-k3.1-pro-highspeed"
775
+ ];
776
+ const modelsOverview = "https://platform.kimi.ai/docs/api/models-overview";
777
+ const codingModels = "https://www.kimi.com/code/docs/en/kimi-code/models.html";
778
+ const outputLimit = {
779
+ ordinary: 131072,
780
+ thinking: 131072
781
+ };
782
+ function withheld(scope, corrects, source) {
783
+ return {
784
+ ...scope,
785
+ field: "limit.output",
786
+ value: { unknown: true },
787
+ corrects,
788
+ source,
789
+ verifiedAt
790
+ };
791
+ }
792
+ function codingFloor(endpointId, model, field) {
793
+ return field === "limit.context" ? {
794
+ endpointId,
795
+ model,
796
+ field,
797
+ value: 262144,
798
+ corrects: { structural: "Kimi Code plans share a 262144 floor; 1048576 needs a higher plan" },
799
+ source: codingModels,
800
+ verifiedAt
801
+ } : withheld({
802
+ endpointId,
803
+ model
804
+ }, { structural: "Kimi Code publishes no output maximum for plan models" }, codingModels);
805
+ }
806
+ const modelFacts = {
807
+ revisions: [
808
+ ...apiEndpoints.flatMap((endpointId) => [
809
+ "kimi-k2.7-code",
810
+ "kimi-k2.7-code-highspeed",
811
+ "kimi-k2.6"
812
+ ].map((model) => withheld({
813
+ endpointId,
814
+ model
815
+ }, { catalogue: 262144 }, modelsOverview))),
816
+ ...codingEndpoints.flatMap((endpointId) => [
817
+ codingFloor(endpointId, "k3.1-pro", "limit.context"),
818
+ codingFloor(endpointId, "k3", "limit.context"),
819
+ ...[
820
+ "k3.1-pro",
821
+ "k3.1-pro-highspeed",
822
+ "k3",
823
+ "k3-256k",
824
+ "kimi-for-coding",
825
+ "kimi-for-coding-highspeed"
826
+ ].map((model) => codingFloor(endpointId, model, "limit.output"))
827
+ ]),
828
+ ...apiEndpoints.flatMap((endpointId) => k3Models.flatMap((model) => ["openai-responses", "anthropic"].map((protocolId) => withheld({
829
+ endpointId,
830
+ protocolId,
831
+ model
832
+ }, { structural: "Kimi documents the K3 output maximum only for Chat Completions" }, modelsOverview))))
833
+ ],
834
+ presets: k3Models.map((model) => ({
835
+ model,
836
+ entry: { outputLimit }
837
+ }))
838
+ };
839
+ //#endregion
840
+ //#region src/resources.ts
841
+ function failure(detail) {
842
+ const code = detail === "Resource request failed" ? "source-failed" : "invalid-response";
843
+ return Object.assign(new Error(code), {
844
+ name: "ProviderResourceFailure",
845
+ code,
846
+ retryable: false
847
+ });
848
+ }
849
+ const labels = (en, zh) => ({
850
+ "en-US": en,
851
+ "zh-CN": zh
852
+ });
853
+ function object(value) {
854
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw failure("Invalid resource response");
855
+ return value;
856
+ }
857
+ function decimal(value) {
858
+ const text = typeof value === "number" && Number.isFinite(value) ? String(value) : value;
859
+ if (typeof text !== "string" || !/^-?(0|[1-9]\d*)(\.\d+)?$/.test(text)) throw failure("Invalid resource amount");
860
+ const normalized = text.includes(".") ? text.replace(/0+$/, "").replace(/\.$/, "") : text;
861
+ return normalized === "-0" ? "0" : normalized;
862
+ }
863
+ function scaled(value, digits) {
864
+ const text = decimal(value);
865
+ if (!/^\d+$/.test(text) || typeof value === "number" && !Number.isSafeInteger(value)) throw failure("Invalid fixed point amount");
866
+ const padded = text.padStart(digits + 1, "0");
867
+ return `${padded.slice(0, -digits)}.${padded.slice(-digits)}`.replace(/\.?0+$/, "");
868
+ }
869
+ function resourceCapability(endpointId) {
870
+ const domestic = endpointId.endsWith("-cn");
871
+ const coding = endpointId.startsWith("kimi-coding");
872
+ const origin = coding ? domestic ? "https://api.kimi.com" : "https://api.kimi.ai" : domestic ? "https://api.moonshot.cn" : "https://api.moonshot.ai";
873
+ const base = `${origin}/${coding ? "coding/v1" : "v1"}`;
874
+ const id = coding ? "usages" : "balance";
875
+ return {
876
+ support: "supported",
877
+ applicability: {
878
+ kind: "base-url",
879
+ defaultBaseUrl: base,
880
+ allowedBaseUrls: coding ? [base] : [base, `${origin}/anthropic/v1`]
881
+ },
882
+ sources: [{
883
+ id,
884
+ labels: labels("Account resources", "\u8d26\u6237\u8d44\u6e90"),
885
+ optional: false,
886
+ allowedHeaderNames: ["Authorization"],
887
+ requests: [{
888
+ id,
889
+ method: "GET",
890
+ url: coding ? `${base}/usages` : `${base}/users/me/balance`
891
+ }]
892
+ }],
893
+ presets: coding ? [{
894
+ id: "subscription",
895
+ labels: labels("Subscription", "\u8ba2\u9605\u989d\u5ea6"),
896
+ sourceId: id,
897
+ order: 0,
898
+ recommended: true,
899
+ format: "quota-windows",
900
+ match: { group: "subscription-windows" }
901
+ }, {
902
+ id: "extra-usage",
903
+ labels: labels("Extra usage", "\u989d\u5916\u7528\u91cf"),
904
+ sourceId: id,
905
+ order: 1,
906
+ recommended: false,
907
+ format: "amount",
908
+ match: { resourceIds: ["extra-usage"] }
909
+ }] : [{
910
+ id: "available-balance",
911
+ labels: labels("Available balance", "\u53ef\u7528\u4f59\u989d"),
912
+ sourceId: id,
913
+ order: 0,
914
+ recommended: true,
915
+ format: "amount",
916
+ match: { group: "available-balance" }
917
+ }]
918
+ };
919
+ }
920
+ async function readResourceSource(input) {
921
+ if (![
922
+ "moonshot-cn",
923
+ "moonshot",
924
+ "kimi-coding-cn",
925
+ "kimi-coding"
926
+ ].includes(input.endpointId)) throw failure("Invalid resource endpoint");
927
+ const coding = input.endpointId.startsWith("kimi-coding");
928
+ const requestId = coding ? "usages" : "balance";
929
+ if (input.sourceId !== requestId) throw failure("Invalid resource source");
930
+ if (!input.secrets.apiKey) return {
931
+ kind: "unavailable",
932
+ reason: "auth-required"
933
+ };
934
+ const response = await input.queryJSON({
935
+ requestId,
936
+ headers: { Authorization: `Bearer ${input.secrets.apiKey}` }
937
+ });
938
+ if (response.status === 401) return {
939
+ kind: "unavailable",
940
+ reason: "auth-required"
941
+ };
942
+ if (response.status === 403) return {
943
+ kind: "unavailable",
944
+ reason: "permission-denied"
945
+ };
946
+ if (response.status !== 200) throw failure("Resource request failed");
947
+ return coding ? usages(object(response.body)) : moonshot(object(response.body), input.endpointId === "moonshot-cn");
948
+ }
949
+ function moonshot(body, domestic) {
950
+ if (body.code !== 0) throw failure("Resource request failed");
951
+ const data = object(body.data);
952
+ if (!("available_balance" in data)) throw failure("Invalid resource response");
953
+ const resources = [];
954
+ const unit = domestic ? {
955
+ kind: "currency",
956
+ code: "CNY"
957
+ } : {
958
+ kind: "unknown",
959
+ label: "Unverified international currency"
960
+ };
961
+ for (const [field, id, en, zh] of [
962
+ [
963
+ "available_balance",
964
+ "available-balance",
965
+ "Available balance",
966
+ "\u53ef\u7528\u4f59\u989d"
967
+ ],
968
+ [
969
+ "cash_balance",
970
+ "cash-balance",
971
+ "Cash balance",
972
+ "\u73b0\u91d1\u4f59\u989d"
973
+ ],
974
+ [
975
+ "voucher_balance",
976
+ "voucher-balance",
977
+ "Voucher balance",
978
+ "\u4ee3\u91d1\u5238\u4f59\u989d"
979
+ ]
980
+ ]) {
981
+ if (data[field] === void 0) continue;
982
+ const value = decimal(data[field]);
983
+ if (field === "voucher_balance" && value.startsWith("-")) throw failure("Invalid voucher balance");
984
+ resources.push({
985
+ kind: "balance",
986
+ id,
987
+ group: id === "available-balance" ? "available-balance" : "balance-components",
988
+ labels: labels(en, zh),
989
+ meaning: Number(value) <= 0 ? "exhausted" : "available",
990
+ valueOrigin: "reported",
991
+ remaining: {
992
+ value,
993
+ unit
994
+ },
995
+ ...id !== "available-balance" ? { relationships: [{
996
+ kind: "part-of",
997
+ resourceId: "available-balance"
998
+ }] } : {}
999
+ });
1000
+ }
1001
+ return {
1002
+ kind: "ready",
1003
+ resources
1004
+ };
1005
+ }
1006
+ function legacy(body) {
1007
+ if (body.usage === void 0 && !Array.isArray(body.limits)) throw failure("Invalid resource response");
1008
+ const resources = [];
1009
+ const rows = [...body.usage === void 0 ? [] : [{
1010
+ id: "legacy-usage",
1011
+ row: object(body.usage)
1012
+ }], ...Array.isArray(body.limits) ? body.limits.map((value, index) => ({
1013
+ id: `legacy-limit-${index}`,
1014
+ row: object(object(value).detail)
1015
+ })) : []];
1016
+ for (const { id, row } of rows) {
1017
+ const unit = {
1018
+ kind: "unknown",
1019
+ label: "Provider quota units"
1020
+ };
1021
+ const reset = typeof row.resetTime === "string" ? Date.parse(row.resetTime) : NaN;
1022
+ resources.push({
1023
+ kind: "quota",
1024
+ id,
1025
+ group: "subscription-windows",
1026
+ labels: labels("Subscription quota", "\u8ba2\u9605\u989d\u5ea6"),
1027
+ valueOrigin: "reported",
1028
+ meaning: row.remaining === void 0 ? "unknown" : Number(decimal(row.remaining)) <= 0 ? "exhausted" : "available",
1029
+ window: { reset: Number.isFinite(reset) ? {
1030
+ kind: "fixed",
1031
+ at: new Date(reset).toISOString()
1032
+ } : { kind: "unknown" } },
1033
+ ...row.limit !== void 0 ? { limit: {
1034
+ value: decimal(row.limit),
1035
+ unit
1036
+ } } : {},
1037
+ ...row.used !== void 0 ? { used: {
1038
+ value: decimal(row.used),
1039
+ unit
1040
+ } } : {},
1041
+ ...row.remaining !== void 0 ? { remaining: {
1042
+ value: decimal(row.remaining),
1043
+ unit
1044
+ } } : {}
1045
+ });
1046
+ }
1047
+ return {
1048
+ kind: "ready",
1049
+ resources
1050
+ };
1051
+ }
1052
+ function usages(body) {
1053
+ if (body.usages === void 0) return legacy(body);
1054
+ const usage = object(body.usages);
1055
+ const resources = [];
1056
+ for (const [field, id, duration, en, zh] of [
1057
+ [
1058
+ "limit_5h",
1059
+ "limit-5h",
1060
+ 18e3,
1061
+ "Five-hour quota",
1062
+ "\u4e94\u5c0f\u65f6\u989d\u5ea6"
1063
+ ],
1064
+ [
1065
+ "limit_7d",
1066
+ "limit-7d",
1067
+ 604800,
1068
+ "Weekly quota",
1069
+ "\u5468\u989d\u5ea6"
1070
+ ],
1071
+ [
1072
+ "limit_month_total",
1073
+ "month-total",
1074
+ void 0,
1075
+ "Monthly total",
1076
+ "\u6708\u5ea6\u603b\u989d\u5ea6"
1077
+ ],
1078
+ [
1079
+ "limit_month_code",
1080
+ "month-code",
1081
+ void 0,
1082
+ "Monthly Code share",
1083
+ "\u6708\u5ea6 Code \u4efd\u989d"
1084
+ ]
1085
+ ]) {
1086
+ if (usage[field] == null) continue;
1087
+ const row = object(usage[field]);
1088
+ const ratio = row.used_ratio === void 0 ? void 0 : Number(decimal(row.used_ratio));
1089
+ if (ratio !== void 0 && (!Number.isFinite(ratio) || ratio < 0 || ratio > 1)) throw failure("Invalid resource ratio");
1090
+ const reset = typeof row.reset_time === "string" ? Date.parse(row.reset_time) : NaN;
1091
+ resources.push({
1092
+ kind: "quota",
1093
+ id,
1094
+ group: "subscription-windows",
1095
+ labels: labels(en, zh),
1096
+ meaning: ratio === void 0 ? "unknown" : ratio === 1 ? "exhausted" : "available",
1097
+ valueOrigin: "reported",
1098
+ window: {
1099
+ ...duration ? { durationSeconds: duration } : {},
1100
+ reset: Number.isFinite(reset) ? {
1101
+ kind: "fixed",
1102
+ at: new Date(reset).toISOString()
1103
+ } : { kind: "unknown" }
1104
+ },
1105
+ ...ratio !== void 0 ? { usedPercent: ratio * 100 } : {},
1106
+ ...id !== "month-total" && usage.limit_month_total != null ? { relationships: [{
1107
+ kind: id === "month-code" ? "part-of" : "limited-by",
1108
+ resourceId: "month-total"
1109
+ }] } : {}
1110
+ });
1111
+ }
1112
+ const restrictions = [];
1113
+ if (body.boosterWallet != null) {
1114
+ const wallet = object(body.boosterWallet);
1115
+ const balance = wallet.balance == null ? {} : object(wallet.balance);
1116
+ if (balance.type === "BOOSTER") {
1117
+ const limit = wallet.monthlyChargeLimit == null ? {} : object(wallet.monthlyChargeLimit);
1118
+ const used = wallet.monthlyUsed == null ? {} : object(wallet.monthlyUsed);
1119
+ const currency = limit.currency ?? used.currency;
1120
+ const unit = typeof currency === "string" && /^[A-Z]{3}$/.test(currency) ? {
1121
+ kind: "currency",
1122
+ code: currency
1123
+ } : {
1124
+ kind: "unknown",
1125
+ label: "Unverified wallet currency"
1126
+ };
1127
+ if (balance.amountLeft !== void 0) resources.push({
1128
+ kind: "balance",
1129
+ id: "extra-usage",
1130
+ group: "extra-usage",
1131
+ labels: labels("Extra usage", "\u989d\u5916\u7528\u91cf"),
1132
+ meaning: decimal(balance.amountLeft) === "0" ? "exhausted" : "available",
1133
+ valueOrigin: "reported",
1134
+ remaining: {
1135
+ value: scaled(balance.amountLeft, 8),
1136
+ unit
1137
+ },
1138
+ ...balance.amount !== void 0 ? { total: {
1139
+ value: scaled(balance.amount, 8),
1140
+ unit
1141
+ } } : {},
1142
+ relationships: [{
1143
+ kind: "overflow-for",
1144
+ resourceId: "month-total",
1145
+ ...usage.limit_month_total == null ? { unavailable: true } : {}
1146
+ }]
1147
+ });
1148
+ if (typeof wallet.monthlyChargeLimitEnabled === "boolean" && limit.priceInCents !== void 0 && used.priceInCents !== void 0) restrictions.push({
1149
+ id: "extra-usage-monthly-limit",
1150
+ labels: labels("Extra usage monthly spending limit reached", "\u989d\u5916\u7528\u91cf\u5df2\u8fbe\u6708\u6d88\u8d39\u4e0a\u9650"),
1151
+ active: wallet.monthlyChargeLimitEnabled && Number(decimal(used.priceInCents)) >= Number(decimal(limit.priceInCents))
1152
+ });
1153
+ }
1154
+ }
1155
+ return {
1156
+ kind: "ready",
1157
+ resources,
1158
+ restrictions
1159
+ };
1160
+ }
1161
+ //#endregion
1162
+ //#region src/routing.ts
1163
+ function connectionConfig(endpoint, protocolId, config, aliases = []) {
1164
+ const defaults = Object.values(endpoint.capabilities).find((one) => one.protocolIds.includes(protocolId))?.protocolDefaults?.[protocolId] ?? {};
1165
+ const configured = config.baseUrl;
1166
+ const canonical = [
1167
+ endpoint.defaults?.baseUrl,
1168
+ ...Object.values(endpoint.capabilities).flatMap((one) => Object.values(one.protocolDefaults ?? {}).map((value) => value.baseUrl)),
1169
+ ...aliases
1170
+ ].filter((value) => typeof value === "string");
1171
+ const isOfficial = configured === void 0 || typeof configured === "string" && canonical.some((value) => value.replace(/\/+$/, "") === configured.replace(/\/+$/, ""));
1172
+ const selected = defaults.baseUrl ?? endpoint.defaults?.baseUrl;
1173
+ return {
1174
+ ...endpoint.defaults,
1175
+ ...defaults,
1176
+ ...config,
1177
+ ...isOfficial && selected !== void 0 ? { baseUrl: selected } : {}
1178
+ };
1179
+ }
1180
+ //#endregion
1181
+ //#region src/type.ts
1182
+ const TYPE = "kimi";
1183
+ const endpoints = [
1184
+ {
1185
+ id: "moonshot-cn",
1186
+ label: "\u6708\u4e4b\u6697\u9762 Kimi \u00b7 \u56fd\u5185",
1187
+ capabilities: { chat: {
1188
+ protocolIds: [
1189
+ "openai",
1190
+ "openai-responses",
1191
+ "anthropic"
1192
+ ],
1193
+ defaultProtocolId: "openai-responses",
1194
+ protocolDefaults: { anthropic: { baseUrl: "https://api.moonshot.cn/anthropic/v1" } },
1195
+ listingVia: {
1196
+ endpointId: "moonshot-cn",
1197
+ protocolId: "openai"
1198
+ }
1199
+ } },
1200
+ defaults: { baseUrl: "https://api.moonshot.cn/v1" },
1201
+ credentialGroup: "kimi"
1202
+ },
1203
+ {
1204
+ id: "moonshot",
1205
+ label: "\u6708\u4e4b\u6697\u9762 Kimi \u00b7 \u56fd\u9645",
1206
+ capabilities: { chat: {
1207
+ protocolIds: [
1208
+ "openai",
1209
+ "openai-responses",
1210
+ "anthropic"
1211
+ ],
1212
+ defaultProtocolId: "openai",
1213
+ protocolDefaults: { anthropic: { baseUrl: "https://api.moonshot.ai/anthropic/v1" } },
1214
+ listingVia: {
1215
+ endpointId: "moonshot",
1216
+ protocolId: "openai"
1217
+ }
1218
+ } },
1219
+ defaults: { baseUrl: "https://api.moonshot.ai/v1" },
1220
+ credentialGroup: "kimi"
1221
+ },
1222
+ {
1223
+ id: "kimi-coding-cn",
1224
+ label: "Kimi For Coding \u00b7 \u56fd\u5185",
1225
+ capabilities: { chat: {
1226
+ protocolIds: [
1227
+ "openai",
1228
+ "openai-responses",
1229
+ "anthropic"
1230
+ ],
1231
+ defaultProtocolId: "openai",
1232
+ protocolDefaults: { anthropic: { baseUrl: "https://api.kimi.com/coding/v1" } },
1233
+ listingVia: {
1234
+ endpointId: "kimi-coding-cn",
1235
+ protocolId: "openai"
1236
+ }
1237
+ } },
1238
+ defaults: { baseUrl: "https://api.kimi.com/coding/v1" },
1239
+ credentialGroup: "kimi"
1240
+ },
1241
+ {
1242
+ id: "kimi-coding",
1243
+ label: "Kimi For Coding \u00b7 \u56fd\u9645",
1244
+ capabilities: { chat: {
1245
+ protocolIds: [
1246
+ "openai",
1247
+ "openai-responses",
1248
+ "anthropic"
1249
+ ],
1250
+ defaultProtocolId: "openai",
1251
+ protocolDefaults: { anthropic: { baseUrl: "https://api.kimi.ai/coding/v1" } },
1252
+ listingVia: {
1253
+ endpointId: "kimi-coding",
1254
+ protocolId: "openai"
1255
+ }
1256
+ } },
1257
+ defaults: { baseUrl: "https://api.kimi.ai/coding/v1" },
1258
+ credentialGroup: "kimi"
1259
+ }
1260
+ ];
1261
+ const protocolOptions = {
1262
+ openai: {
1263
+ thinkingField: true,
1264
+ reasoningReplay: "reasoning-content"
1265
+ },
1266
+ "openai-responses": {
1267
+ toolChoiceNone: false,
1268
+ reasoningReplay: "reasoning-content",
1269
+ encryptedReasoningInclude: false,
1270
+ effortCache: false,
1271
+ promptCacheKey: true
1272
+ },
1273
+ anthropic: {
1274
+ reasoningReplay: "signed-thinking",
1275
+ effortCache: false,
1276
+ cacheBreakpoints: false,
1277
+ thinkingEffort: true,
1278
+ thinkingBeta: false,
1279
+ thinkingMode: "omit"
1280
+ }
1281
+ };
1282
+ function kimiProviderType(support) {
1283
+ return {
1284
+ type: TYPE,
1285
+ listingContractVersion: "capacity-listing-v1",
1286
+ modelFacts,
1287
+ label: "Kimi",
1288
+ fields: [{
1289
+ key: "apiKey",
1290
+ kind: "secret",
1291
+ label: "API Key",
1292
+ required: true
1293
+ }],
1294
+ endpoints: endpoints.map((endpoint) => ({
1295
+ ...endpoint,
1296
+ resourceCapability: resourceCapability(endpoint.id)
1297
+ })),
1298
+ readResourceSource,
1299
+ catalog: support ? {
1300
+ ...catalog,
1301
+ source: support.catalogueSource("https://models.dev/api.json", "models")
1302
+ } : catalog,
1303
+ prepareConnection(input) {
1304
+ const endpoint = endpoints.find((one) => one.id === input.endpointId);
1305
+ if (!endpoint || !Object.values(endpoint.capabilities).some((one) => one.protocolIds.includes(input.protocolId))) throw new Error("unsupported supplier endpoint or protocol");
1306
+ return {
1307
+ config: connectionConfig(endpoint, input.protocolId, input.config),
1308
+ options: {
1309
+ ...protocolOptions[input.protocolId],
1310
+ ...input.protocolId === "openai" && input.endpointId.startsWith("moonshot") ? { outputLimitField: "max_completion_tokens" } : {}
1311
+ }
1312
+ };
1313
+ }
1314
+ };
1315
+ }
1316
+ //#endregion
1317
+ //#region src/index.ts
1318
+ const TOOL_NAMES = [];
1319
+ const plugin = {
1320
+ name: "@eum-agent/llm-provider-kimi",
1321
+ requires: ["model-catalogue-sources"],
1322
+ apply(ctx) {
1323
+ const support = ctx.services.get("model-catalogue-sources");
1324
+ ctx.modelProviders.register(kimiProviderType(support));
1325
+ }
1326
+ };
1327
+ //#endregion
1328
+ export { TOOL_NAMES, plugin as default };