@lobehub/chat 1.111.1 → 1.111.3

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 (131) 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 +52 -0
  9. package/changelog/v1.json +14 -0
  10. package/locales/ar/models.json +21 -3
  11. package/locales/bg-BG/models.json +21 -3
  12. package/locales/de-DE/models.json +21 -3
  13. package/locales/en-US/models.json +21 -3
  14. package/locales/es-ES/models.json +21 -3
  15. package/locales/fa-IR/models.json +21 -3
  16. package/locales/fr-FR/models.json +21 -3
  17. package/locales/it-IT/models.json +21 -3
  18. package/locales/ja-JP/models.json +21 -3
  19. package/locales/ko-KR/models.json +21 -3
  20. package/locales/nl-NL/models.json +21 -3
  21. package/locales/pl-PL/models.json +21 -3
  22. package/locales/pt-BR/models.json +21 -3
  23. package/locales/ru-RU/models.json +21 -3
  24. package/locales/tr-TR/models.json +21 -3
  25. package/locales/vi-VN/models.json +21 -3
  26. package/locales/zh-CN/models.json +21 -3
  27. package/locales/zh-TW/models.json +21 -3
  28. package/package.json +1 -1
  29. package/packages/types/src/aiModel.ts +67 -46
  30. package/packages/types/src/hotkey.ts +2 -0
  31. package/packages/types/src/llm.ts +3 -3
  32. package/src/app/[variants]/(main)/_layout/Desktop/SideBar/PinList/index.tsx +3 -3
  33. package/src/app/[variants]/(main)/_layout/Desktop/SideBar/TopActions.test.tsx +1 -0
  34. package/src/app/[variants]/(main)/_layout/Desktop/SideBar/TopActions.tsx +11 -2
  35. package/src/app/[variants]/(main)/_layout/Desktop/SideBar/index.tsx +2 -2
  36. package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Main.tsx +2 -2
  37. package/src/app/[variants]/(main)/chat/_layout/Desktop/SessionPanel.tsx +2 -2
  38. package/src/app/[variants]/(main)/discover/(detail)/model/[...slugs]/features/Details/Overview/ProviderList/index.tsx +23 -12
  39. package/src/app/[variants]/(main)/discover/(detail)/provider/[...slugs]/features/Details/Overview/ModelList/index.tsx +23 -10
  40. package/src/app/[variants]/(main)/settings/provider/features/ModelList/ModelItem.tsx +21 -12
  41. package/src/components/Thinking/index.tsx +53 -13
  42. package/src/config/aiModels/ai21.ts +8 -4
  43. package/src/config/aiModels/ai360.ts +28 -14
  44. package/src/config/aiModels/aihubmix.ts +174 -86
  45. package/src/config/aiModels/anthropic.ts +97 -38
  46. package/src/config/aiModels/azure.ts +54 -32
  47. package/src/config/aiModels/azureai.ts +63 -37
  48. package/src/config/aiModels/baichuan.ts +24 -12
  49. package/src/config/aiModels/bedrock.ts +60 -30
  50. package/src/config/aiModels/cohere.ts +60 -30
  51. package/src/config/aiModels/deepseek.ts +10 -6
  52. package/src/config/aiModels/fireworksai.ts +88 -44
  53. package/src/config/aiModels/giteeai.ts +1 -1
  54. package/src/config/aiModels/github.ts +44 -26
  55. package/src/config/aiModels/google.ts +119 -68
  56. package/src/config/aiModels/groq.ts +48 -24
  57. package/src/config/aiModels/higress.ts +617 -310
  58. package/src/config/aiModels/hunyuan.ts +105 -54
  59. package/src/config/aiModels/infiniai.ts +104 -52
  60. package/src/config/aiModels/internlm.ts +16 -8
  61. package/src/config/aiModels/jina.ts +4 -2
  62. package/src/config/aiModels/minimax.ts +11 -10
  63. package/src/config/aiModels/mistral.ts +40 -20
  64. package/src/config/aiModels/moonshot.ts +42 -22
  65. package/src/config/aiModels/novita.ts +196 -98
  66. package/src/config/aiModels/openai.ts +270 -137
  67. package/src/config/aiModels/openrouter.ts +205 -100
  68. package/src/config/aiModels/perplexity.ts +36 -6
  69. package/src/config/aiModels/ppio.ts +76 -38
  70. package/src/config/aiModels/qwen.ts +257 -133
  71. package/src/config/aiModels/sambanova.ts +56 -28
  72. package/src/config/aiModels/sensenova.ts +100 -50
  73. package/src/config/aiModels/siliconcloud.ts +224 -112
  74. package/src/config/aiModels/stepfun.ts +44 -22
  75. package/src/config/aiModels/taichu.ts +8 -4
  76. package/src/config/aiModels/tencentcloud.ts +12 -6
  77. package/src/config/aiModels/upstage.ts +8 -4
  78. package/src/config/aiModels/v0.ts +15 -12
  79. package/src/config/aiModels/vertexai.ts +49 -27
  80. package/src/config/aiModels/volcengine.ts +110 -51
  81. package/src/config/aiModels/wenxin.ts +179 -73
  82. package/src/config/aiModels/xai.ts +33 -19
  83. package/src/config/aiModels/zeroone.ts +48 -24
  84. package/src/config/aiModels/zhipu.ts +118 -69
  85. package/src/config/modelProviders/ai21.ts +0 -8
  86. package/src/config/modelProviders/ai360.ts +0 -20
  87. package/src/config/modelProviders/anthropic.ts +0 -56
  88. package/src/config/modelProviders/baichuan.ts +0 -30
  89. package/src/config/modelProviders/bedrock.ts +0 -74
  90. package/src/config/modelProviders/deepseek.ts +0 -13
  91. package/src/config/modelProviders/fireworksai.ts +0 -88
  92. package/src/config/modelProviders/google.ts +0 -59
  93. package/src/config/modelProviders/groq.ts +0 -48
  94. package/src/config/modelProviders/higress.ts +0 -727
  95. package/src/config/modelProviders/hunyuan.ts +0 -45
  96. package/src/config/modelProviders/infiniai.ts +0 -60
  97. package/src/config/modelProviders/internlm.ts +0 -8
  98. package/src/config/modelProviders/mistral.ts +0 -48
  99. package/src/config/modelProviders/modelscope.ts +2 -1
  100. package/src/config/modelProviders/openai.ts +5 -100
  101. package/src/config/modelProviders/openrouter.ts +0 -77
  102. package/src/config/modelProviders/ppio.ts +0 -95
  103. package/src/config/modelProviders/qwen.ts +0 -165
  104. package/src/config/modelProviders/sensenova.ts +0 -45
  105. package/src/config/modelProviders/siliconcloud.ts +0 -266
  106. package/src/config/modelProviders/stepfun.ts +0 -60
  107. package/src/config/modelProviders/taichu.ts +0 -10
  108. package/src/config/modelProviders/wenxin.ts +0 -90
  109. package/src/config/modelProviders/xai.ts +0 -16
  110. package/src/config/modelProviders/zeroone.ts +0 -60
  111. package/src/config/modelProviders/zhipu.ts +0 -80
  112. package/src/const/hotkeys.ts +6 -0
  113. package/src/features/Conversation/Extras/Usage/UsageDetail/ModelCard.tsx +4 -3
  114. package/src/features/Conversation/Extras/Usage/UsageDetail/pricing.ts +25 -15
  115. package/src/features/Conversation/Extras/Usage/UsageDetail/tokens.test.ts +7 -5
  116. package/src/features/Conversation/Extras/Usage/UsageDetail/tokens.ts +6 -5
  117. package/src/hooks/useHotkeys/chatScope.ts +2 -2
  118. package/src/hooks/useHotkeys/globalScope.ts +16 -4
  119. package/src/hooks/usePinnedAgentState.ts +21 -0
  120. package/src/hooks/useSwitchSession.ts +1 -1
  121. package/src/libs/model-runtime/utils/openaiCompatibleFactory/index.test.ts +54 -8
  122. package/src/locales/default/hotkey.ts +4 -0
  123. package/src/server/routers/lambda/agent.ts +2 -2
  124. package/src/server/routers/lambda/config/__snapshots__/index.test.ts.snap +0 -28
  125. package/src/server/services/discover/index.ts +7 -6
  126. package/src/server/services/user/index.ts +1 -2
  127. package/src/utils/__snapshots__/parseModels.test.ts.snap +28 -4
  128. package/src/utils/_deprecated/__snapshots__/parseModels.test.ts.snap +0 -8
  129. package/src/utils/parseModels.test.ts +60 -9
  130. package/src/utils/pricing.test.ts +183 -0
  131. package/src/utils/pricing.ts +90 -0
@@ -33,8 +33,10 @@ const openrouterChatModels: AIChatModelCard[] = [
33
33
  id: 'qwen/qwen3-30b-a3b',
34
34
  maxOutput: 40_960,
35
35
  pricing: {
36
- input: 0.1,
37
- output: 0.3,
36
+ units: [
37
+ { name: 'textInput', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
38
+ { name: 'textOutput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
39
+ ],
38
40
  },
39
41
  type: 'chat',
40
42
  },
@@ -72,8 +74,10 @@ const openrouterChatModels: AIChatModelCard[] = [
72
74
  id: 'qwen/qwen3-14b',
73
75
  maxOutput: 40_960,
74
76
  pricing: {
75
- input: 0.08,
76
- output: 0.24,
77
+ units: [
78
+ { name: 'textInput', rate: 0.08, strategy: 'fixed', unit: 'millionTokens' },
79
+ { name: 'textOutput', rate: 0.24, strategy: 'fixed', unit: 'millionTokens' },
80
+ ],
77
81
  },
78
82
  type: 'chat',
79
83
  },
@@ -98,8 +102,10 @@ const openrouterChatModels: AIChatModelCard[] = [
98
102
  displayName: 'Qwen3 32B',
99
103
  id: 'qwen/qwen3-32b',
100
104
  pricing: {
101
- input: 0.1,
102
- output: 0.3,
105
+ units: [
106
+ { name: 'textInput', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
107
+ { name: 'textOutput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
108
+ ],
103
109
  },
104
110
  type: 'chat',
105
111
  },
@@ -125,8 +131,10 @@ const openrouterChatModels: AIChatModelCard[] = [
125
131
  id: 'qwen/qwen3-235b-a22b',
126
132
  maxOutput: 40_960,
127
133
  pricing: {
128
- input: 0.2,
129
- output: 0.6,
134
+ units: [
135
+ { name: 'textInput', rate: 0.2, strategy: 'fixed', unit: 'millionTokens' },
136
+ { name: 'textOutput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
137
+ ],
130
138
  },
131
139
  type: 'chat',
132
140
  },
@@ -151,8 +159,10 @@ const openrouterChatModels: AIChatModelCard[] = [
151
159
  displayName: 'GLM Z1 Rumination 32B',
152
160
  id: 'thudm/glm-z1-rumination-32b',
153
161
  pricing: {
154
- input: 0.24,
155
- output: 0.24,
162
+ units: [
163
+ { name: 'textInput', rate: 0.24, strategy: 'fixed', unit: 'millionTokens' },
164
+ { name: 'textOutput', rate: 0.24, strategy: 'fixed', unit: 'millionTokens' },
165
+ ],
156
166
  },
157
167
  type: 'chat',
158
168
  },
@@ -196,8 +206,10 @@ const openrouterChatModels: AIChatModelCard[] = [
196
206
  displayName: 'GLM Z1 32B',
197
207
  id: 'thudm/glm-z1-32b',
198
208
  pricing: {
199
- input: 0.24,
200
- output: 0.24,
209
+ units: [
210
+ { name: 'textInput', rate: 0.24, strategy: 'fixed', unit: 'millionTokens' },
211
+ { name: 'textOutput', rate: 0.24, strategy: 'fixed', unit: 'millionTokens' },
212
+ ],
201
213
  },
202
214
  type: 'chat',
203
215
  },
@@ -222,8 +234,10 @@ const openrouterChatModels: AIChatModelCard[] = [
222
234
  displayName: 'GLM 4 32B',
223
235
  id: 'thudm/glm-4-32b',
224
236
  pricing: {
225
- input: 0.24,
226
- output: 0.24,
237
+ units: [
238
+ { name: 'textInput', rate: 0.24, strategy: 'fixed', unit: 'millionTokens' },
239
+ { name: 'textOutput', rate: 0.24, strategy: 'fixed', unit: 'millionTokens' },
240
+ ],
227
241
  },
228
242
  type: 'chat',
229
243
  },
@@ -240,8 +254,10 @@ const openrouterChatModels: AIChatModelCard[] = [
240
254
  id: 'google/gemini-2.5-pro',
241
255
  maxOutput: 65_536,
242
256
  pricing: {
243
- input: 1.25,
244
- output: 10,
257
+ units: [
258
+ { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
259
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
260
+ ],
245
261
  },
246
262
  type: 'chat',
247
263
  },
@@ -258,8 +274,10 @@ const openrouterChatModels: AIChatModelCard[] = [
258
274
  id: 'google/gemini-2.5-pro-preview',
259
275
  maxOutput: 65_536,
260
276
  pricing: {
261
- input: 1.25,
262
- output: 10,
277
+ units: [
278
+ { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
279
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
280
+ ],
263
281
  },
264
282
  type: 'chat',
265
283
  },
@@ -276,8 +294,10 @@ const openrouterChatModels: AIChatModelCard[] = [
276
294
  id: 'google/gemini-2.5-flash',
277
295
  maxOutput: 65_535,
278
296
  pricing: {
279
- input: 0.15,
280
- output: 0.6,
297
+ units: [
298
+ { name: 'textInput', rate: 0.15, strategy: 'fixed', unit: 'millionTokens' },
299
+ { name: 'textOutput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
300
+ ],
281
301
  },
282
302
  type: 'chat',
283
303
  },
@@ -294,8 +314,10 @@ const openrouterChatModels: AIChatModelCard[] = [
294
314
  id: 'google/gemini-2.5-flash-preview',
295
315
  maxOutput: 65_535,
296
316
  pricing: {
297
- input: 0.15,
298
- output: 0.6,
317
+ units: [
318
+ { name: 'textInput', rate: 0.15, strategy: 'fixed', unit: 'millionTokens' },
319
+ { name: 'textOutput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
320
+ ],
299
321
  },
300
322
  type: 'chat',
301
323
  },
@@ -312,8 +334,10 @@ const openrouterChatModels: AIChatModelCard[] = [
312
334
  id: 'google/gemini-2.5-flash-preview:thinking',
313
335
  maxOutput: 65_535,
314
336
  pricing: {
315
- input: 0.15,
316
- output: 3.5,
337
+ units: [
338
+ { name: 'textInput', rate: 0.15, strategy: 'fixed', unit: 'millionTokens' },
339
+ { name: 'textOutput', rate: 3.5, strategy: 'fixed', unit: 'millionTokens' },
340
+ ],
317
341
  },
318
342
  type: 'chat',
319
343
  },
@@ -330,9 +354,11 @@ const openrouterChatModels: AIChatModelCard[] = [
330
354
  id: 'openai/o3',
331
355
  maxOutput: 100_000,
332
356
  pricing: {
333
- cachedInput: 2.5,
334
- input: 10,
335
- output: 40,
357
+ units: [
358
+ { name: 'textInput_cacheRead', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
359
+ { name: 'textInput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
360
+ { name: 'textOutput', rate: 40, strategy: 'fixed', unit: 'millionTokens' },
361
+ ],
336
362
  },
337
363
  releasedAt: '2025-04-17',
338
364
  type: 'chat',
@@ -350,9 +376,11 @@ const openrouterChatModels: AIChatModelCard[] = [
350
376
  id: 'openai/o4-mini-high',
351
377
  maxOutput: 100_000,
352
378
  pricing: {
353
- cachedInput: 0.275,
354
- input: 1.1,
355
- output: 4.4,
379
+ units: [
380
+ { name: 'textInput_cacheRead', rate: 0.275, strategy: 'fixed', unit: 'millionTokens' },
381
+ { name: 'textInput', rate: 1.1, strategy: 'fixed', unit: 'millionTokens' },
382
+ { name: 'textOutput', rate: 4.4, strategy: 'fixed', unit: 'millionTokens' },
383
+ ],
356
384
  },
357
385
  releasedAt: '2025-04-17',
358
386
  type: 'chat',
@@ -369,9 +397,11 @@ const openrouterChatModels: AIChatModelCard[] = [
369
397
  id: 'openai/o4-mini',
370
398
  maxOutput: 100_000,
371
399
  pricing: {
372
- cachedInput: 0.275,
373
- input: 1.1,
374
- output: 4.4,
400
+ units: [
401
+ { name: 'textInput_cacheRead', rate: 0.275, strategy: 'fixed', unit: 'millionTokens' },
402
+ { name: 'textInput', rate: 1.1, strategy: 'fixed', unit: 'millionTokens' },
403
+ { name: 'textOutput', rate: 4.4, strategy: 'fixed', unit: 'millionTokens' },
404
+ ],
375
405
  },
376
406
  releasedAt: '2025-04-17',
377
407
  type: 'chat',
@@ -387,9 +417,11 @@ const openrouterChatModels: AIChatModelCard[] = [
387
417
  id: 'openai/gpt-4.1',
388
418
  maxOutput: 32_768,
389
419
  pricing: {
390
- cachedInput: 0.5,
391
- input: 2,
392
- output: 8,
420
+ units: [
421
+ { name: 'textInput_cacheRead', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
422
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
423
+ { name: 'textOutput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
424
+ ],
393
425
  },
394
426
  releasedAt: '2025-04-14',
395
427
  type: 'chat',
@@ -406,9 +438,11 @@ const openrouterChatModels: AIChatModelCard[] = [
406
438
  id: 'openai/gpt-4.1-mini',
407
439
  maxOutput: 32_768,
408
440
  pricing: {
409
- cachedInput: 0.1,
410
- input: 0.4,
411
- output: 1.6,
441
+ units: [
442
+ { name: 'textInput_cacheRead', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
443
+ { name: 'textInput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
444
+ { name: 'textOutput', rate: 1.6, strategy: 'fixed', unit: 'millionTokens' },
445
+ ],
412
446
  },
413
447
  releasedAt: '2025-04-14',
414
448
  type: 'chat',
@@ -424,9 +458,11 @@ const openrouterChatModels: AIChatModelCard[] = [
424
458
  id: 'openai/gpt-4.1-nano',
425
459
  maxOutput: 32_768,
426
460
  pricing: {
427
- cachedInput: 0.025,
428
- input: 0.1,
429
- output: 0.4,
461
+ units: [
462
+ { name: 'textInput_cacheRead', rate: 0.025, strategy: 'fixed', unit: 'millionTokens' },
463
+ { name: 'textInput', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
464
+ { name: 'textOutput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
465
+ ],
430
466
  },
431
467
  releasedAt: '2025-04-14',
432
468
  type: 'chat',
@@ -442,9 +478,11 @@ const openrouterChatModels: AIChatModelCard[] = [
442
478
  id: 'openai/o3-mini-high',
443
479
  maxOutput: 100_000,
444
480
  pricing: {
445
- cachedInput: 0.55,
446
- input: 1.1,
447
- output: 4.4,
481
+ units: [
482
+ { name: 'textInput_cacheRead', rate: 0.55, strategy: 'fixed', unit: 'millionTokens' },
483
+ { name: 'textInput', rate: 1.1, strategy: 'fixed', unit: 'millionTokens' },
484
+ { name: 'textOutput', rate: 4.4, strategy: 'fixed', unit: 'millionTokens' },
485
+ ],
448
486
  },
449
487
  releasedAt: '2025-01-31',
450
488
  type: 'chat',
@@ -460,9 +498,11 @@ const openrouterChatModels: AIChatModelCard[] = [
460
498
  id: 'openai/o3-mini',
461
499
  maxOutput: 100_000,
462
500
  pricing: {
463
- cachedInput: 0.55,
464
- input: 1.1,
465
- output: 4.4,
501
+ units: [
502
+ { name: 'textInput_cacheRead', rate: 0.55, strategy: 'fixed', unit: 'millionTokens' },
503
+ { name: 'textInput', rate: 1.1, strategy: 'fixed', unit: 'millionTokens' },
504
+ { name: 'textOutput', rate: 4.4, strategy: 'fixed', unit: 'millionTokens' },
505
+ ],
466
506
  },
467
507
  releasedAt: '2025-01-31',
468
508
  type: 'chat',
@@ -478,8 +518,10 @@ const openrouterChatModels: AIChatModelCard[] = [
478
518
  id: 'openai/o1-mini',
479
519
  maxOutput: 65_536,
480
520
  pricing: {
481
- input: 3,
482
- output: 12,
521
+ units: [
522
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
523
+ { name: 'textOutput', rate: 12, strategy: 'fixed', unit: 'millionTokens' },
524
+ ],
483
525
  },
484
526
  releasedAt: '2024-09-12',
485
527
  type: 'chat',
@@ -495,8 +537,10 @@ const openrouterChatModels: AIChatModelCard[] = [
495
537
  id: 'openai/o1-preview',
496
538
  maxOutput: 32_768,
497
539
  pricing: {
498
- input: 15,
499
- output: 60,
540
+ units: [
541
+ { name: 'textInput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
542
+ { name: 'textOutput', rate: 60, strategy: 'fixed', unit: 'millionTokens' },
543
+ ],
500
544
  },
501
545
  releasedAt: '2024-09-12',
502
546
  type: 'chat',
@@ -513,8 +557,10 @@ const openrouterChatModels: AIChatModelCard[] = [
513
557
  id: 'openai/gpt-4o-mini',
514
558
  maxOutput: 16_385,
515
559
  pricing: {
516
- input: 0.15,
517
- output: 0.6,
560
+ units: [
561
+ { name: 'textInput', rate: 0.15, strategy: 'fixed', unit: 'millionTokens' },
562
+ { name: 'textOutput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
563
+ ],
518
564
  },
519
565
  type: 'chat',
520
566
  },
@@ -529,8 +575,10 @@ const openrouterChatModels: AIChatModelCard[] = [
529
575
  displayName: 'GPT-4o',
530
576
  id: 'openai/gpt-4o',
531
577
  pricing: {
532
- input: 2.5,
533
- output: 10,
578
+ units: [
579
+ { name: 'textInput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
580
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
581
+ ],
534
582
  },
535
583
  type: 'chat',
536
584
  },
@@ -545,8 +593,10 @@ const openrouterChatModels: AIChatModelCard[] = [
545
593
  displayName: 'DeepSeek R1 0528',
546
594
  id: 'deepseek/deepseek-r1-0528',
547
595
  pricing: {
548
- input: 0.5,
549
- output: 2.18,
596
+ units: [
597
+ { name: 'textInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
598
+ { name: 'textOutput', rate: 2.18, strategy: 'fixed', unit: 'millionTokens' },
599
+ ],
550
600
  },
551
601
  releasedAt: '2025-05-28',
552
602
  type: 'chat',
@@ -573,8 +623,10 @@ const openrouterChatModels: AIChatModelCard[] = [
573
623
  displayName: 'DeepSeek R1',
574
624
  id: 'deepseek/deepseek-r1',
575
625
  pricing: {
576
- input: 3,
577
- output: 8,
626
+ units: [
627
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
628
+ { name: 'textOutput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
629
+ ],
578
630
  },
579
631
  releasedAt: '2025-01-20',
580
632
  type: 'chat',
@@ -598,9 +650,11 @@ const openrouterChatModels: AIChatModelCard[] = [
598
650
  displayName: 'DeepSeek V3 0324',
599
651
  id: 'deepseek/deepseek-chat-v3-0324',
600
652
  pricing: {
601
- cachedInput: 0.07,
602
- input: 0.27,
603
- output: 1.1,
653
+ units: [
654
+ { name: 'textInput_cacheRead', rate: 0.07, strategy: 'fixed', unit: 'millionTokens' },
655
+ { name: 'textInput', rate: 0.27, strategy: 'fixed', unit: 'millionTokens' },
656
+ { name: 'textOutput', rate: 1.1, strategy: 'fixed', unit: 'millionTokens' },
657
+ ],
604
658
  },
605
659
  type: 'chat',
606
660
  },
@@ -624,10 +678,17 @@ const openrouterChatModels: AIChatModelCard[] = [
624
678
  id: 'anthropic/claude-3-haiku',
625
679
  maxOutput: 4096,
626
680
  pricing: {
627
- cachedInput: 0.025,
628
- input: 0.25,
629
- output: 1.25,
630
- writeCacheInput: 0.3125,
681
+ units: [
682
+ { name: 'textInput_cacheRead', rate: 0.025, strategy: 'fixed', unit: 'millionTokens' },
683
+ { name: 'textInput', rate: 0.25, strategy: 'fixed', unit: 'millionTokens' },
684
+ { name: 'textOutput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
685
+ {
686
+ lookup: { prices: { '5m': 0.3125 }, pricingParams: ['ttl'] },
687
+ name: 'textInput_cacheWrite',
688
+ strategy: 'lookup',
689
+ unit: 'millionTokens',
690
+ },
691
+ ],
631
692
  },
632
693
  releasedAt: '2024-03-07',
633
694
  type: 'chat',
@@ -643,10 +704,17 @@ const openrouterChatModels: AIChatModelCard[] = [
643
704
  id: 'anthropic/claude-3.5-haiku',
644
705
  maxOutput: 8192,
645
706
  pricing: {
646
- cachedInput: 0.1,
647
- input: 1,
648
- output: 5,
649
- writeCacheInput: 1.25,
707
+ units: [
708
+ { name: 'textInput_cacheRead', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
709
+ { name: 'textInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
710
+ { name: 'textOutput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
711
+ {
712
+ lookup: { prices: { '5m': 1.25 }, pricingParams: ['ttl'] },
713
+ name: 'textInput_cacheWrite',
714
+ strategy: 'lookup',
715
+ unit: 'millionTokens',
716
+ },
717
+ ],
650
718
  },
651
719
  releasedAt: '2024-11-05',
652
720
  type: 'chat',
@@ -663,10 +731,17 @@ const openrouterChatModels: AIChatModelCard[] = [
663
731
  id: 'anthropic/claude-3.5-sonnet',
664
732
  maxOutput: 8192,
665
733
  pricing: {
666
- cachedInput: 0.3,
667
- input: 3,
668
- output: 15,
669
- writeCacheInput: 3.75,
734
+ units: [
735
+ { name: 'textInput_cacheRead', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
736
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
737
+ { name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
738
+ {
739
+ lookup: { prices: { '5m': 3.75 }, pricingParams: ['ttl'] },
740
+ name: 'textInput_cacheWrite',
741
+ strategy: 'lookup',
742
+ unit: 'millionTokens',
743
+ },
744
+ ],
670
745
  },
671
746
  releasedAt: '2024-06-20',
672
747
  type: 'chat',
@@ -684,10 +759,17 @@ const openrouterChatModels: AIChatModelCard[] = [
684
759
  id: 'anthropic/claude-3.7-sonnet',
685
760
  maxOutput: 8192,
686
761
  pricing: {
687
- cachedInput: 0.3,
688
- input: 3,
689
- output: 15,
690
- writeCacheInput: 3.75,
762
+ units: [
763
+ { name: 'textInput_cacheRead', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
764
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
765
+ { name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
766
+ {
767
+ lookup: { prices: { '5m': 3.75 }, pricingParams: ['ttl'] },
768
+ name: 'textInput_cacheWrite',
769
+ strategy: 'lookup',
770
+ unit: 'millionTokens',
771
+ },
772
+ ],
691
773
  },
692
774
  releasedAt: '2025-02-24',
693
775
  settings: {
@@ -708,8 +790,10 @@ const openrouterChatModels: AIChatModelCard[] = [
708
790
  id: 'anthropic/claude-sonnet-4',
709
791
  maxOutput: 64_000,
710
792
  pricing: {
711
- input: 3,
712
- output: 15,
793
+ units: [
794
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
795
+ { name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
796
+ ],
713
797
  },
714
798
  releasedAt: '2025-05-23',
715
799
  settings: {
@@ -730,8 +814,10 @@ const openrouterChatModels: AIChatModelCard[] = [
730
814
  id: 'anthropic/claude-opus-4',
731
815
  maxOutput: 32_000,
732
816
  pricing: {
733
- input: 15,
734
- output: 75,
817
+ units: [
818
+ { name: 'textInput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
819
+ { name: 'textOutput', rate: 75, strategy: 'fixed', unit: 'millionTokens' },
820
+ ],
735
821
  },
736
822
  releasedAt: '2025-05-23',
737
823
  settings: {
@@ -751,10 +837,17 @@ const openrouterChatModels: AIChatModelCard[] = [
751
837
  id: 'anthropic/claude-3-opus',
752
838
  maxOutput: 4096,
753
839
  pricing: {
754
- cachedInput: 1.5,
755
- input: 15,
756
- output: 75,
757
- writeCacheInput: 18.75,
840
+ units: [
841
+ { name: 'textInput_cacheRead', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
842
+ { name: 'textInput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
843
+ { name: 'textOutput', rate: 75, strategy: 'fixed', unit: 'millionTokens' },
844
+ {
845
+ lookup: { prices: { '5m': 18.75 }, pricingParams: ['ttl'] },
846
+ name: 'textInput_cacheWrite',
847
+ strategy: 'lookup',
848
+ unit: 'millionTokens',
849
+ },
850
+ ],
758
851
  },
759
852
  releasedAt: '2024-02-29',
760
853
  type: 'chat',
@@ -770,8 +863,10 @@ const openrouterChatModels: AIChatModelCard[] = [
770
863
  id: 'google/gemini-flash-1.5',
771
864
  maxOutput: 8192,
772
865
  pricing: {
773
- input: 0.075,
774
- output: 0.3,
866
+ units: [
867
+ { name: 'textInput', rate: 0.075, strategy: 'fixed', unit: 'millionTokens' },
868
+ { name: 'textOutput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
869
+ ],
775
870
  },
776
871
  type: 'chat',
777
872
  },
@@ -787,9 +882,11 @@ const openrouterChatModels: AIChatModelCard[] = [
787
882
  id: 'google/gemini-2.0-flash-001',
788
883
  maxOutput: 8192,
789
884
  pricing: {
790
- cachedInput: 0.025,
791
- input: 0.1,
792
- output: 0.4,
885
+ units: [
886
+ { name: 'textInput_cacheRead', rate: 0.025, strategy: 'fixed', unit: 'millionTokens' },
887
+ { name: 'textInput', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
888
+ { name: 'textOutput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
889
+ ],
793
890
  },
794
891
  releasedAt: '2025-02-05',
795
892
  type: 'chat',
@@ -805,8 +902,10 @@ const openrouterChatModels: AIChatModelCard[] = [
805
902
  id: 'google/gemini-pro-1.5',
806
903
  maxOutput: 8192,
807
904
  pricing: {
808
- input: 3.5,
809
- output: 10.5,
905
+ units: [
906
+ { name: 'textInput', rate: 3.5, strategy: 'fixed', unit: 'millionTokens' },
907
+ { name: 'textOutput', rate: 10.5, strategy: 'fixed', unit: 'millionTokens' },
908
+ ],
810
909
  },
811
910
  type: 'chat',
812
911
  },
@@ -820,8 +919,10 @@ const openrouterChatModels: AIChatModelCard[] = [
820
919
  displayName: 'Llama 3.2 11B Vision',
821
920
  id: 'meta-llama/llama-3.2-11b-vision-instruct',
822
921
  pricing: {
823
- input: 0.162,
824
- output: 0.162,
922
+ units: [
923
+ { name: 'textInput', rate: 0.162, strategy: 'fixed', unit: 'millionTokens' },
924
+ { name: 'textOutput', rate: 0.162, strategy: 'fixed', unit: 'millionTokens' },
925
+ ],
825
926
  },
826
927
  type: 'chat',
827
928
  },
@@ -835,8 +936,10 @@ const openrouterChatModels: AIChatModelCard[] = [
835
936
  displayName: 'Llama 3.2 90B Vision',
836
937
  id: 'meta-llama/llama-3.2-90b-vision-instruct',
837
938
  pricing: {
838
- input: 0.4,
839
- output: 0.4,
939
+ units: [
940
+ { name: 'textInput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
941
+ { name: 'textOutput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
942
+ ],
840
943
  },
841
944
  type: 'chat',
842
945
  },
@@ -850,8 +953,10 @@ const openrouterChatModels: AIChatModelCard[] = [
850
953
  displayName: 'Llama 3.3 70B Instruct',
851
954
  id: 'meta-llama/llama-3.3-70b-instruct',
852
955
  pricing: {
853
- input: 0.12,
854
- output: 0.3,
956
+ units: [
957
+ { name: 'textInput', rate: 0.12, strategy: 'fixed', unit: 'millionTokens' },
958
+ { name: 'textOutput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
959
+ ],
855
960
  },
856
961
  type: 'chat',
857
962
  },
@@ -12,7 +12,12 @@ const perplexityChatModels: AIChatModelCard[] = [
12
12
  enabled: true,
13
13
  id: 'sonar-deep-research',
14
14
  maxOutput: 8192,
15
- pricing: { input: 2, output: 8 },
15
+ pricing: {
16
+ units: [
17
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
18
+ { name: 'textOutput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
19
+ ],
20
+ },
16
21
  releasedAt: '2025-02-14',
17
22
  settings: {
18
23
  extendParams: ['reasoningEffort'],
@@ -32,7 +37,12 @@ const perplexityChatModels: AIChatModelCard[] = [
32
37
  enabled: true,
33
38
  id: 'sonar-reasoning-pro',
34
39
  maxOutput: 8192,
35
- pricing: { input: 2, output: 8 },
40
+ pricing: {
41
+ units: [
42
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
43
+ { name: 'textOutput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
44
+ ],
45
+ },
36
46
  releasedAt: '2025-01-21',
37
47
  settings: {
38
48
  searchImpl: 'internal',
@@ -51,7 +61,12 @@ const perplexityChatModels: AIChatModelCard[] = [
51
61
  enabled: true,
52
62
  id: 'sonar-reasoning',
53
63
  maxOutput: 8192,
54
- pricing: { input: 1, output: 5 },
64
+ pricing: {
65
+ units: [
66
+ { name: 'textInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
67
+ { name: 'textOutput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
68
+ ],
69
+ },
55
70
  releasedAt: '2025-01-21',
56
71
  settings: {
57
72
  searchImpl: 'internal',
@@ -68,7 +83,12 @@ const perplexityChatModels: AIChatModelCard[] = [
68
83
  displayName: 'Sonar Pro',
69
84
  enabled: true,
70
85
  id: 'sonar-pro',
71
- pricing: { input: 3, output: 15 },
86
+ pricing: {
87
+ units: [
88
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
89
+ { name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
90
+ ],
91
+ },
72
92
  releasedAt: '2025-01-21',
73
93
  settings: {
74
94
  searchImpl: 'internal',
@@ -85,7 +105,12 @@ const perplexityChatModels: AIChatModelCard[] = [
85
105
  displayName: 'Sonar',
86
106
  enabled: true,
87
107
  id: 'sonar',
88
- pricing: { input: 1, output: 1 },
108
+ pricing: {
109
+ units: [
110
+ { name: 'textInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
111
+ { name: 'textOutput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
112
+ ],
113
+ },
89
114
  releasedAt: '2025-01-21',
90
115
  settings: {
91
116
  searchImpl: 'internal',
@@ -102,7 +127,12 @@ const perplexityChatModels: AIChatModelCard[] = [
102
127
  'R1-1776 是 DeepSeek R1 模型的一个版本,经过后训练,可提供未经审查、无偏见的事实信息。',
103
128
  displayName: 'R1 1776',
104
129
  id: 'r1-1776',
105
- pricing: { input: 2, output: 8 },
130
+ pricing: {
131
+ units: [
132
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
133
+ { name: 'textOutput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
134
+ ],
135
+ },
106
136
  releasedAt: '2025-02-18',
107
137
  type: 'chat',
108
138
  },