@prismshadow/mmsp 0.5.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.
Files changed (116) hide show
  1. package/README.md +121 -0
  2. package/dist/ant_messages/client.d.ts +59 -0
  3. package/dist/ant_messages/client.d.ts.map +1 -0
  4. package/dist/ant_messages/client.js +419 -0
  5. package/dist/ant_messages/index.d.ts +2 -0
  6. package/dist/ant_messages/index.d.ts.map +1 -0
  7. package/dist/ant_messages/index.js +18 -0
  8. package/dist/anthropic_official/client.d.ts +63 -0
  9. package/dist/anthropic_official/client.d.ts.map +1 -0
  10. package/dist/anthropic_official/client.js +540 -0
  11. package/dist/anthropic_official/index.d.ts +2 -0
  12. package/dist/anthropic_official/index.d.ts.map +1 -0
  13. package/dist/anthropic_official/index.js +18 -0
  14. package/dist/autoClient.d.ts +96 -0
  15. package/dist/autoClient.d.ts.map +1 -0
  16. package/dist/autoClient.js +258 -0
  17. package/dist/baseClient.d.ts +111 -0
  18. package/dist/baseClient.d.ts.map +1 -0
  19. package/dist/baseClient.js +284 -0
  20. package/dist/deepseek_official/client.d.ts +60 -0
  21. package/dist/deepseek_official/client.d.ts.map +1 -0
  22. package/dist/deepseek_official/client.js +407 -0
  23. package/dist/deepseek_official/index.d.ts +2 -0
  24. package/dist/deepseek_official/index.d.ts.map +1 -0
  25. package/dist/deepseek_official/index.js +18 -0
  26. package/dist/errors.d.ts +84 -0
  27. package/dist/errors.d.ts.map +1 -0
  28. package/dist/errors.js +140 -0
  29. package/dist/gemini_generate_content/client.d.ts +86 -0
  30. package/dist/gemini_generate_content/client.d.ts.map +1 -0
  31. package/dist/gemini_generate_content/client.js +809 -0
  32. package/dist/gemini_generate_content/index.d.ts +2 -0
  33. package/dist/gemini_generate_content/index.d.ts.map +1 -0
  34. package/dist/gemini_generate_content/index.js +18 -0
  35. package/dist/gemini_official/client.d.ts +87 -0
  36. package/dist/gemini_official/client.d.ts.map +1 -0
  37. package/dist/gemini_official/client.js +780 -0
  38. package/dist/gemini_official/index.d.ts +2 -0
  39. package/dist/gemini_official/index.d.ts.map +1 -0
  40. package/dist/gemini_official/index.js +18 -0
  41. package/dist/index.d.ts +6 -0
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +44 -0
  44. package/dist/integration/index.d.ts +1 -0
  45. package/dist/integration/index.d.ts.map +1 -0
  46. package/dist/integration/index.js +14 -0
  47. package/dist/integration/playground.d.ts +17 -0
  48. package/dist/integration/playground.d.ts.map +1 -0
  49. package/dist/integration/playground.js +3246 -0
  50. package/dist/integration/tracer.d.ts +188 -0
  51. package/dist/integration/tracer.d.ts.map +1 -0
  52. package/dist/integration/tracer.js +1928 -0
  53. package/dist/legacy.d.ts +13 -0
  54. package/dist/legacy.d.ts.map +1 -0
  55. package/dist/legacy.js +59 -0
  56. package/dist/minimax_official/client.d.ts +43 -0
  57. package/dist/minimax_official/client.d.ts.map +1 -0
  58. package/dist/minimax_official/client.js +346 -0
  59. package/dist/minimax_official/index.d.ts +2 -0
  60. package/dist/minimax_official/index.d.ts.map +1 -0
  61. package/dist/minimax_official/index.js +18 -0
  62. package/dist/moonshot_official/client.d.ts +73 -0
  63. package/dist/moonshot_official/client.d.ts.map +1 -0
  64. package/dist/moonshot_official/client.js +477 -0
  65. package/dist/moonshot_official/index.d.ts +2 -0
  66. package/dist/moonshot_official/index.d.ts.map +1 -0
  67. package/dist/moonshot_official/index.js +18 -0
  68. package/dist/openai_chat/client.d.ts +67 -0
  69. package/dist/openai_chat/client.d.ts.map +1 -0
  70. package/dist/openai_chat/client.js +419 -0
  71. package/dist/openai_chat/index.d.ts +2 -0
  72. package/dist/openai_chat/index.d.ts.map +1 -0
  73. package/dist/openai_chat/index.js +18 -0
  74. package/dist/openai_chat_vllm_adapter/client.d.ts +15 -0
  75. package/dist/openai_chat_vllm_adapter/client.d.ts.map +1 -0
  76. package/dist/openai_chat_vllm_adapter/client.js +118 -0
  77. package/dist/openai_chat_vllm_adapter/index.d.ts +2 -0
  78. package/dist/openai_chat_vllm_adapter/index.d.ts.map +1 -0
  79. package/dist/openai_chat_vllm_adapter/index.js +5 -0
  80. package/dist/openai_embedding/client.d.ts +46 -0
  81. package/dist/openai_embedding/client.d.ts.map +1 -0
  82. package/dist/openai_embedding/client.js +124 -0
  83. package/dist/openai_embedding/index.d.ts +2 -0
  84. package/dist/openai_embedding/index.d.ts.map +1 -0
  85. package/dist/openai_embedding/index.js +18 -0
  86. package/dist/openai_official/client.d.ts +61 -0
  87. package/dist/openai_official/client.d.ts.map +1 -0
  88. package/dist/openai_official/client.js +464 -0
  89. package/dist/openai_official/index.d.ts +2 -0
  90. package/dist/openai_official/index.d.ts.map +1 -0
  91. package/dist/openai_official/index.js +18 -0
  92. package/dist/openai_responses/client.d.ts +61 -0
  93. package/dist/openai_responses/client.d.ts.map +1 -0
  94. package/dist/openai_responses/client.js +449 -0
  95. package/dist/openai_responses/index.d.ts +2 -0
  96. package/dist/openai_responses/index.d.ts.map +1 -0
  97. package/dist/openai_responses/index.js +18 -0
  98. package/dist/registry.d.ts +49 -0
  99. package/dist/registry.d.ts.map +1 -0
  100. package/dist/registry.js +798 -0
  101. package/dist/streamItems.d.ts +36 -0
  102. package/dist/streamItems.d.ts.map +1 -0
  103. package/dist/streamItems.js +183 -0
  104. package/dist/types.d.ts +190 -0
  105. package/dist/types.d.ts.map +1 -0
  106. package/dist/types.js +37 -0
  107. package/dist/utils.d.ts +99 -0
  108. package/dist/utils.d.ts.map +1 -0
  109. package/dist/utils.js +312 -0
  110. package/dist/zai_official/client.d.ts +78 -0
  111. package/dist/zai_official/client.d.ts.map +1 -0
  112. package/dist/zai_official/client.js +420 -0
  113. package/dist/zai_official/index.d.ts +2 -0
  114. package/dist/zai_official/index.d.ts.map +1 -0
  115. package/dist/zai_official/index.js +18 -0
  116. package/package.json +68 -0
@@ -0,0 +1,798 @@
1
+ "use strict";
2
+ // Copyright 2025 Prism Shadow. and/or its affiliates
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.listSupportedModels = listSupportedModels;
17
+ const GOOGLE = "https://generativelanguage.googleapis.com";
18
+ const ANTHROPIC = "https://api.anthropic.com";
19
+ const OPENAI = "https://api.openai.com/v1";
20
+ const ZAI = "https://api.z.ai/api/paas/v4/";
21
+ const MOONSHOT = "https://api.moonshot.cn/v1";
22
+ const DEEPSEEK = "https://api.deepseek.com";
23
+ const OPENROUTER = "https://openrouter.ai/api/v1";
24
+ const SILICONFLOW = "https://api.siliconflow.cn/v1";
25
+ const MINIMAX = "https://api.minimax.io/v1";
26
+ // Display convention shared with the MMSP apps: prices are stored in USD
27
+ // (official CNY list prices pre-converted at 7 CNY/USD), so requesting CNY
28
+ // shows the vendor's numbers.
29
+ const CNY_PER_USD = 7.0;
30
+ function usd(prompt, output, cached) {
31
+ // thoughts and response tokens are both billed at the vendor's output price
32
+ return {
33
+ currency: "USD",
34
+ prompt_tokens: prompt,
35
+ thoughts_tokens: output,
36
+ response_tokens: output,
37
+ ...(cached !== undefined ? { cached_tokens: cached } : {}),
38
+ };
39
+ }
40
+ /**
41
+ * Declare a CNY-denominated official list price; storage stays USD (converted
42
+ * at 7 CNY/USD).
43
+ */
44
+ function cny(prompt, output, cached) {
45
+ const rate = (v) => Math.round((v / CNY_PER_USD) * 1e6) / 1e6;
46
+ return usd(rate(prompt), rate(output), cached !== undefined ? rate(cached) : undefined);
47
+ }
48
+ // Prices in USD per million tokens (official CNY prices pre-converted at
49
+ // 7 CNY/USD); platform data (context windows, OpenRouter USD prices, modality
50
+ // flags) verified against the live /models APIs on 2026-07-22, SiliconFlow CNY
51
+ // prices from the vendors' official price lists.
52
+ const SUPPORTED_MODELS = [
53
+ // official vendor endpoints
54
+ {
55
+ model: "gemini-3.8-flash",
56
+ base_url: GOOGLE,
57
+ client: "gemini-official",
58
+ input_modalities: ["Text", "Image", "Video", "Audio"],
59
+ output_modalities: ["Text"],
60
+ context_window: 1048576,
61
+ // Google runs a launch discount through 2026-12-31 on this row and on the two flash
62
+ // rows below; the list price is stored regardless, because applying a running
63
+ // promotion belongs to the consumer, not to the registry.
64
+ pricing: usd(1.5, 7.5, 0.15),
65
+ },
66
+ {
67
+ model: "gemini-3.7-flash",
68
+ base_url: GOOGLE,
69
+ client: "gemini-official",
70
+ input_modalities: ["Text", "Image", "Video", "Audio"],
71
+ output_modalities: ["Text"],
72
+ context_window: 1048576,
73
+ pricing: usd(1.5, 7.5, 0.15),
74
+ },
75
+ {
76
+ model: "gemini-3.6-flash",
77
+ base_url: GOOGLE,
78
+ client: "gemini-official",
79
+ input_modalities: ["Text", "Image", "Video", "Audio"],
80
+ output_modalities: ["Text"],
81
+ context_window: 1048576,
82
+ pricing: usd(1.5, 7.5, 0.15),
83
+ },
84
+ {
85
+ model: "gemini-3.5-flash-lite",
86
+ base_url: GOOGLE,
87
+ client: "gemini-official",
88
+ input_modalities: ["Text", "Image", "Video", "Audio"],
89
+ output_modalities: ["Text"],
90
+ context_window: 1048576,
91
+ pricing: usd(0.3, 2.5, 0.03),
92
+ },
93
+ {
94
+ model: "gemini-3.5-flash",
95
+ base_url: GOOGLE,
96
+ client: "gemini-official",
97
+ input_modalities: ["Text", "Image", "Video", "Audio"],
98
+ output_modalities: ["Text"],
99
+ context_window: 1048576,
100
+ pricing: usd(1.5, 9.0, 0.15),
101
+ },
102
+ {
103
+ model: "gemini-3.1-flash-lite-image",
104
+ base_url: GOOGLE,
105
+ client: "gemini-official",
106
+ input_modalities: ["Text", "Image"],
107
+ output_modalities: ["Image"],
108
+ },
109
+ {
110
+ model: "gemini-3.1-flash-image",
111
+ base_url: GOOGLE,
112
+ client: "gemini-official",
113
+ input_modalities: ["Text", "Image"],
114
+ output_modalities: ["Image"],
115
+ },
116
+ {
117
+ model: "gemini-3.8-flash-tts",
118
+ base_url: GOOGLE,
119
+ client: "gemini-official",
120
+ input_modalities: ["Text"],
121
+ output_modalities: ["Audio"],
122
+ },
123
+ {
124
+ model: "gemini-3.8-flash-lite-tts",
125
+ base_url: GOOGLE,
126
+ client: "gemini-official",
127
+ input_modalities: ["Text"],
128
+ output_modalities: ["Audio"],
129
+ },
130
+ {
131
+ model: "gemini-3.1-flash-tts-preview",
132
+ base_url: GOOGLE,
133
+ client: "gemini-official",
134
+ input_modalities: ["Text"],
135
+ output_modalities: ["Audio"],
136
+ },
137
+ {
138
+ model: "gemini-embedding-2",
139
+ base_url: GOOGLE,
140
+ client: "gemini-official",
141
+ input_modalities: ["Text"],
142
+ output_modalities: ["Embed"],
143
+ },
144
+ {
145
+ // cache reads are 2.5% of the input price
146
+ model: "claude-fable-5-1",
147
+ base_url: ANTHROPIC,
148
+ client: "anthropic-official",
149
+ input_modalities: ["Text", "Image"],
150
+ output_modalities: ["Text"],
151
+ context_window: 1000000,
152
+ pricing: usd(10.0, 50.0, 0.25),
153
+ },
154
+ {
155
+ // cache reads are 5% of the input price
156
+ model: "claude-opus-5-5",
157
+ base_url: ANTHROPIC,
158
+ client: "anthropic-official",
159
+ input_modalities: ["Text", "Image"],
160
+ output_modalities: ["Text"],
161
+ context_window: 1000000,
162
+ pricing: usd(4.0, 20.0, 0.2),
163
+ },
164
+ {
165
+ model: "claude-sonnet-5-5",
166
+ base_url: ANTHROPIC,
167
+ client: "anthropic-official",
168
+ input_modalities: ["Text", "Image"],
169
+ output_modalities: ["Text"],
170
+ context_window: 1000000,
171
+ pricing: usd(2.0, 10.0, 0.2),
172
+ },
173
+ {
174
+ model: "claude-fable-5",
175
+ base_url: ANTHROPIC,
176
+ client: "anthropic-official",
177
+ input_modalities: ["Text", "Image"],
178
+ output_modalities: ["Text"],
179
+ context_window: 1000000,
180
+ pricing: usd(10.0, 50.0, 1.0),
181
+ },
182
+ {
183
+ model: "claude-opus-5",
184
+ base_url: ANTHROPIC,
185
+ client: "anthropic-official",
186
+ input_modalities: ["Text", "Image"],
187
+ output_modalities: ["Text"],
188
+ context_window: 1000000,
189
+ pricing: usd(5.0, 25.0, 0.5),
190
+ },
191
+ {
192
+ model: "claude-sonnet-5",
193
+ base_url: ANTHROPIC,
194
+ client: "anthropic-official",
195
+ input_modalities: ["Text", "Image"],
196
+ output_modalities: ["Text"],
197
+ context_window: 1000000,
198
+ pricing: usd(2.0, 10.0, 0.2),
199
+ },
200
+ {
201
+ model: "claude-opus-4-8",
202
+ base_url: ANTHROPIC,
203
+ client: "anthropic-official",
204
+ input_modalities: ["Text", "Image"],
205
+ output_modalities: ["Text"],
206
+ context_window: 1000000,
207
+ pricing: usd(5.0, 25.0, 0.5),
208
+ },
209
+ {
210
+ model: "claude-sonnet-4-6",
211
+ base_url: ANTHROPIC,
212
+ client: "anthropic-official",
213
+ input_modalities: ["Text", "Image"],
214
+ output_modalities: ["Text"],
215
+ context_window: 1000000,
216
+ pricing: usd(3.0, 15.0, 0.3),
217
+ },
218
+ {
219
+ // official list price per 1M tokens: $0.1 cached input, $2 uncached input, $2.5 cache
220
+ // writes, $10 output, above 272K input tokens 2x input and cache and 1.5x output. The
221
+ // prompt bucket carries the cache-write rate, as for gpt-6-astra.
222
+ model: "gpt-6.1-sol",
223
+ base_url: OPENAI,
224
+ client: "openai-official",
225
+ input_modalities: ["Text", "Image"],
226
+ output_modalities: ["Text"],
227
+ context_window: 1050000,
228
+ pricing: usd(2.5, 10.0, 0.1),
229
+ },
230
+ {
231
+ // official list price per 1M tokens: $1 cached input, $10 uncached input, $12.5 cache
232
+ // writes, $50 output, all doubled above 272K input tokens except output, which is 1.5x.
233
+ // The prompt bucket carries the cache-write rate: the usage buckets do not separate
234
+ // cache-written input from plain input.
235
+ model: "gpt-6-astra",
236
+ base_url: OPENAI,
237
+ client: "openai-official",
238
+ input_modalities: ["Text", "Image"],
239
+ output_modalities: ["Text"],
240
+ context_window: 1050000,
241
+ pricing: usd(12.5, 50.0, 1.0),
242
+ },
243
+ {
244
+ // official standard-tier list price; the bare gpt-5.6 alias also routes here
245
+ model: "gpt-5.6-sol",
246
+ base_url: OPENAI,
247
+ client: "openai-official",
248
+ input_modalities: ["Text", "Image"],
249
+ output_modalities: ["Text"],
250
+ context_window: 1050000,
251
+ pricing: usd(5.0, 30.0, 0.5),
252
+ },
253
+ {
254
+ model: "gpt-5.6-terra",
255
+ base_url: OPENAI,
256
+ client: "openai-official",
257
+ input_modalities: ["Text", "Image"],
258
+ output_modalities: ["Text"],
259
+ context_window: 1050000,
260
+ pricing: usd(2.0, 12.0, 0.2),
261
+ },
262
+ {
263
+ model: "gpt-5.6-luna",
264
+ base_url: OPENAI,
265
+ client: "openai-official",
266
+ input_modalities: ["Text", "Image"],
267
+ output_modalities: ["Text"],
268
+ context_window: 1050000,
269
+ pricing: usd(0.2, 1.2, 0.02),
270
+ },
271
+ {
272
+ model: "gpt-5.5",
273
+ base_url: OPENAI,
274
+ client: "openai-official",
275
+ input_modalities: ["Text", "Image"],
276
+ output_modalities: ["Text"],
277
+ context_window: 1050000,
278
+ pricing: usd(5.0, 30.0, 0.5),
279
+ },
280
+ {
281
+ model: "MiniMax-M3",
282
+ base_url: MINIMAX,
283
+ client: "minimax-official",
284
+ input_modalities: ["Text", "Image"],
285
+ output_modalities: ["Text"],
286
+ context_window: 1000000,
287
+ // official list price for the <=512K-input tier; rates double above it
288
+ pricing: usd(0.3, 1.2, 0.06),
289
+ },
290
+ {
291
+ model: "text-embedding-3-large",
292
+ base_url: OPENAI,
293
+ client: "openai-official",
294
+ input_modalities: ["Text"],
295
+ output_modalities: ["Embed"],
296
+ pricing: usd(0.13, 0.0),
297
+ },
298
+ {
299
+ model: "glm-5.3",
300
+ base_url: ZAI,
301
+ client: "zai-official",
302
+ input_modalities: ["Text"],
303
+ output_modalities: ["Text"],
304
+ context_window: 1000000,
305
+ pricing: usd(1.4, 4.4, 0.26),
306
+ },
307
+ {
308
+ model: "glm-5.3-flash",
309
+ base_url: ZAI,
310
+ client: "zai-official",
311
+ input_modalities: ["Text", "Image"],
312
+ output_modalities: ["Text"],
313
+ context_window: 1000000,
314
+ // official list price (verified 2026-08-26); a launch discount halves all three
315
+ // rates through 2026-09-09 (UTC+8)
316
+ pricing: usd(0.15, 0.5, 0.03),
317
+ },
318
+ {
319
+ model: "glm-5.2",
320
+ base_url: ZAI,
321
+ client: "zai-official",
322
+ input_modalities: ["Text"],
323
+ output_modalities: ["Text"],
324
+ context_window: 1000000,
325
+ pricing: usd(1.4, 4.4, 0.26),
326
+ },
327
+ {
328
+ model: "glm-5.1",
329
+ base_url: ZAI,
330
+ client: "zai-official",
331
+ input_modalities: ["Text"],
332
+ output_modalities: ["Text"],
333
+ context_window: 200000,
334
+ pricing: usd(1.4, 4.4, 0.26),
335
+ },
336
+ {
337
+ model: "kimi-k3",
338
+ base_url: MOONSHOT,
339
+ client: "moonshot-official",
340
+ input_modalities: ["Text", "Image"],
341
+ output_modalities: ["Text"],
342
+ context_window: 1048576,
343
+ pricing: cny(20.0, 100.0, 2.0),
344
+ },
345
+ {
346
+ model: "kimi-k2.6",
347
+ base_url: MOONSHOT,
348
+ client: "moonshot-official",
349
+ input_modalities: ["Text", "Image"],
350
+ output_modalities: ["Text"],
351
+ context_window: 262144,
352
+ pricing: cny(6.5, 27.0, 1.1),
353
+ },
354
+ {
355
+ // DeepSeek-V4.1-Flash; DeepSeek also serves deepseek-v4-flash and
356
+ // deepseek-v4-flash-vision-exp with it, at this price (official page 2026-09-30)
357
+ model: "deepseek-flash",
358
+ base_url: DEEPSEEK,
359
+ client: "deepseek-official",
360
+ input_modalities: ["Text", "Image"],
361
+ output_modalities: ["Text"],
362
+ context_window: 1000000,
363
+ // official off-peak list price; peak-hour rates (Beijing 9:00-12:00, 14:00-18:00,
364
+ // weekdays) are double
365
+ pricing: cny(1.0, 4.0, 0.02),
366
+ },
367
+ {
368
+ model: "deepseek-v4-flash",
369
+ base_url: DEEPSEEK,
370
+ client: "deepseek-official",
371
+ input_modalities: ["Text"],
372
+ output_modalities: ["Text"],
373
+ context_window: 1000000,
374
+ // official off-peak list price effective 2026-09-10 (verified 2026-09-08 against
375
+ // the official adjustment); peak-hour rates (Beijing 9:00-12:00, 14:00-18:00) are
376
+ // double
377
+ pricing: cny(1.0, 4.0, 0.02),
378
+ },
379
+ {
380
+ model: "deepseek-v4-flash-vision-exp",
381
+ base_url: DEEPSEEK,
382
+ client: "deepseek-official",
383
+ input_modalities: ["Text", "Image"],
384
+ output_modalities: ["Text"],
385
+ context_window: 1000000,
386
+ // priced as deepseek-v4-flash; official off-peak list price effective 2026-09-10
387
+ // (verified 2026-09-08 against the official adjustment), and peak-hour rates
388
+ // (Beijing 9:00-12:00, 14:00-18:00) are double
389
+ pricing: cny(1.0, 4.0, 0.02),
390
+ },
391
+ {
392
+ model: "deepseek-v4-pro",
393
+ base_url: DEEPSEEK,
394
+ client: "deepseek-official",
395
+ input_modalities: ["Text"],
396
+ output_modalities: ["Text"],
397
+ context_window: 1000000,
398
+ // official off-peak list price (verified 2026-08-18); peak-hour rates
399
+ // (Beijing 9:00-12:00, 14:00-18:00) are double
400
+ pricing: cny(4.5, 13.5, 0.15),
401
+ },
402
+ // OpenRouter (USD prices, context windows and modality flags from the live /models API)
403
+ {
404
+ model: "anthropic/claude-fable-5.1",
405
+ base_url: OPENROUTER,
406
+ client: "openai-responses",
407
+ input_modalities: ["Text", "Image"],
408
+ output_modalities: ["Text"],
409
+ context_window: 1000000,
410
+ pricing: usd(10.0, 50.0, 0.25),
411
+ },
412
+ {
413
+ model: "anthropic/claude-opus-5.5",
414
+ base_url: OPENROUTER,
415
+ client: "openai-responses",
416
+ input_modalities: ["Text", "Image"],
417
+ output_modalities: ["Text"],
418
+ context_window: 1000000,
419
+ pricing: usd(4.0, 20.0, 0.2),
420
+ },
421
+ {
422
+ model: "anthropic/claude-sonnet-5.5",
423
+ base_url: OPENROUTER,
424
+ client: "openai-responses",
425
+ input_modalities: ["Text", "Image"],
426
+ output_modalities: ["Text"],
427
+ context_window: 1000000,
428
+ pricing: usd(2.0, 10.0, 0.2),
429
+ },
430
+ {
431
+ model: "anthropic/claude-fable-5",
432
+ base_url: OPENROUTER,
433
+ client: "openai-responses",
434
+ input_modalities: ["Text", "Image"],
435
+ output_modalities: ["Text"],
436
+ context_window: 1000000,
437
+ pricing: usd(10.0, 50.0, 1.0),
438
+ },
439
+ {
440
+ model: "anthropic/claude-opus-5",
441
+ base_url: OPENROUTER,
442
+ client: "openai-responses",
443
+ input_modalities: ["Text", "Image"],
444
+ output_modalities: ["Text"],
445
+ context_window: 1000000,
446
+ pricing: usd(5.0, 25.0, 0.5),
447
+ },
448
+ {
449
+ model: "anthropic/claude-opus-4.8",
450
+ base_url: OPENROUTER,
451
+ client: "openai-responses",
452
+ input_modalities: ["Text", "Image"],
453
+ output_modalities: ["Text"],
454
+ context_window: 1000000,
455
+ pricing: usd(5.0, 25.0, 0.5),
456
+ },
457
+ {
458
+ model: "anthropic/claude-opus-4.7",
459
+ base_url: OPENROUTER,
460
+ client: "openai-responses",
461
+ input_modalities: ["Text", "Image"],
462
+ output_modalities: ["Text"],
463
+ context_window: 1000000,
464
+ pricing: usd(5.0, 25.0, 0.5),
465
+ },
466
+ {
467
+ model: "anthropic/claude-sonnet-5",
468
+ base_url: OPENROUTER,
469
+ client: "openai-responses",
470
+ input_modalities: ["Text", "Image"],
471
+ output_modalities: ["Text"],
472
+ context_window: 1000000,
473
+ pricing: usd(2.0, 10.0, 0.2),
474
+ },
475
+ {
476
+ // models API 2026-09-30, DeepSeek-V4.1-Flash
477
+ model: "deepseek/deepseek-v4.1-flash",
478
+ base_url: OPENROUTER,
479
+ client: "deepseek-official",
480
+ input_modalities: ["Text", "Image"],
481
+ output_modalities: ["Text"],
482
+ context_window: 1048576,
483
+ pricing: usd(0.0198, 0.396, 0.0029),
484
+ },
485
+ {
486
+ model: "deepseek/deepseek-v4-flash",
487
+ base_url: OPENROUTER,
488
+ client: "deepseek-official",
489
+ input_modalities: ["Text"],
490
+ output_modalities: ["Text"],
491
+ context_window: 1048576,
492
+ pricing: usd(0.098, 0.196, 0.0196),
493
+ },
494
+ {
495
+ model: "deepseek/deepseek-v4-pro",
496
+ base_url: OPENROUTER,
497
+ client: "deepseek-official",
498
+ input_modalities: ["Text"],
499
+ output_modalities: ["Text"],
500
+ context_window: 1048576,
501
+ pricing: usd(0.435, 0.87, 0.003625),
502
+ },
503
+ {
504
+ model: "google/gemini-3.5-flash",
505
+ base_url: OPENROUTER,
506
+ client: "openai-responses",
507
+ input_modalities: ["Text", "Image"],
508
+ output_modalities: ["Text"],
509
+ context_window: 1048576,
510
+ pricing: usd(1.5, 9.0, 0.15),
511
+ },
512
+ {
513
+ model: "minimax/minimax-m3",
514
+ base_url: OPENROUTER,
515
+ client: "openai-responses",
516
+ input_modalities: ["Text", "Image"],
517
+ output_modalities: ["Text"],
518
+ context_window: 1048576,
519
+ pricing: usd(0.3, 1.2, 0.06),
520
+ },
521
+ {
522
+ model: "moonshotai/kimi-k3",
523
+ base_url: OPENROUTER,
524
+ client: "moonshot-official",
525
+ input_modalities: ["Text", "Image"],
526
+ output_modalities: ["Text"],
527
+ context_window: 1048576,
528
+ pricing: usd(3.0, 15.0, 0.3),
529
+ },
530
+ {
531
+ model: "moonshotai/kimi-k2.6",
532
+ base_url: OPENROUTER,
533
+ client: "moonshot-official",
534
+ input_modalities: ["Text", "Image"],
535
+ output_modalities: ["Text"],
536
+ context_window: 262144,
537
+ pricing: usd(0.684, 3.42, 0.144),
538
+ },
539
+ {
540
+ model: "nvidia/nemotron-3-ultra-550b-a55b:free",
541
+ base_url: OPENROUTER,
542
+ client: "openai-responses",
543
+ input_modalities: ["Text"],
544
+ output_modalities: ["Text"],
545
+ context_window: 1000000,
546
+ pricing: usd(0.0, 0.0),
547
+ },
548
+ {
549
+ // models API 2026-09-30: $2 input, $10 output, $0.1 cache read, $2.5 cache write
550
+ model: "openai/gpt-6.1-sol",
551
+ base_url: OPENROUTER,
552
+ client: "openai-responses",
553
+ input_modalities: ["Text", "Image"],
554
+ output_modalities: ["Text"],
555
+ context_window: 1050000,
556
+ pricing: usd(2.5, 10.0, 0.1),
557
+ },
558
+ {
559
+ // models API 2026-09-09, default OpenAI endpoint, no discount: $10 input, $50 output,
560
+ // $1 cache read, $12.5 cache write per 1M tokens
561
+ model: "openai/gpt-6-astra",
562
+ base_url: OPENROUTER,
563
+ client: "openai-responses",
564
+ input_modalities: ["Text", "Image"],
565
+ output_modalities: ["Text"],
566
+ context_window: 1050000,
567
+ pricing: usd(12.5, 50.0, 1.0),
568
+ },
569
+ {
570
+ model: "openai/gpt-5.6-sol",
571
+ base_url: OPENROUTER,
572
+ client: "openai-responses",
573
+ input_modalities: ["Text", "Image"],
574
+ output_modalities: ["Text"],
575
+ context_window: 1050000,
576
+ pricing: usd(2.5, 15.0, 0.25),
577
+ },
578
+ {
579
+ model: "openai/gpt-5.6-terra",
580
+ base_url: OPENROUTER,
581
+ client: "openai-responses",
582
+ input_modalities: ["Text", "Image"],
583
+ output_modalities: ["Text"],
584
+ context_window: 1050000,
585
+ pricing: usd(2.0, 12.0, 0.2),
586
+ },
587
+ {
588
+ model: "openai/gpt-5.6-luna",
589
+ base_url: OPENROUTER,
590
+ client: "openai-responses",
591
+ input_modalities: ["Text", "Image"],
592
+ output_modalities: ["Text"],
593
+ context_window: 1050000,
594
+ pricing: usd(0.2, 1.2, 0.02),
595
+ },
596
+ {
597
+ model: "openai/gpt-5.5",
598
+ base_url: OPENROUTER,
599
+ client: "openai-responses",
600
+ input_modalities: ["Text", "Image"],
601
+ output_modalities: ["Text"],
602
+ context_window: 1050000,
603
+ pricing: usd(5.0, 30.0, 0.5),
604
+ },
605
+ {
606
+ model: "qwen/qwen3.6-35b-a3b",
607
+ base_url: OPENROUTER,
608
+ client: "openai-responses",
609
+ input_modalities: ["Text", "Image"],
610
+ output_modalities: ["Text"],
611
+ context_window: 262144,
612
+ pricing: usd(0.14, 1.0),
613
+ },
614
+ {
615
+ model: "qwen/qwen3-embedding-4b",
616
+ base_url: OPENROUTER,
617
+ client: "openai-embedding",
618
+ input_modalities: ["Text"],
619
+ output_modalities: ["Embed"],
620
+ context_window: 32768,
621
+ pricing: usd(0.02, 0.0),
622
+ },
623
+ {
624
+ model: "stepfun/step-3.7-flash",
625
+ base_url: OPENROUTER,
626
+ client: "openai-responses",
627
+ input_modalities: ["Text", "Image"],
628
+ output_modalities: ["Text"],
629
+ context_window: 262144,
630
+ pricing: usd(0.2, 1.15, 0.04),
631
+ },
632
+ {
633
+ model: "tencent/hy3",
634
+ base_url: OPENROUTER,
635
+ client: "openai-responses",
636
+ input_modalities: ["Text"],
637
+ output_modalities: ["Text"],
638
+ context_window: 262144,
639
+ pricing: usd(0.14, 0.58, 0.035),
640
+ },
641
+ {
642
+ model: "x-ai/grok-4.5",
643
+ base_url: OPENROUTER,
644
+ client: "openai-responses",
645
+ input_modalities: ["Text", "Image"],
646
+ output_modalities: ["Text"],
647
+ context_window: 500000,
648
+ pricing: usd(2.0, 6.0, 0.3),
649
+ },
650
+ {
651
+ model: "xiaomi/mimo-v2.5",
652
+ base_url: OPENROUTER,
653
+ client: "openai-responses",
654
+ input_modalities: ["Text", "Image"],
655
+ output_modalities: ["Text"],
656
+ context_window: 1050000,
657
+ pricing: usd(0.14, 0.28, 0.0028),
658
+ },
659
+ {
660
+ model: "z-ai/glm-5.3",
661
+ base_url: OPENROUTER,
662
+ client: "zai-official",
663
+ input_modalities: ["Text"],
664
+ output_modalities: ["Text"],
665
+ context_window: 1048576,
666
+ pricing: usd(1.4, 4.4, 0.26),
667
+ },
668
+ {
669
+ model: "z-ai/glm-5.2",
670
+ base_url: OPENROUTER,
671
+ client: "zai-official",
672
+ input_modalities: ["Text"],
673
+ output_modalities: ["Text"],
674
+ context_window: 1048576,
675
+ pricing: usd(0.966, 3.036, 0.1932),
676
+ },
677
+ {
678
+ model: "z-ai/glm-5.1",
679
+ base_url: OPENROUTER,
680
+ client: "zai-official",
681
+ input_modalities: ["Text"],
682
+ output_modalities: ["Text"],
683
+ context_window: 204800,
684
+ pricing: usd(0.966, 3.036, 0.1794),
685
+ },
686
+ // SiliconFlow (official CNY price lists pre-converted to USD; no public pricing API)
687
+ {
688
+ model: "deepseek-ai/DeepSeek-V4-Flash",
689
+ base_url: SILICONFLOW,
690
+ client: "openai-chat",
691
+ input_modalities: ["Text"],
692
+ output_modalities: ["Text"],
693
+ context_window: 1000000,
694
+ pricing: cny(1.0, 2.0, 0.02),
695
+ },
696
+ {
697
+ model: "deepseek-ai/DeepSeek-V4-Pro",
698
+ base_url: SILICONFLOW,
699
+ client: "openai-chat",
700
+ input_modalities: ["Text"],
701
+ output_modalities: ["Text"],
702
+ context_window: 1000000,
703
+ pricing: cny(12.0, 24.0, 0.1),
704
+ },
705
+ {
706
+ model: "meituan-longcat/LongCat-2.0",
707
+ base_url: SILICONFLOW,
708
+ client: "openai-chat",
709
+ input_modalities: ["Text"],
710
+ output_modalities: ["Text"],
711
+ context_window: 1000000,
712
+ pricing: cny(5.0, 20.0, 0.1),
713
+ },
714
+ {
715
+ model: "moonshotai/Kimi-K2.7-Code",
716
+ base_url: SILICONFLOW,
717
+ client: "openai-chat",
718
+ input_modalities: ["Text", "Image"],
719
+ output_modalities: ["Text"],
720
+ context_window: 262144,
721
+ pricing: cny(6.5, 27.0, 1.3),
722
+ },
723
+ {
724
+ model: "zai-org/GLM-5.2",
725
+ base_url: SILICONFLOW,
726
+ client: "zai-official",
727
+ input_modalities: ["Text"],
728
+ output_modalities: ["Text"],
729
+ context_window: 1000000,
730
+ pricing: cny(8.0, 28.0, 2.0),
731
+ },
732
+ {
733
+ model: "Pro/zai-org/GLM-5.1",
734
+ base_url: SILICONFLOW,
735
+ client: "zai-official",
736
+ input_modalities: ["Text"],
737
+ output_modalities: ["Text"],
738
+ context_window: 200000,
739
+ },
740
+ {
741
+ model: "Pro/moonshotai/Kimi-K2.6",
742
+ base_url: SILICONFLOW,
743
+ client: "moonshot-official",
744
+ input_modalities: ["Text", "Image"],
745
+ output_modalities: ["Text"],
746
+ context_window: 262144,
747
+ },
748
+ {
749
+ model: "Qwen/Qwen3.6-35B-A3B",
750
+ base_url: SILICONFLOW,
751
+ client: "openai-chat",
752
+ input_modalities: ["Text", "Image"],
753
+ output_modalities: ["Text"],
754
+ context_window: 262144,
755
+ },
756
+ {
757
+ model: "Qwen/Qwen3-Embedding-8B",
758
+ base_url: SILICONFLOW,
759
+ client: "openai-embedding",
760
+ input_modalities: ["Text"],
761
+ output_modalities: ["Embed"],
762
+ },
763
+ ];
764
+ function convertPricing(pricing, currency) {
765
+ if (currency === "USD") {
766
+ return { ...pricing };
767
+ }
768
+ const round = (v) => Math.round(v * CNY_PER_USD * 1e6) / 1e6;
769
+ return {
770
+ currency: "CNY",
771
+ prompt_tokens: round(pricing.prompt_tokens),
772
+ thoughts_tokens: round(pricing.thoughts_tokens),
773
+ response_tokens: round(pricing.response_tokens),
774
+ ...(pricing.cached_tokens !== undefined
775
+ ? { cached_tokens: round(pricing.cached_tokens) }
776
+ : {}),
777
+ };
778
+ }
779
+ /**
780
+ * List supported models with base URL, client, modalities, context window, and
781
+ * pricing.
782
+ *
783
+ * Covers the official vendor endpoints plus the OpenRouter and SiliconFlow
784
+ * platforms; `client` is the `clientType` token that routes the model to its
785
+ * protocol client. Prices are per million tokens for MMSP's usage buckets
786
+ * (cached_tokens, prompt_tokens, thoughts_tokens, response_tokens), stored in
787
+ * USD and converted to `currency` at 7 CNY/USD on request.
788
+ */
789
+ function listSupportedModels(currency = "USD") {
790
+ return SUPPORTED_MODELS.map((entry) => ({
791
+ ...entry,
792
+ input_modalities: [...entry.input_modalities],
793
+ output_modalities: [...entry.output_modalities],
794
+ ...(entry.pricing
795
+ ? { pricing: convertPricing(entry.pricing, currency) }
796
+ : {}),
797
+ }));
798
+ }