@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
@@ -34,9 +34,11 @@ export const openaiChatModels: AIChatModelCard[] = [
34
34
  id: 'gpt-5',
35
35
  maxOutput: 128_000,
36
36
  pricing: {
37
- cachedInput: 0.13,
38
- input: 1.25,
39
- output: 10,
37
+ units: [
38
+ { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
39
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
40
+ { name: 'textInput_cacheRead', rate: 0.13, strategy: 'fixed', unit: 'millionTokens' },
41
+ ],
40
42
  },
41
43
  releasedAt: '2025-08-07',
42
44
  settings: {
@@ -60,9 +62,11 @@ export const openaiChatModels: AIChatModelCard[] = [
60
62
  id: 'gpt-5-mini',
61
63
  maxOutput: 128_000,
62
64
  pricing: {
63
- cachedInput: 0.03,
64
- input: 0.25,
65
- output: 2,
65
+ units: [
66
+ { name: 'textInput', rate: 0.25, strategy: 'fixed', unit: 'millionTokens' },
67
+ { name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
68
+ { name: 'textInput_cacheRead', rate: 0.03, strategy: 'fixed', unit: 'millionTokens' },
69
+ ],
66
70
  },
67
71
  releasedAt: '2025-08-07',
68
72
  settings: {
@@ -83,9 +87,11 @@ export const openaiChatModels: AIChatModelCard[] = [
83
87
  id: 'gpt-5-nano',
84
88
  maxOutput: 128_000,
85
89
  pricing: {
86
- cachedInput: 0.01,
87
- input: 0.05,
88
- output: 0.4,
90
+ units: [
91
+ { name: 'textInput', rate: 0.05, strategy: 'fixed', unit: 'millionTokens' },
92
+ { name: 'textOutput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
93
+ { name: 'textInput_cacheRead', rate: 0.01, strategy: 'fixed', unit: 'millionTokens' },
94
+ ],
89
95
  },
90
96
  releasedAt: '2025-08-07',
91
97
  type: 'chat',
@@ -102,9 +108,11 @@ export const openaiChatModels: AIChatModelCard[] = [
102
108
  id: 'gpt-5-chat-latest',
103
109
  maxOutput: 128_000,
104
110
  pricing: {
105
- cachedInput: 0.13,
106
- input: 1.25,
107
- output: 10,
111
+ units: [
112
+ { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
113
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
114
+ { name: 'textInput_cacheRead', rate: 0.13, strategy: 'fixed', unit: 'millionTokens' },
115
+ ],
108
116
  },
109
117
  releasedAt: '2025-08-07',
110
118
  type: 'chat',
@@ -124,9 +132,11 @@ export const openaiChatModels: AIChatModelCard[] = [
124
132
  id: 'o4-mini',
125
133
  maxOutput: 100_000,
126
134
  pricing: {
127
- cachedInput: 0.275,
128
- input: 1.1,
129
- output: 4.4,
135
+ units: [
136
+ { name: 'textInput_cacheRead', rate: 0.275, strategy: 'fixed', unit: 'millionTokens' },
137
+ { name: 'textInput', rate: 1.1, strategy: 'fixed', unit: 'millionTokens' },
138
+ { name: 'textOutput', rate: 4.4, strategy: 'fixed', unit: 'millionTokens' },
139
+ ],
130
140
  },
131
141
  releasedAt: '2025-04-17',
132
142
  settings: {
@@ -149,9 +159,11 @@ export const openaiChatModels: AIChatModelCard[] = [
149
159
  id: 'o4-mini-deep-research',
150
160
  maxOutput: 100_000,
151
161
  pricing: {
152
- cachedInput: 0.5,
153
- input: 2,
154
- output: 8,
162
+ units: [
163
+ { name: 'textInput_cacheRead', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
164
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
165
+ { name: 'textOutput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
166
+ ],
155
167
  },
156
168
  releasedAt: '2025-06-26',
157
169
  settings: {
@@ -174,8 +186,10 @@ export const openaiChatModels: AIChatModelCard[] = [
174
186
  id: 'o3-pro',
175
187
  maxOutput: 100_000,
176
188
  pricing: {
177
- input: 20,
178
- output: 80,
189
+ units: [
190
+ { name: 'textInput', rate: 20, strategy: 'fixed', unit: 'millionTokens' },
191
+ { name: 'textOutput', rate: 80, strategy: 'fixed', unit: 'millionTokens' },
192
+ ],
179
193
  },
180
194
  releasedAt: '2025-06-10',
181
195
  settings: {
@@ -199,9 +213,11 @@ export const openaiChatModels: AIChatModelCard[] = [
199
213
  id: 'o3',
200
214
  maxOutput: 100_000,
201
215
  pricing: {
202
- cachedInput: 0.5,
203
- input: 2,
204
- output: 8,
216
+ units: [
217
+ { name: 'textInput_cacheRead', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
218
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
219
+ { name: 'textOutput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
220
+ ],
205
221
  },
206
222
  releasedAt: '2025-04-16',
207
223
  settings: {
@@ -224,9 +240,11 @@ export const openaiChatModels: AIChatModelCard[] = [
224
240
  id: 'o3-deep-research',
225
241
  maxOutput: 100_000,
226
242
  pricing: {
227
- cachedInput: 2.5,
228
- input: 10,
229
- output: 40,
243
+ units: [
244
+ { name: 'textInput_cacheRead', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
245
+ { name: 'textInput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
246
+ { name: 'textOutput', rate: 40, strategy: 'fixed', unit: 'millionTokens' },
247
+ ],
230
248
  },
231
249
  releasedAt: '2025-06-26',
232
250
  settings: {
@@ -247,9 +265,11 @@ export const openaiChatModels: AIChatModelCard[] = [
247
265
  id: 'o3-mini',
248
266
  maxOutput: 100_000,
249
267
  pricing: {
250
- cachedInput: 0.55,
251
- input: 1.1,
252
- output: 4.4,
268
+ units: [
269
+ { name: 'textInput_cacheRead', rate: 0.55, strategy: 'fixed', unit: 'millionTokens' },
270
+ { name: 'textInput', rate: 1.1, strategy: 'fixed', unit: 'millionTokens' },
271
+ { name: 'textOutput', rate: 4.4, strategy: 'fixed', unit: 'millionTokens' },
272
+ ],
253
273
  },
254
274
  releasedAt: '2025-01-31',
255
275
  settings: {
@@ -270,8 +290,10 @@ export const openaiChatModels: AIChatModelCard[] = [
270
290
  id: 'o1-pro',
271
291
  maxOutput: 100_000,
272
292
  pricing: {
273
- input: 150,
274
- output: 600,
293
+ units: [
294
+ { name: 'textInput', rate: 150, strategy: 'fixed', unit: 'millionTokens' },
295
+ { name: 'textOutput', rate: 600, strategy: 'fixed', unit: 'millionTokens' },
296
+ ],
275
297
  },
276
298
  releasedAt: '2025-03-19',
277
299
  settings: {
@@ -290,9 +312,11 @@ export const openaiChatModels: AIChatModelCard[] = [
290
312
  id: 'o1-mini', // deprecated on 2025-10-27
291
313
  maxOutput: 65_536,
292
314
  pricing: {
293
- cachedInput: 0.55,
294
- input: 1.1,
295
- output: 4.4,
315
+ units: [
316
+ { name: 'textInput_cacheRead', rate: 0.55, strategy: 'fixed', unit: 'millionTokens' },
317
+ { name: 'textInput', rate: 1.1, strategy: 'fixed', unit: 'millionTokens' },
318
+ { name: 'textOutput', rate: 4.4, strategy: 'fixed', unit: 'millionTokens' },
319
+ ],
296
320
  },
297
321
  releasedAt: '2024-09-12',
298
322
  settings: {
@@ -313,9 +337,11 @@ export const openaiChatModels: AIChatModelCard[] = [
313
337
  id: 'o1',
314
338
  maxOutput: 100_000,
315
339
  pricing: {
316
- cachedInput: 7.5,
317
- input: 15,
318
- output: 60,
340
+ units: [
341
+ { name: 'textInput_cacheRead', rate: 7.5, strategy: 'fixed', unit: 'millionTokens' },
342
+ { name: 'textInput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
343
+ { name: 'textOutput', rate: 60, strategy: 'fixed', unit: 'millionTokens' },
344
+ ],
319
345
  },
320
346
  releasedAt: '2024-12-17',
321
347
  settings: {
@@ -334,8 +360,10 @@ export const openaiChatModels: AIChatModelCard[] = [
334
360
  id: 'o1-preview',
335
361
  maxOutput: 32_768,
336
362
  pricing: {
337
- input: 15,
338
- output: 60,
363
+ units: [
364
+ { name: 'textInput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
365
+ { name: 'textOutput', rate: 60, strategy: 'fixed', unit: 'millionTokens' },
366
+ ],
339
367
  },
340
368
  releasedAt: '2024-09-12',
341
369
  settings: {
@@ -355,9 +383,11 @@ export const openaiChatModels: AIChatModelCard[] = [
355
383
  id: 'gpt-4.1',
356
384
  maxOutput: 32_768,
357
385
  pricing: {
358
- cachedInput: 0.5,
359
- input: 2,
360
- output: 8,
386
+ units: [
387
+ { name: 'textInput_cacheRead', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
388
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
389
+ { name: 'textOutput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
390
+ ],
361
391
  },
362
392
  releasedAt: '2025-04-14',
363
393
  settings: {
@@ -378,9 +408,11 @@ export const openaiChatModels: AIChatModelCard[] = [
378
408
  id: 'gpt-4.1-mini',
379
409
  maxOutput: 32_768,
380
410
  pricing: {
381
- cachedInput: 0.1,
382
- input: 0.4,
383
- output: 1.6,
411
+ units: [
412
+ { name: 'textInput_cacheRead', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
413
+ { name: 'textInput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
414
+ { name: 'textOutput', rate: 1.6, strategy: 'fixed', unit: 'millionTokens' },
415
+ ],
384
416
  },
385
417
  releasedAt: '2025-04-14',
386
418
  settings: {
@@ -399,9 +431,11 @@ export const openaiChatModels: AIChatModelCard[] = [
399
431
  id: 'gpt-4.1-nano',
400
432
  maxOutput: 32_768,
401
433
  pricing: {
402
- cachedInput: 0.025,
403
- input: 0.1,
404
- output: 0.4,
434
+ units: [
435
+ { name: 'textInput_cacheRead', rate: 0.025, strategy: 'fixed', unit: 'millionTokens' },
436
+ { name: 'textInput', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
437
+ { name: 'textOutput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
438
+ ],
405
439
  },
406
440
  releasedAt: '2025-04-14',
407
441
  type: 'chat',
@@ -418,9 +452,11 @@ export const openaiChatModels: AIChatModelCard[] = [
418
452
  id: 'gpt-4.5-preview', // deprecated on 2025-07-14
419
453
  maxOutput: 16_384,
420
454
  pricing: {
421
- cachedInput: 37.5,
422
- input: 75,
423
- output: 150,
455
+ units: [
456
+ { name: 'textInput_cacheRead', rate: 37.5, strategy: 'fixed', unit: 'millionTokens' },
457
+ { name: 'textInput', rate: 75, strategy: 'fixed', unit: 'millionTokens' },
458
+ { name: 'textOutput', rate: 150, strategy: 'fixed', unit: 'millionTokens' },
459
+ ],
424
460
  },
425
461
  releasedAt: '2025-02-27',
426
462
  type: 'chat',
@@ -438,9 +474,11 @@ export const openaiChatModels: AIChatModelCard[] = [
438
474
  id: 'gpt-4o-mini',
439
475
  maxOutput: 16_384,
440
476
  pricing: {
441
- cachedInput: 0.075,
442
- input: 0.15,
443
- output: 0.6,
477
+ units: [
478
+ { name: 'textInput_cacheRead', rate: 0.075, strategy: 'fixed', unit: 'millionTokens' },
479
+ { name: 'textInput', rate: 0.15, strategy: 'fixed', unit: 'millionTokens' },
480
+ { name: 'textOutput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
481
+ ],
444
482
  },
445
483
  releasedAt: '2024-07-18',
446
484
  settings: {
@@ -459,8 +497,10 @@ export const openaiChatModels: AIChatModelCard[] = [
459
497
  id: 'gpt-4o-mini-search-preview',
460
498
  maxOutput: 16_384,
461
499
  pricing: {
462
- input: 0.15,
463
- output: 0.6,
500
+ units: [
501
+ { name: 'textInput', rate: 0.15, strategy: 'fixed', unit: 'millionTokens' },
502
+ { name: 'textOutput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
503
+ ],
464
504
  },
465
505
  releasedAt: '2025-03-11',
466
506
  settings: {
@@ -479,8 +519,10 @@ export const openaiChatModels: AIChatModelCard[] = [
479
519
  id: 'gpt-4o-mini-audio-preview',
480
520
  maxOutput: 16_384,
481
521
  pricing: {
482
- input: 0.15,
483
- output: 0.6,
522
+ units: [
523
+ { name: 'textInput', rate: 0.15, strategy: 'fixed', unit: 'millionTokens' },
524
+ { name: 'textOutput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
525
+ ],
484
526
  },
485
527
  releasedAt: '2024-12-17',
486
528
  /*
@@ -502,9 +544,11 @@ export const openaiChatModels: AIChatModelCard[] = [
502
544
  displayName: 'GPT-4o',
503
545
  id: 'gpt-4o',
504
546
  pricing: {
505
- cachedInput: 1.25,
506
- input: 2.5,
507
- output: 10,
547
+ units: [
548
+ { name: 'textInput_cacheRead', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
549
+ { name: 'textInput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
550
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
551
+ ],
508
552
  },
509
553
  releasedAt: '2024-05-13',
510
554
  settings: {
@@ -523,8 +567,10 @@ export const openaiChatModels: AIChatModelCard[] = [
523
567
  id: 'gpt-4o-search-preview',
524
568
  maxOutput: 16_384,
525
569
  pricing: {
526
- input: 2.5,
527
- output: 10,
570
+ units: [
571
+ { name: 'textInput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
572
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
573
+ ],
528
574
  },
529
575
  releasedAt: '2025-03-11',
530
576
  settings: {
@@ -544,9 +590,11 @@ export const openaiChatModels: AIChatModelCard[] = [
544
590
  displayName: 'GPT-4o 1120',
545
591
  id: 'gpt-4o-2024-11-20',
546
592
  pricing: {
547
- cachedInput: 1.25,
548
- input: 2.5,
549
- output: 10,
593
+ units: [
594
+ { name: 'textInput_cacheRead', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
595
+ { name: 'textInput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
596
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
597
+ ],
550
598
  },
551
599
  releasedAt: '2024-11-20',
552
600
  settings: {
@@ -566,8 +614,10 @@ export const openaiChatModels: AIChatModelCard[] = [
566
614
  displayName: 'GPT-4o 0513',
567
615
  id: 'gpt-4o-2024-05-13',
568
616
  pricing: {
569
- input: 5,
570
- output: 15,
617
+ units: [
618
+ { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
619
+ { name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
620
+ ],
571
621
  },
572
622
  releasedAt: '2024-05-13',
573
623
  settings: {
@@ -586,8 +636,10 @@ export const openaiChatModels: AIChatModelCard[] = [
586
636
  id: 'gpt-4o-audio-preview',
587
637
  maxOutput: 16_384,
588
638
  pricing: {
589
- input: 2.5,
590
- output: 10,
639
+ units: [
640
+ { name: 'textInput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
641
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
642
+ ],
591
643
  },
592
644
  releasedAt: '2024-12-17',
593
645
  /*
@@ -607,8 +659,10 @@ export const openaiChatModels: AIChatModelCard[] = [
607
659
  displayName: 'ChatGPT-4o',
608
660
  id: 'chatgpt-4o-latest',
609
661
  pricing: {
610
- input: 5,
611
- output: 15,
662
+ units: [
663
+ { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
664
+ { name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
665
+ ],
612
666
  },
613
667
  releasedAt: '2024-08-14',
614
668
  type: 'chat',
@@ -624,8 +678,10 @@ export const openaiChatModels: AIChatModelCard[] = [
624
678
  displayName: 'GPT-4 Turbo',
625
679
  id: 'gpt-4-turbo',
626
680
  pricing: {
627
- input: 10,
628
- output: 30,
681
+ units: [
682
+ { name: 'textInput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
683
+ { name: 'textOutput', rate: 30, strategy: 'fixed', unit: 'millionTokens' },
684
+ ],
629
685
  },
630
686
  type: 'chat',
631
687
  },
@@ -640,8 +696,10 @@ export const openaiChatModels: AIChatModelCard[] = [
640
696
  displayName: 'GPT-4 Turbo Vision 0409',
641
697
  id: 'gpt-4-turbo-2024-04-09',
642
698
  pricing: {
643
- input: 10,
644
- output: 30,
699
+ units: [
700
+ { name: 'textInput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
701
+ { name: 'textOutput', rate: 30, strategy: 'fixed', unit: 'millionTokens' },
702
+ ],
645
703
  },
646
704
  releasedAt: '2024-04-09',
647
705
  type: 'chat',
@@ -656,8 +714,10 @@ export const openaiChatModels: AIChatModelCard[] = [
656
714
  displayName: 'GPT-4 Turbo Preview',
657
715
  id: 'gpt-4-turbo-preview',
658
716
  pricing: {
659
- input: 10,
660
- output: 30,
717
+ units: [
718
+ { name: 'textInput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
719
+ { name: 'textOutput', rate: 30, strategy: 'fixed', unit: 'millionTokens' },
720
+ ],
661
721
  },
662
722
  type: 'chat',
663
723
  },
@@ -671,8 +731,10 @@ export const openaiChatModels: AIChatModelCard[] = [
671
731
  displayName: 'GPT-4 Turbo Preview 0125',
672
732
  id: 'gpt-4-0125-preview',
673
733
  pricing: {
674
- input: 10,
675
- output: 30,
734
+ units: [
735
+ { name: 'textInput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
736
+ { name: 'textOutput', rate: 30, strategy: 'fixed', unit: 'millionTokens' },
737
+ ],
676
738
  },
677
739
  releasedAt: '2024-01-25',
678
740
  type: 'chat',
@@ -687,8 +749,10 @@ export const openaiChatModels: AIChatModelCard[] = [
687
749
  displayName: 'GPT-4 Turbo Preview 1106',
688
750
  id: 'gpt-4-1106-preview',
689
751
  pricing: {
690
- input: 10,
691
- output: 30,
752
+ units: [
753
+ { name: 'textInput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
754
+ { name: 'textOutput', rate: 30, strategy: 'fixed', unit: 'millionTokens' },
755
+ ],
692
756
  },
693
757
  releasedAt: '2023-11-06',
694
758
  type: 'chat',
@@ -703,8 +767,10 @@ export const openaiChatModels: AIChatModelCard[] = [
703
767
  displayName: 'GPT-4',
704
768
  id: 'gpt-4',
705
769
  pricing: {
706
- input: 30,
707
- output: 60,
770
+ units: [
771
+ { name: 'textInput', rate: 30, strategy: 'fixed', unit: 'millionTokens' },
772
+ { name: 'textOutput', rate: 60, strategy: 'fixed', unit: 'millionTokens' },
773
+ ],
708
774
  },
709
775
  type: 'chat',
710
776
  },
@@ -718,8 +784,10 @@ export const openaiChatModels: AIChatModelCard[] = [
718
784
  displayName: 'GPT-4 0613',
719
785
  id: 'gpt-4-0613',
720
786
  pricing: {
721
- input: 30,
722
- output: 60,
787
+ units: [
788
+ { name: 'textInput', rate: 30, strategy: 'fixed', unit: 'millionTokens' },
789
+ { name: 'textOutput', rate: 60, strategy: 'fixed', unit: 'millionTokens' },
790
+ ],
723
791
  },
724
792
  releasedAt: '2023-06-13',
725
793
  type: 'chat',
@@ -734,8 +802,10 @@ export const openaiChatModels: AIChatModelCard[] = [
734
802
  displayName: 'GPT-3.5 Turbo',
735
803
  id: 'gpt-3.5-turbo',
736
804
  pricing: {
737
- input: 0.5,
738
- output: 1.5,
805
+ units: [
806
+ { name: 'textInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
807
+ { name: 'textOutput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
808
+ ],
739
809
  },
740
810
  type: 'chat',
741
811
  },
@@ -749,8 +819,10 @@ export const openaiChatModels: AIChatModelCard[] = [
749
819
  displayName: 'GPT-3.5 Turbo 0125',
750
820
  id: 'gpt-3.5-turbo-0125',
751
821
  pricing: {
752
- input: 0.5,
753
- output: 1.5,
822
+ units: [
823
+ { name: 'textInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
824
+ { name: 'textOutput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
825
+ ],
754
826
  },
755
827
  releasedAt: '2024-01-25',
756
828
  type: 'chat',
@@ -765,8 +837,10 @@ export const openaiChatModels: AIChatModelCard[] = [
765
837
  displayName: 'GPT-3.5 Turbo 1106',
766
838
  id: 'gpt-3.5-turbo-1106',
767
839
  pricing: {
768
- input: 1,
769
- output: 2,
840
+ units: [
841
+ { name: 'textInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
842
+ { name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
843
+ ],
770
844
  },
771
845
  releasedAt: '2023-11-06',
772
846
  type: 'chat',
@@ -777,8 +851,10 @@ export const openaiChatModels: AIChatModelCard[] = [
777
851
  displayName: 'GPT-3.5 Turbo Instruct',
778
852
  id: 'gpt-3.5-turbo-instruct',
779
853
  pricing: {
780
- input: 1.5,
781
- output: 2,
854
+ units: [
855
+ { name: 'textInput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
856
+ { name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
857
+ ],
782
858
  },
783
859
  type: 'chat',
784
860
  },
@@ -795,9 +871,11 @@ export const openaiChatModels: AIChatModelCard[] = [
795
871
  id: 'codex-mini-latest',
796
872
  maxOutput: 100_000,
797
873
  pricing: {
798
- cachedInput: 0.375,
799
- input: 1.5,
800
- output: 6,
874
+ units: [
875
+ { name: 'textInput_cacheRead', rate: 0.375, strategy: 'fixed', unit: 'millionTokens' },
876
+ { name: 'textInput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
877
+ { name: 'textOutput', rate: 6, strategy: 'fixed', unit: 'millionTokens' },
878
+ ],
801
879
  },
802
880
  releasedAt: '2025-06-01',
803
881
  settings: {
@@ -818,8 +896,10 @@ export const openaiChatModels: AIChatModelCard[] = [
818
896
  id: 'computer-use-preview',
819
897
  maxOutput: 1024,
820
898
  pricing: {
821
- input: 3,
822
- output: 12,
899
+ units: [
900
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
901
+ { name: 'textOutput', rate: 12, strategy: 'fixed', unit: 'millionTokens' },
902
+ ],
823
903
  },
824
904
  releasedAt: '2025-03-11',
825
905
  settings: {
@@ -838,7 +918,7 @@ export const openaiEmbeddingModels: AIEmbeddingModelCard[] = [
838
918
  maxDimension: 3072,
839
919
  pricing: {
840
920
  currency: 'USD',
841
- input: 0.13,
921
+ units: [{ name: 'textInput', rate: 0.13, strategy: 'fixed', unit: 'millionTokens' }],
842
922
  },
843
923
  releasedAt: '2024-01-25',
844
924
  type: 'embedding',
@@ -851,7 +931,7 @@ export const openaiEmbeddingModels: AIEmbeddingModelCard[] = [
851
931
  maxDimension: 1536,
852
932
  pricing: {
853
933
  currency: 'USD',
854
- input: 0.02,
934
+ units: [{ name: 'textInput', rate: 0.02, strategy: 'fixed', unit: 'millionTokens' }],
855
935
  },
856
936
  releasedAt: '2024-01-25',
857
937
  type: 'embedding',
@@ -865,7 +945,7 @@ export const openaiTTSModels: AITTSModelCard[] = [
865
945
  displayName: 'TTS-1',
866
946
  id: 'tts-1',
867
947
  pricing: {
868
- input: 15,
948
+ units: [{ name: 'textInput', rate: 15, strategy: 'fixed', unit: 'millionCharacters' }],
869
949
  },
870
950
  type: 'tts',
871
951
  },
@@ -874,7 +954,7 @@ export const openaiTTSModels: AITTSModelCard[] = [
874
954
  displayName: 'TTS-1 HD',
875
955
  id: 'tts-1-hd',
876
956
  pricing: {
877
- input: 30,
957
+ units: [{ name: 'textInput', rate: 30, strategy: 'fixed', unit: 'millionCharacters' }],
878
958
  },
879
959
  type: 'tts',
880
960
  },
@@ -884,8 +964,10 @@ export const openaiTTSModels: AITTSModelCard[] = [
884
964
  displayName: 'GPT-4o Mini TTS',
885
965
  id: 'gpt-4o-mini-tts',
886
966
  pricing: {
887
- input: 0.6,
888
- output: 12,
967
+ units: [
968
+ { name: 'textInput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
969
+ { name: 'audioOutput', rate: 12, strategy: 'fixed', unit: 'millionTokens' },
970
+ ],
889
971
  },
890
972
  type: 'tts',
891
973
  },
@@ -898,7 +980,14 @@ export const openaiSTTModels: AISTTModelCard[] = [
898
980
  displayName: 'Whisper',
899
981
  id: 'whisper-1',
900
982
  pricing: {
901
- input: 0.006, // per minute
983
+ units: [
984
+ {
985
+ name: 'audioInput',
986
+ rate: 0.0001, // $0.006 per minute => $0.0001 per second
987
+ strategy: 'fixed',
988
+ unit: 'second',
989
+ },
990
+ ],
902
991
  },
903
992
  type: 'stt',
904
993
  },
@@ -910,8 +999,11 @@ export const openaiSTTModels: AISTTModelCard[] = [
910
999
  id: 'gpt-4o-transcribe',
911
1000
  maxOutput: 2000,
912
1001
  pricing: {
913
- input: 6, // Audio
914
- output: 10,
1002
+ units: [
1003
+ { name: 'textInput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
1004
+ { name: 'audioInput', rate: 6, strategy: 'fixed', unit: 'millionTokens' },
1005
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
1006
+ ],
915
1007
  },
916
1008
  type: 'stt',
917
1009
  },
@@ -923,8 +1015,11 @@ export const openaiSTTModels: AISTTModelCard[] = [
923
1015
  id: 'gpt-4o-mini-transcribe',
924
1016
  maxOutput: 2000,
925
1017
  pricing: {
926
- input: 3, // Audio
927
- output: 5,
1018
+ units: [
1019
+ { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
1020
+ { name: 'audioInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
1021
+ { name: 'textOutput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
1022
+ ],
928
1023
  },
929
1024
  type: 'stt',
930
1025
  },
@@ -954,8 +1049,24 @@ export const openaiImageModels: AIImageModelCard[] = [
954
1049
  },
955
1050
  },
956
1051
  pricing: {
957
- hd: 0.08,
958
- standard: 0.04,
1052
+ units: [
1053
+ {
1054
+ lookup: {
1055
+ prices: {
1056
+ hd_1024x1024: 0.08,
1057
+ hd_1024x1792: 0.12,
1058
+ hd_1792x1024: 0.12,
1059
+ standard_1024x1024: 0.04,
1060
+ standard_1024x1792: 0.08,
1061
+ standard_1792x1024: 0.08,
1062
+ },
1063
+ pricingParams: ['quality', 'size'],
1064
+ },
1065
+ name: 'imageGeneration',
1066
+ strategy: 'lookup',
1067
+ unit: 'image',
1068
+ },
1069
+ ],
959
1070
  },
960
1071
  resolutions: ['1024x1024', '1024x1792', '1792x1024'],
961
1072
  type: 'image',
@@ -973,7 +1084,21 @@ export const openaiImageModels: AIImageModelCard[] = [
973
1084
  },
974
1085
  },
975
1086
  pricing: {
976
- input: 0.02, // $0.020 per image (1024×1024)
1087
+ units: [
1088
+ {
1089
+ lookup: {
1090
+ prices: {
1091
+ '1024x1024': 0.02,
1092
+ '256x256': 0.016,
1093
+ '512x512': 0.018,
1094
+ },
1095
+ pricingParams: ['size'],
1096
+ },
1097
+ name: 'imageGeneration',
1098
+ strategy: 'lookup',
1099
+ unit: 'image',
1100
+ },
1101
+ ],
977
1102
  },
978
1103
  resolutions: ['256x256', '512x512', '1024x1024'],
979
1104
  type: 'image',
@@ -989,12 +1114,14 @@ export const openaiRealtimeModels: AIRealtimeModelCard[] = [
989
1114
  id: 'gpt-4o-realtime-preview',
990
1115
  maxOutput: 4096,
991
1116
  pricing: {
992
- audioInput: 40,
993
- audioOutput: 80,
994
- cachedAudioInput: 2.5,
995
- cachedInput: 2.5,
996
- input: 5,
997
- output: 20,
1117
+ units: [
1118
+ { name: 'audioInput', rate: 40, strategy: 'fixed', unit: 'millionTokens' },
1119
+ { name: 'audioOutput', rate: 80, strategy: 'fixed', unit: 'millionTokens' },
1120
+ { name: 'audioInput_cacheRead', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
1121
+ { name: 'textInput_cacheRead', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
1122
+ { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
1123
+ { name: 'textOutput', rate: 20, strategy: 'fixed', unit: 'millionTokens' },
1124
+ ],
998
1125
  },
999
1126
  releasedAt: '2024-12-17',
1000
1127
  type: 'realtime',
@@ -1006,12 +1133,14 @@ export const openaiRealtimeModels: AIRealtimeModelCard[] = [
1006
1133
  id: 'gpt-4o-realtime-preview-2025-06-03',
1007
1134
  maxOutput: 4096,
1008
1135
  pricing: {
1009
- audioInput: 40,
1010
- audioOutput: 80,
1011
- cachedAudioInput: 2.5,
1012
- cachedInput: 2.5,
1013
- input: 5,
1014
- output: 20,
1136
+ units: [
1137
+ { name: 'audioInput', rate: 40, strategy: 'fixed', unit: 'millionTokens' },
1138
+ { name: 'audioOutput', rate: 80, strategy: 'fixed', unit: 'millionTokens' },
1139
+ { name: 'audioInput_cacheRead', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
1140
+ { name: 'textInput_cacheRead', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
1141
+ { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
1142
+ { name: 'textOutput', rate: 20, strategy: 'fixed', unit: 'millionTokens' },
1143
+ ],
1015
1144
  },
1016
1145
  releasedAt: '2025-06-03',
1017
1146
  type: 'realtime',
@@ -1023,12 +1152,14 @@ export const openaiRealtimeModels: AIRealtimeModelCard[] = [
1023
1152
  id: 'gpt-4o-realtime-preview-2024-10-01', // deprecated on 2025-09-10
1024
1153
  maxOutput: 4096,
1025
1154
  pricing: {
1026
- audioInput: 100,
1027
- audioOutput: 200,
1028
- cachedAudioInput: 20,
1029
- cachedInput: 2.5,
1030
- input: 5,
1031
- output: 20,
1155
+ units: [
1156
+ { name: 'audioInput', rate: 100, strategy: 'fixed', unit: 'millionTokens' },
1157
+ { name: 'audioOutput', rate: 200, strategy: 'fixed', unit: 'millionTokens' },
1158
+ { name: 'audioInput_cacheRead', rate: 20, strategy: 'fixed', unit: 'millionTokens' },
1159
+ { name: 'textInput_cacheRead', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
1160
+ { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
1161
+ { name: 'textOutput', rate: 20, strategy: 'fixed', unit: 'millionTokens' },
1162
+ ],
1032
1163
  },
1033
1164
  releasedAt: '2024-10-01',
1034
1165
  type: 'realtime',
@@ -1040,12 +1171,14 @@ export const openaiRealtimeModels: AIRealtimeModelCard[] = [
1040
1171
  id: 'gpt-4o-mini-realtime-preview',
1041
1172
  maxOutput: 4096,
1042
1173
  pricing: {
1043
- audioInput: 10,
1044
- audioOutput: 20,
1045
- cachedAudioInput: 0.3,
1046
- cachedInput: 0.3,
1047
- input: 0.6,
1048
- output: 2.4,
1174
+ units: [
1175
+ { name: 'audioInput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
1176
+ { name: 'audioOutput', rate: 20, strategy: 'fixed', unit: 'millionTokens' },
1177
+ { name: 'audioInput_cacheRead', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
1178
+ { name: 'textInput_cacheRead', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
1179
+ { name: 'textInput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
1180
+ { name: 'textOutput', rate: 2.4, strategy: 'fixed', unit: 'millionTokens' },
1181
+ ],
1049
1182
  },
1050
1183
  releasedAt: '2024-12-17',
1051
1184
  type: 'realtime',