@lobehub/chat 1.111.0 → 1.111.2

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 (101) hide show
  1. package/.cursor/rules/code-review.mdc +2 -19
  2. package/.cursor/rules/cursor-ux.mdc +0 -72
  3. package/.cursor/rules/project-introduce.mdc +5 -5
  4. package/.cursor/rules/react-component.mdc +92 -73
  5. package/.cursor/rules/rules-attach.mdc +28 -61
  6. package/.cursor/rules/system-role.mdc +8 -20
  7. package/.cursor/rules/typescript.mdc +55 -14
  8. package/CHANGELOG.md +50 -0
  9. package/changelog/v1.json +14 -0
  10. package/package.json +1 -1
  11. package/packages/types/src/aiModel.ts +67 -46
  12. package/packages/types/src/llm.ts +3 -3
  13. package/src/app/[variants]/(main)/discover/(detail)/model/[...slugs]/features/Details/Overview/ProviderList/index.tsx +23 -12
  14. package/src/app/[variants]/(main)/discover/(detail)/provider/[...slugs]/features/Details/Overview/ModelList/index.tsx +23 -10
  15. package/src/app/[variants]/(main)/settings/provider/features/ModelList/ModelItem.tsx +21 -12
  16. package/src/config/aiModels/ai21.ts +8 -4
  17. package/src/config/aiModels/ai360.ts +28 -14
  18. package/src/config/aiModels/aihubmix.ts +174 -86
  19. package/src/config/aiModels/anthropic.ts +97 -38
  20. package/src/config/aiModels/azure.ts +54 -32
  21. package/src/config/aiModels/azureai.ts +63 -37
  22. package/src/config/aiModels/baichuan.ts +24 -12
  23. package/src/config/aiModels/bedrock.ts +60 -30
  24. package/src/config/aiModels/cohere.ts +60 -30
  25. package/src/config/aiModels/deepseek.ts +10 -6
  26. package/src/config/aiModels/fal.ts +43 -6
  27. package/src/config/aiModels/fireworksai.ts +88 -44
  28. package/src/config/aiModels/giteeai.ts +1 -1
  29. package/src/config/aiModels/github.ts +44 -26
  30. package/src/config/aiModels/google.ts +119 -68
  31. package/src/config/aiModels/groq.ts +48 -24
  32. package/src/config/aiModels/higress.ts +617 -310
  33. package/src/config/aiModels/hunyuan.ts +105 -54
  34. package/src/config/aiModels/infiniai.ts +104 -52
  35. package/src/config/aiModels/internlm.ts +16 -8
  36. package/src/config/aiModels/jina.ts +4 -2
  37. package/src/config/aiModels/minimax.ts +11 -10
  38. package/src/config/aiModels/mistral.ts +40 -20
  39. package/src/config/aiModels/moonshot.ts +42 -22
  40. package/src/config/aiModels/novita.ts +196 -98
  41. package/src/config/aiModels/openai.ts +270 -137
  42. package/src/config/aiModels/openrouter.ts +205 -100
  43. package/src/config/aiModels/perplexity.ts +36 -6
  44. package/src/config/aiModels/ppio.ts +76 -38
  45. package/src/config/aiModels/qwen.ts +257 -133
  46. package/src/config/aiModels/sambanova.ts +56 -28
  47. package/src/config/aiModels/sensenova.ts +100 -50
  48. package/src/config/aiModels/siliconcloud.ts +224 -112
  49. package/src/config/aiModels/stepfun.ts +44 -22
  50. package/src/config/aiModels/taichu.ts +8 -4
  51. package/src/config/aiModels/tencentcloud.ts +12 -6
  52. package/src/config/aiModels/upstage.ts +8 -4
  53. package/src/config/aiModels/v0.ts +15 -12
  54. package/src/config/aiModels/vertexai.ts +49 -27
  55. package/src/config/aiModels/volcengine.ts +110 -51
  56. package/src/config/aiModels/wenxin.ts +179 -73
  57. package/src/config/aiModels/xai.ts +33 -19
  58. package/src/config/aiModels/zeroone.ts +48 -24
  59. package/src/config/aiModels/zhipu.ts +118 -69
  60. package/src/config/modelProviders/ai21.ts +0 -8
  61. package/src/config/modelProviders/ai360.ts +0 -20
  62. package/src/config/modelProviders/anthropic.ts +0 -56
  63. package/src/config/modelProviders/baichuan.ts +0 -30
  64. package/src/config/modelProviders/bedrock.ts +0 -74
  65. package/src/config/modelProviders/deepseek.ts +0 -13
  66. package/src/config/modelProviders/fireworksai.ts +0 -88
  67. package/src/config/modelProviders/google.ts +0 -59
  68. package/src/config/modelProviders/groq.ts +0 -48
  69. package/src/config/modelProviders/higress.ts +0 -727
  70. package/src/config/modelProviders/hunyuan.ts +0 -45
  71. package/src/config/modelProviders/infiniai.ts +0 -60
  72. package/src/config/modelProviders/internlm.ts +0 -8
  73. package/src/config/modelProviders/mistral.ts +0 -48
  74. package/src/config/modelProviders/modelscope.ts +2 -1
  75. package/src/config/modelProviders/openai.ts +5 -100
  76. package/src/config/modelProviders/openrouter.ts +0 -77
  77. package/src/config/modelProviders/ppio.ts +0 -95
  78. package/src/config/modelProviders/qwen.ts +0 -165
  79. package/src/config/modelProviders/sensenova.ts +0 -45
  80. package/src/config/modelProviders/siliconcloud.ts +0 -266
  81. package/src/config/modelProviders/stepfun.ts +0 -60
  82. package/src/config/modelProviders/taichu.ts +0 -10
  83. package/src/config/modelProviders/wenxin.ts +0 -90
  84. package/src/config/modelProviders/xai.ts +0 -16
  85. package/src/config/modelProviders/zeroone.ts +0 -60
  86. package/src/config/modelProviders/zhipu.ts +0 -80
  87. package/src/features/Conversation/Extras/Usage/UsageDetail/ModelCard.tsx +4 -3
  88. package/src/features/Conversation/Extras/Usage/UsageDetail/pricing.ts +25 -15
  89. package/src/features/Conversation/Extras/Usage/UsageDetail/tokens.test.ts +7 -5
  90. package/src/features/Conversation/Extras/Usage/UsageDetail/tokens.ts +6 -5
  91. package/src/libs/model-runtime/fal/index.ts +8 -2
  92. package/src/libs/model-runtime/utils/openaiCompatibleFactory/index.test.ts +54 -8
  93. package/src/server/routers/lambda/agent.ts +2 -2
  94. package/src/server/routers/lambda/config/__snapshots__/index.test.ts.snap +0 -28
  95. package/src/server/services/discover/index.ts +7 -6
  96. package/src/server/services/user/index.ts +1 -2
  97. package/src/utils/__snapshots__/parseModels.test.ts.snap +28 -4
  98. package/src/utils/_deprecated/__snapshots__/parseModels.test.ts.snap +0 -8
  99. package/src/utils/parseModels.test.ts +60 -9
  100. package/src/utils/pricing.test.ts +183 -0
  101. package/src/utils/pricing.ts +90 -0
@@ -20,8 +20,10 @@ const doubaoChatModels: AIChatModelCard[] = [
20
20
  maxOutput: 16_384,
21
21
  pricing: {
22
22
  currency: 'CNY',
23
- input: 4,
24
- output: 16,
23
+ units: [
24
+ { name: 'textInput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
25
+ { name: 'textOutput', rate: 16, strategy: 'fixed', unit: 'millionTokens' },
26
+ ],
25
27
  },
26
28
  type: 'chat',
27
29
  },
@@ -43,8 +45,10 @@ const doubaoChatModels: AIChatModelCard[] = [
43
45
  maxOutput: 16_000,
44
46
  pricing: {
45
47
  currency: 'CNY',
46
- input: 1.2, // 输入长度 (32, 128] 千 token
47
- output: 16,
48
+ units: [
49
+ { name: 'textInput', rate: 1.2, strategy: 'fixed', unit: 'millionTokens' },
50
+ { name: 'textOutput', rate: 16, strategy: 'fixed', unit: 'millionTokens' },
51
+ ],
48
52
  },
49
53
  type: 'chat',
50
54
  },
@@ -66,8 +70,10 @@ const doubaoChatModels: AIChatModelCard[] = [
66
70
  maxOutput: 16_000,
67
71
  pricing: {
68
72
  currency: 'CNY',
69
- input: 1.2, // 输入长度 (32, 128] 千 token
70
- output: 16,
73
+ units: [
74
+ { name: 'textInput', rate: 1.2, strategy: 'fixed', unit: 'millionTokens' },
75
+ { name: 'textOutput', rate: 16, strategy: 'fixed', unit: 'millionTokens' },
76
+ ],
71
77
  },
72
78
  settings: {
73
79
  extendParams: ['thinking'],
@@ -92,8 +98,10 @@ const doubaoChatModels: AIChatModelCard[] = [
92
98
  maxOutput: 16_000,
93
99
  pricing: {
94
100
  currency: 'CNY',
95
- input: 0.3, // 输入长度 (32, 128] 千 token
96
- output: 3,
101
+ units: [
102
+ { name: 'textInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
103
+ { name: 'textOutput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
104
+ ],
97
105
  },
98
106
  settings: {
99
107
  extendParams: ['enableReasoning'],
@@ -117,8 +125,10 @@ const doubaoChatModels: AIChatModelCard[] = [
117
125
  maxOutput: 16_000,
118
126
  pricing: {
119
127
  currency: 'CNY',
120
- input: 3.5,
121
- output: 12,
128
+ units: [
129
+ { name: 'textInput', rate: 3.5, strategy: 'fixed', unit: 'millionTokens' },
130
+ { name: 'textOutput', rate: 12, strategy: 'fixed', unit: 'millionTokens' },
131
+ ],
122
132
  },
123
133
  settings: {
124
134
  extendParams: ['thinking'],
@@ -142,8 +152,10 @@ const doubaoChatModels: AIChatModelCard[] = [
142
152
  maxOutput: 16_000,
143
153
  pricing: {
144
154
  currency: 'CNY',
145
- input: 3,
146
- output: 9,
155
+ units: [
156
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
157
+ { name: 'textOutput', rate: 9, strategy: 'fixed', unit: 'millionTokens' },
158
+ ],
147
159
  },
148
160
  settings: {
149
161
  extendParams: ['thinking'],
@@ -166,8 +178,10 @@ const doubaoChatModels: AIChatModelCard[] = [
166
178
  maxOutput: 16_000,
167
179
  pricing: {
168
180
  currency: 'CNY',
169
- input: 4,
170
- output: 16,
181
+ units: [
182
+ { name: 'textInput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
183
+ { name: 'textOutput', rate: 16, strategy: 'fixed', unit: 'millionTokens' },
184
+ ],
171
185
  },
172
186
  type: 'chat',
173
187
  },
@@ -188,8 +202,10 @@ const doubaoChatModels: AIChatModelCard[] = [
188
202
  maxOutput: 16_000,
189
203
  pricing: {
190
204
  currency: 'CNY',
191
- input: 4,
192
- output: 16,
205
+ units: [
206
+ { name: 'textInput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
207
+ { name: 'textOutput', rate: 16, strategy: 'fixed', unit: 'millionTokens' },
208
+ ],
193
209
  },
194
210
  settings: {
195
211
  extendParams: ['enableReasoning'],
@@ -212,8 +228,10 @@ const doubaoChatModels: AIChatModelCard[] = [
212
228
  maxOutput: 16_384,
213
229
  pricing: {
214
230
  currency: 'CNY',
215
- input: 4,
216
- output: 16,
231
+ units: [
232
+ { name: 'textInput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
233
+ { name: 'textOutput', rate: 16, strategy: 'fixed', unit: 'millionTokens' },
234
+ ],
217
235
  },
218
236
  type: 'chat',
219
237
  },
@@ -233,8 +251,10 @@ const doubaoChatModels: AIChatModelCard[] = [
233
251
  maxOutput: 8192,
234
252
  pricing: {
235
253
  currency: 'CNY',
236
- input: 1.5,
237
- output: 6,
254
+ units: [
255
+ { name: 'textInput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
256
+ { name: 'textOutput', rate: 6, strategy: 'fixed', unit: 'millionTokens' },
257
+ ],
238
258
  },
239
259
  type: 'chat',
240
260
  },
@@ -254,8 +274,10 @@ const doubaoChatModels: AIChatModelCard[] = [
254
274
  maxOutput: 8192,
255
275
  pricing: {
256
276
  currency: 'CNY',
257
- input: 0.6,
258
- output: 2.4,
277
+ units: [
278
+ { name: 'textInput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
279
+ { name: 'textOutput', rate: 2.4, strategy: 'fixed', unit: 'millionTokens' },
280
+ ],
259
281
  },
260
282
  type: 'chat',
261
283
  },
@@ -274,8 +296,10 @@ const doubaoChatModels: AIChatModelCard[] = [
274
296
  maxOutput: 16_384,
275
297
  pricing: {
276
298
  currency: 'CNY',
277
- input: 2,
278
- output: 8,
299
+ units: [
300
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
301
+ { name: 'textOutput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
302
+ ],
279
303
  },
280
304
  type: 'chat',
281
305
  },
@@ -294,8 +318,10 @@ const doubaoChatModels: AIChatModelCard[] = [
294
318
  maxOutput: 16_384,
295
319
  pricing: {
296
320
  currency: 'CNY',
297
- input: 0.8,
298
- output: 2,
321
+ units: [
322
+ { name: 'textInput', rate: 0.8, strategy: 'fixed', unit: 'millionTokens' },
323
+ { name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
324
+ ],
299
325
  },
300
326
  type: 'chat',
301
327
  },
@@ -311,8 +337,10 @@ const doubaoChatModels: AIChatModelCard[] = [
311
337
  maxOutput: 12_288,
312
338
  pricing: {
313
339
  currency: 'CNY',
314
- input: 5,
315
- output: 9,
340
+ units: [
341
+ { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
342
+ { name: 'textOutput', rate: 9, strategy: 'fixed', unit: 'millionTokens' },
343
+ ],
316
344
  },
317
345
  type: 'chat',
318
346
  },
@@ -330,8 +358,10 @@ const doubaoChatModels: AIChatModelCard[] = [
330
358
  maxOutput: 12_288,
331
359
  pricing: {
332
360
  currency: 'CNY',
333
- input: 0.3,
334
- output: 0.6,
361
+ units: [
362
+ { name: 'textInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
363
+ { name: 'textOutput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
364
+ ],
335
365
  },
336
366
  type: 'chat',
337
367
  },
@@ -351,8 +381,10 @@ const doubaoChatModels: AIChatModelCard[] = [
351
381
  maxOutput: 12_288,
352
382
  pricing: {
353
383
  currency: 'CNY',
354
- input: 3,
355
- output: 9,
384
+ units: [
385
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
386
+ { name: 'textOutput', rate: 9, strategy: 'fixed', unit: 'millionTokens' },
387
+ ],
356
388
  },
357
389
  releasedAt: '2025-01-15',
358
390
  type: 'chat',
@@ -373,8 +405,10 @@ const doubaoChatModels: AIChatModelCard[] = [
373
405
  maxOutput: 16_384,
374
406
  pricing: {
375
407
  currency: 'CNY',
376
- input: 3,
377
- output: 9,
408
+ units: [
409
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
410
+ { name: 'textOutput', rate: 9, strategy: 'fixed', unit: 'millionTokens' },
411
+ ],
378
412
  },
379
413
  releasedAt: '2025-03-28',
380
414
  type: 'chat',
@@ -395,8 +429,10 @@ const doubaoChatModels: AIChatModelCard[] = [
395
429
  maxOutput: 16_384,
396
430
  pricing: {
397
431
  currency: 'CNY',
398
- input: 1.5,
399
- output: 4.5,
432
+ units: [
433
+ { name: 'textInput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
434
+ { name: 'textOutput', rate: 4.5, strategy: 'fixed', unit: 'millionTokens' },
435
+ ],
400
436
  },
401
437
  releasedAt: '2025-03-15',
402
438
  type: 'chat',
@@ -416,8 +452,10 @@ const doubaoChatModels: AIChatModelCard[] = [
416
452
  maxOutput: 4096,
417
453
  pricing: {
418
454
  currency: 'CNY',
419
- input: 3,
420
- output: 9,
455
+ units: [
456
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
457
+ { name: 'textOutput', rate: 9, strategy: 'fixed', unit: 'millionTokens' },
458
+ ],
421
459
  },
422
460
  releasedAt: '2024-10-28',
423
461
  type: 'chat',
@@ -437,8 +475,10 @@ const doubaoChatModels: AIChatModelCard[] = [
437
475
  maxOutput: 4096,
438
476
  pricing: {
439
477
  currency: 'CNY',
440
- input: 1.5,
441
- output: 4.5,
478
+ units: [
479
+ { name: 'textInput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
480
+ { name: 'textOutput', rate: 4.5, strategy: 'fixed', unit: 'millionTokens' },
481
+ ],
442
482
  },
443
483
  releasedAt: '2024-10-15',
444
484
  type: 'chat',
@@ -455,8 +495,10 @@ const doubaoChatModels: AIChatModelCard[] = [
455
495
  maxOutput: 4096,
456
496
  pricing: {
457
497
  currency: 'CNY',
458
- input: 0.3,
459
- output: 0.6,
498
+ units: [
499
+ { name: 'textInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
500
+ { name: 'textOutput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
501
+ ],
460
502
  },
461
503
  type: 'chat',
462
504
  },
@@ -472,8 +514,10 @@ const doubaoChatModels: AIChatModelCard[] = [
472
514
  maxOutput: 4096,
473
515
  pricing: {
474
516
  currency: 'CNY',
475
- input: 0.3,
476
- output: 0.6,
517
+ units: [
518
+ { name: 'textInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
519
+ { name: 'textOutput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
520
+ ],
477
521
  },
478
522
  type: 'chat',
479
523
  },
@@ -489,8 +533,10 @@ const doubaoChatModels: AIChatModelCard[] = [
489
533
  maxOutput: 4096,
490
534
  pricing: {
491
535
  currency: 'CNY',
492
- input: 0.8,
493
- output: 1,
536
+ units: [
537
+ { name: 'textInput', rate: 0.8, strategy: 'fixed', unit: 'millionTokens' },
538
+ { name: 'textOutput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
539
+ ],
494
540
  },
495
541
  type: 'chat',
496
542
  },
@@ -506,8 +552,10 @@ const doubaoChatModels: AIChatModelCard[] = [
506
552
  maxOutput: 4096,
507
553
  pricing: {
508
554
  currency: 'CNY',
509
- input: 0.8,
510
- output: 2,
555
+ units: [
556
+ { name: 'textInput', rate: 0.8, strategy: 'fixed', unit: 'millionTokens' },
557
+ { name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
558
+ ],
511
559
  },
512
560
  type: 'chat',
513
561
  },
@@ -523,8 +571,10 @@ const doubaoChatModels: AIChatModelCard[] = [
523
571
  maxOutput: 4096,
524
572
  pricing: {
525
573
  currency: 'CNY',
526
- input: 5,
527
- output: 9,
574
+ units: [
575
+ { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
576
+ { name: 'textOutput', rate: 9, strategy: 'fixed', unit: 'millionTokens' },
577
+ ],
528
578
  },
529
579
  type: 'chat',
530
580
  },
@@ -550,7 +600,16 @@ const volcengineImageModels: AIImageModelCard[] = [
550
600
  seed: { default: null },
551
601
  size: {
552
602
  default: '1024x1024',
553
- enum: ['1024x1024', '864x1152', '1152x864', '1280x720', '720x1280', '832x1248', '1248x832', '1512x648'],
603
+ enum: [
604
+ '1024x1024',
605
+ '864x1152',
606
+ '1152x864',
607
+ '1280x720',
608
+ '720x1280',
609
+ '832x1248',
610
+ '1248x832',
611
+ '1512x648',
612
+ ],
554
613
  },
555
614
  },
556
615
  releasedAt: '2025-04-15',