@lobehub/chat 1.88.1 → 1.88.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.
- package/CHANGELOG.md +58 -0
- package/changelog/v1.json +21 -0
- package/locales/ar/models.json +6 -0
- package/locales/ar/plugin.json +1 -0
- package/locales/bg-BG/models.json +6 -0
- package/locales/bg-BG/plugin.json +1 -0
- package/locales/de-DE/models.json +6 -0
- package/locales/de-DE/plugin.json +1 -0
- package/locales/en-US/models.json +6 -0
- package/locales/en-US/plugin.json +1 -0
- package/locales/es-ES/models.json +6 -0
- package/locales/es-ES/plugin.json +1 -0
- package/locales/fa-IR/models.json +6 -0
- package/locales/fa-IR/plugin.json +1 -0
- package/locales/fr-FR/models.json +6 -0
- package/locales/fr-FR/plugin.json +1 -0
- package/locales/it-IT/models.json +6 -0
- package/locales/it-IT/plugin.json +1 -0
- package/locales/ja-JP/models.json +6 -0
- package/locales/ja-JP/plugin.json +1 -0
- package/locales/ko-KR/models.json +6 -0
- package/locales/ko-KR/plugin.json +1 -0
- package/locales/nl-NL/models.json +6 -0
- package/locales/nl-NL/plugin.json +1 -0
- package/locales/pl-PL/models.json +6 -0
- package/locales/pl-PL/plugin.json +1 -0
- package/locales/pt-BR/models.json +6 -0
- package/locales/pt-BR/plugin.json +1 -0
- package/locales/ru-RU/models.json +6 -0
- package/locales/ru-RU/plugin.json +1 -0
- package/locales/tr-TR/models.json +6 -0
- package/locales/tr-TR/plugin.json +3 -2
- package/locales/vi-VN/models.json +6 -0
- package/locales/vi-VN/plugin.json +1 -0
- package/locales/zh-CN/models.json +7 -1
- package/locales/zh-CN/plugin.json +1 -0
- package/locales/zh-TW/models.json +6 -0
- package/locales/zh-TW/plugin.json +1 -0
- package/package.json +1 -1
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/WelcomeMessage.tsx +5 -1
- package/src/config/aiModels/anthropic.ts +41 -41
- package/src/config/aiModels/google.ts +70 -1
- package/src/config/aiModels/hunyuan.ts +15 -2
- package/src/config/aiModels/novita.ts +12 -12
- package/src/config/aiModels/xai.ts +38 -43
- package/src/libs/model-runtime/anthropic/index.test.ts +23 -10
- package/src/libs/model-runtime/anthropic/index.ts +20 -8
- package/src/libs/model-runtime/google/index.ts +5 -0
- package/src/libs/model-runtime/xai/index.test.ts +0 -4
- package/src/libs/model-runtime/xai/index.ts +23 -3
- package/src/libs/oidc-provider/provider.ts +1 -1
- package/src/locales/default/plugin.ts +1 -0
@@ -9,16 +9,16 @@ const anthropicChatModels: AIChatModelCard[] = [
|
|
9
9
|
},
|
10
10
|
contextWindowTokens: 200_000,
|
11
11
|
description:
|
12
|
-
'Claude 4
|
13
|
-
displayName: 'Claude 4
|
12
|
+
'Claude Opus 4 是 Anthropic 用于处理高度复杂任务的最强大模型。它在性能、智能、流畅性和理解力方面表现卓越。',
|
13
|
+
displayName: 'Claude Opus 4',
|
14
14
|
enabled: true,
|
15
|
-
id: 'claude-
|
16
|
-
maxOutput:
|
15
|
+
id: 'claude-opus-4-20250514',
|
16
|
+
maxOutput: 32_000,
|
17
17
|
pricing: {
|
18
|
-
cachedInput:
|
19
|
-
input:
|
20
|
-
output:
|
21
|
-
writeCacheInput:
|
18
|
+
cachedInput: 1.5,
|
19
|
+
input: 15,
|
20
|
+
output: 75,
|
21
|
+
writeCacheInput: 18.75,
|
22
22
|
},
|
23
23
|
releasedAt: '2025-05-23',
|
24
24
|
settings: {
|
@@ -29,20 +29,21 @@ const anthropicChatModels: AIChatModelCard[] = [
|
|
29
29
|
{
|
30
30
|
abilities: {
|
31
31
|
functionCall: true,
|
32
|
+
reasoning: true,
|
32
33
|
vision: true,
|
33
34
|
},
|
34
35
|
contextWindowTokens: 200_000,
|
35
36
|
description:
|
36
|
-
'Claude
|
37
|
-
displayName: 'Claude
|
37
|
+
'Claude Sonnet 4 可以产生近乎即时的响应或延长的逐步思考,用户可以清晰地看到这些过程。API 用户还可以对模型思考的时间进行细致的控制',
|
38
|
+
displayName: 'Claude Sonnet 4',
|
38
39
|
enabled: true,
|
39
|
-
id: 'claude-
|
40
|
-
maxOutput:
|
40
|
+
id: 'claude-sonnet-4-20250514',
|
41
|
+
maxOutput: 64_000,
|
41
42
|
pricing: {
|
42
|
-
cachedInput:
|
43
|
-
input:
|
44
|
-
output:
|
45
|
-
writeCacheInput:
|
43
|
+
cachedInput: 0.3,
|
44
|
+
input: 3,
|
45
|
+
output: 15,
|
46
|
+
writeCacheInput: 3.75,
|
46
47
|
},
|
47
48
|
releasedAt: '2025-05-23',
|
48
49
|
settings: {
|
@@ -59,10 +60,10 @@ const anthropicChatModels: AIChatModelCard[] = [
|
|
59
60
|
contextWindowTokens: 200_000,
|
60
61
|
description:
|
61
62
|
'Claude 3.7 Sonnet 是 Anthropic 迄今为止最智能的模型,也是市场上首个混合推理模型。Claude 3.7 Sonnet 可以产生近乎即时的响应或延长的逐步思考,用户可以清晰地看到这些过程。Sonnet 特别擅长编程、数据科学、视觉处理、代理任务。',
|
62
|
-
displayName: 'Claude 3.7 Sonnet
|
63
|
+
displayName: 'Claude 3.7 Sonnet',
|
63
64
|
enabled: true,
|
64
65
|
id: 'claude-3-7-sonnet-20250219',
|
65
|
-
maxOutput:
|
66
|
+
maxOutput: 64_000,
|
66
67
|
pricing: {
|
67
68
|
cachedInput: 0.3,
|
68
69
|
input: 3,
|
@@ -82,18 +83,17 @@ const anthropicChatModels: AIChatModelCard[] = [
|
|
82
83
|
},
|
83
84
|
contextWindowTokens: 200_000,
|
84
85
|
description:
|
85
|
-
'Claude 3.5
|
86
|
-
displayName: 'Claude 3.5
|
87
|
-
|
88
|
-
id: 'claude-3-5-haiku-20241022',
|
86
|
+
'Claude 3.5 Sonnet 提供了超越 Opus 的能力和比 Sonnet 更快的速度,同时保持与 Sonnet 相同的价格。Sonnet 特别擅长编程、数据科学、视觉处理、代理任务。',
|
87
|
+
displayName: 'Claude 3.5 Sonnet v2',
|
88
|
+
id: 'claude-3-5-sonnet-20241022',
|
89
89
|
maxOutput: 8192,
|
90
90
|
pricing: {
|
91
|
-
cachedInput: 0.
|
92
|
-
input:
|
93
|
-
output:
|
94
|
-
writeCacheInput:
|
91
|
+
cachedInput: 0.3,
|
92
|
+
input: 3,
|
93
|
+
output: 15,
|
94
|
+
writeCacheInput: 3.75,
|
95
95
|
},
|
96
|
-
releasedAt: '2024-
|
96
|
+
releasedAt: '2024-10-22',
|
97
97
|
settings: {
|
98
98
|
extendParams: ['disableContextCaching'],
|
99
99
|
},
|
@@ -108,8 +108,7 @@ const anthropicChatModels: AIChatModelCard[] = [
|
|
108
108
|
description:
|
109
109
|
'Claude 3.5 Sonnet 提供了超越 Opus 的能力和比 Sonnet 更快的速度,同时保持与 Sonnet 相同的价格。Sonnet 特别擅长编程、数据科学、视觉处理、代理任务。',
|
110
110
|
displayName: 'Claude 3.5 Sonnet',
|
111
|
-
|
112
|
-
id: 'claude-3-5-sonnet-20241022',
|
111
|
+
id: 'claude-3-5-sonnet-20240620',
|
113
112
|
maxOutput: 8192,
|
114
113
|
pricing: {
|
115
114
|
cachedInput: 0.3,
|
@@ -117,7 +116,7 @@ const anthropicChatModels: AIChatModelCard[] = [
|
|
117
116
|
output: 15,
|
118
117
|
writeCacheInput: 3.75,
|
119
118
|
},
|
120
|
-
releasedAt: '2024-
|
119
|
+
releasedAt: '2024-06-20',
|
121
120
|
settings: {
|
122
121
|
extendParams: ['disableContextCaching'],
|
123
122
|
},
|
@@ -130,17 +129,18 @@ const anthropicChatModels: AIChatModelCard[] = [
|
|
130
129
|
},
|
131
130
|
contextWindowTokens: 200_000,
|
132
131
|
description:
|
133
|
-
'Claude 3.5
|
134
|
-
displayName: 'Claude 3.5
|
135
|
-
|
132
|
+
'Claude 3.5 Haiku 是 Anthropic 最快的下一代模型。与 Claude 3 Haiku 相比,Claude 3.5 Haiku 在各项技能上都有所提升,并在许多智力基准测试中超越了上一代最大的模型 Claude 3 Opus。',
|
133
|
+
displayName: 'Claude 3.5 Haiku',
|
134
|
+
enabled: true,
|
135
|
+
id: 'claude-3-5-haiku-20241022',
|
136
136
|
maxOutput: 8192,
|
137
137
|
pricing: {
|
138
|
-
cachedInput: 0.
|
139
|
-
input:
|
140
|
-
output:
|
141
|
-
writeCacheInput:
|
138
|
+
cachedInput: 0.1,
|
139
|
+
input: 1,
|
140
|
+
output: 5,
|
141
|
+
writeCacheInput: 1.25,
|
142
142
|
},
|
143
|
-
releasedAt: '2024-
|
143
|
+
releasedAt: '2024-11-05',
|
144
144
|
settings: {
|
145
145
|
extendParams: ['disableContextCaching'],
|
146
146
|
},
|
@@ -176,7 +176,7 @@ const anthropicChatModels: AIChatModelCard[] = [
|
|
176
176
|
description:
|
177
177
|
'Claude 3 Sonnet 在智能和速度方面为企业工作负载提供了理想的平衡。它以更低的价格提供最大效用,可靠且适合大规模部署。',
|
178
178
|
displayName: 'Claude 3 Sonnet',
|
179
|
-
id: 'claude-3-sonnet-20240229',
|
179
|
+
id: 'claude-3-sonnet-20240229', // 弃用日期 2025年7月21日
|
180
180
|
maxOutput: 4096,
|
181
181
|
pricing: {
|
182
182
|
input: 3,
|
@@ -211,7 +211,7 @@ const anthropicChatModels: AIChatModelCard[] = [
|
|
211
211
|
description:
|
212
212
|
'Claude 2 为企业提供了关键能力的进步,包括业界领先的 200K token 上下文、大幅降低模型幻觉的发生率、系统提示以及一个新的测试功能:工具调用。',
|
213
213
|
displayName: 'Claude 2.1',
|
214
|
-
id: 'claude-2.1',
|
214
|
+
id: 'claude-2.1', // 弃用日期 2025年7月21日
|
215
215
|
maxOutput: 4096,
|
216
216
|
pricing: {
|
217
217
|
input: 8,
|
@@ -225,7 +225,7 @@ const anthropicChatModels: AIChatModelCard[] = [
|
|
225
225
|
description:
|
226
226
|
'Claude 2 为企业提供了关键能力的进步,包括业界领先的 200K token 上下文、大幅降低模型幻觉的发生率、系统提示以及一个新的测试功能:工具调用。',
|
227
227
|
displayName: 'Claude 2.0',
|
228
|
-
id: 'claude-2.0',
|
228
|
+
id: 'claude-2.0', // 弃用日期 2025年7月21日
|
229
229
|
maxOutput: 4096,
|
230
230
|
pricing: {
|
231
231
|
input: 8,
|
@@ -58,8 +58,31 @@ const googleChatModels: AIChatModelCard[] = [
|
|
58
58
|
},
|
59
59
|
contextWindowTokens: 1_048_576 + 65_536,
|
60
60
|
description: 'Gemini 2.5 Flash Preview 是 Google 性价比最高的模型,提供全面的功能。',
|
61
|
-
displayName: 'Gemini 2.5 Flash Preview
|
61
|
+
displayName: 'Gemini 2.5 Flash Preview 05-20',
|
62
62
|
enabled: true,
|
63
|
+
id: 'gemini-2.5-flash-preview-05-20',
|
64
|
+
maxOutput: 65_536,
|
65
|
+
pricing: {
|
66
|
+
input: 0.15,
|
67
|
+
output: 3.5, // Thinking
|
68
|
+
},
|
69
|
+
releasedAt: '2025-05-20',
|
70
|
+
settings: {
|
71
|
+
searchImpl: 'params',
|
72
|
+
searchProvider: 'google',
|
73
|
+
},
|
74
|
+
type: 'chat',
|
75
|
+
},
|
76
|
+
{
|
77
|
+
abilities: {
|
78
|
+
functionCall: true,
|
79
|
+
reasoning: true,
|
80
|
+
search: true,
|
81
|
+
vision: true,
|
82
|
+
},
|
83
|
+
contextWindowTokens: 1_048_576 + 65_536,
|
84
|
+
description: 'Gemini 2.5 Flash Preview 是 Google 性价比最高的模型,提供全面的功能。',
|
85
|
+
displayName: 'Gemini 2.5 Flash Preview 04-17',
|
63
86
|
id: 'gemini-2.5-flash-preview-04-17',
|
64
87
|
maxOutput: 65_536,
|
65
88
|
pricing: {
|
@@ -73,6 +96,28 @@ const googleChatModels: AIChatModelCard[] = [
|
|
73
96
|
},
|
74
97
|
type: 'chat',
|
75
98
|
},
|
99
|
+
{
|
100
|
+
abilities: {
|
101
|
+
functionCall: true,
|
102
|
+
reasoning: true,
|
103
|
+
search: true,
|
104
|
+
vision: true,
|
105
|
+
},
|
106
|
+
contextWindowTokens: 1_048_576 + 65_536,
|
107
|
+
description: 'Gemini 2.5 Flash Preview 是 Google 性价比最高的模型,提供全面的功能。',
|
108
|
+
displayName: 'Gemini 2.5 Flash Preview 04-17 for cursor testing',
|
109
|
+
id: 'gemini-2.5-flash-preview-04-17-thinking',
|
110
|
+
maxOutput: 65_536,
|
111
|
+
pricing: {
|
112
|
+
input: 0.15,
|
113
|
+
output: 3.5, // Thinking
|
114
|
+
},
|
115
|
+
settings: {
|
116
|
+
searchImpl: 'params',
|
117
|
+
searchProvider: 'google',
|
118
|
+
},
|
119
|
+
type: 'chat',
|
120
|
+
},
|
76
121
|
{
|
77
122
|
abilities: {
|
78
123
|
functionCall: true,
|
@@ -368,6 +413,30 @@ const googleChatModels: AIChatModelCard[] = [
|
|
368
413
|
},
|
369
414
|
type: 'chat',
|
370
415
|
},
|
416
|
+
{
|
417
|
+
contextWindowTokens: 131_072 + 8192,
|
418
|
+
displayName: 'Gemma 3 27B',
|
419
|
+
id: 'gemma-3-27b-it',
|
420
|
+
maxOutput: 8192,
|
421
|
+
pricing: {
|
422
|
+
cachedInput: 0,
|
423
|
+
input: 0,
|
424
|
+
output: 0,
|
425
|
+
},
|
426
|
+
type: 'chat',
|
427
|
+
},
|
428
|
+
{
|
429
|
+
contextWindowTokens: 2048 + 8192,
|
430
|
+
displayName: 'Gemma 3n E4B',
|
431
|
+
id: 'gemma-3n-e4b-it',
|
432
|
+
maxOutput: 2048,
|
433
|
+
pricing: {
|
434
|
+
cachedInput: 0,
|
435
|
+
input: 0,
|
436
|
+
output: 0,
|
437
|
+
},
|
438
|
+
type: 'chat',
|
439
|
+
},
|
371
440
|
];
|
372
441
|
|
373
442
|
export const allModels = [...googleChatModels];
|
@@ -231,7 +231,7 @@ const hunyuanChatModels: AIChatModelCard[] = [
|
|
231
231
|
input: 0.8,
|
232
232
|
output: 2,
|
233
233
|
},
|
234
|
-
releasedAt: '2025-
|
234
|
+
releasedAt: '2025-05-20',
|
235
235
|
settings: {
|
236
236
|
searchImpl: 'params',
|
237
237
|
},
|
@@ -302,7 +302,6 @@ const hunyuanChatModels: AIChatModelCard[] = [
|
|
302
302
|
contextWindowTokens: 8000,
|
303
303
|
description: '混元最新多模态模型,支持多语种作答,中英文能力均衡。',
|
304
304
|
displayName: 'Hunyuan Standard Vision',
|
305
|
-
enabled: true,
|
306
305
|
id: 'hunyuan-standard-vision',
|
307
306
|
maxOutput: 2000,
|
308
307
|
releasedAt: '2024-12-31',
|
@@ -363,6 +362,20 @@ const hunyuanChatModels: AIChatModelCard[] = [
|
|
363
362
|
releasedAt: '2025-01-03',
|
364
363
|
type: 'chat',
|
365
364
|
},
|
365
|
+
{
|
366
|
+
abilities: {
|
367
|
+
reasoning: true,
|
368
|
+
vision: true,
|
369
|
+
},
|
370
|
+
contextWindowTokens: 8192 + 24_576,
|
371
|
+
description: '混元多模态理解深度思考模型,支持多模态原生长思维链,擅长处理各种图片推理场景,在理科难题上相比快思考模型全面提升。',
|
372
|
+
displayName: 'Hunyuan T1 Vision',
|
373
|
+
enabled: true,
|
374
|
+
id: 'hunyuan-t1-vision',
|
375
|
+
maxOutput: 8192,
|
376
|
+
releasedAt: '2025-05-16',
|
377
|
+
type: 'chat',
|
378
|
+
},
|
366
379
|
{
|
367
380
|
contextWindowTokens: 8000,
|
368
381
|
description:
|
@@ -1,6 +1,16 @@
|
|
1
1
|
import { AIChatModelCard } from '@/types/aiModel';
|
2
2
|
// https://novita.ai/pricing
|
3
3
|
const novitaChatModels: AIChatModelCard[] = [
|
4
|
+
{
|
5
|
+
contextWindowTokens: 200_000,
|
6
|
+
displayName: 'Claude Opus 4',
|
7
|
+
id: 'pa/cd-op-4-20250514',
|
8
|
+
pricing: {
|
9
|
+
input: 15,
|
10
|
+
output: 75
|
11
|
+
},
|
12
|
+
type: 'chat',
|
13
|
+
},
|
4
14
|
{
|
5
15
|
contextWindowTokens: 32_000,
|
6
16
|
displayName: 'Qwen3 0.6B FP8',
|
@@ -191,12 +201,12 @@ const novitaChatModels: AIChatModelCard[] = [
|
|
191
201
|
type: 'chat',
|
192
202
|
},
|
193
203
|
{
|
194
|
-
contextWindowTokens:
|
204
|
+
contextWindowTokens: 64_000,
|
195
205
|
description: 'Mistral Nemo 是多语言支持和高性能编程的7.3B参数模型。',
|
196
206
|
displayName: 'Mistral Nemo',
|
197
207
|
id: 'mistralai/mistral-nemo',
|
198
208
|
pricing: {
|
199
|
-
input: 0.
|
209
|
+
input: 0.04,
|
200
210
|
output: 0.17,
|
201
211
|
},
|
202
212
|
type: 'chat',
|
@@ -406,16 +416,6 @@ const novitaChatModels: AIChatModelCard[] = [
|
|
406
416
|
},
|
407
417
|
type: 'chat',
|
408
418
|
},
|
409
|
-
{
|
410
|
-
contextWindowTokens: 4096,
|
411
|
-
displayName: 'Airoboros L2 70B',
|
412
|
-
id: 'jondurbin/airoboros-l2-70b',
|
413
|
-
pricing: {
|
414
|
-
input: 0.5,
|
415
|
-
output: 0.5,
|
416
|
-
},
|
417
|
-
type: 'chat',
|
418
|
-
},
|
419
419
|
{
|
420
420
|
contextWindowTokens: 4096,
|
421
421
|
displayName: 'Midnight Rose 70B',
|
@@ -5,91 +5,91 @@ const xaiChatModels: AIChatModelCard[] = [
|
|
5
5
|
{
|
6
6
|
abilities: {
|
7
7
|
functionCall: true,
|
8
|
+
search: true,
|
8
9
|
},
|
9
10
|
contextWindowTokens: 131_072,
|
10
11
|
description:
|
11
12
|
'旗舰级模型,擅长数据提取、编程和文本摘要等企业级应用,拥有金融、医疗、法律和科学等领域的深厚知识。',
|
12
|
-
displayName: 'Grok 3
|
13
|
+
displayName: 'Grok 3',
|
13
14
|
enabled: true,
|
14
|
-
id: 'grok-3
|
15
|
+
id: 'grok-3',
|
15
16
|
pricing: {
|
16
17
|
input: 3,
|
17
18
|
output: 15,
|
18
19
|
},
|
19
20
|
releasedAt: '2025-04-03',
|
21
|
+
settings: {
|
22
|
+
searchImpl: 'params',
|
23
|
+
},
|
20
24
|
type: 'chat',
|
21
25
|
},
|
22
26
|
{
|
23
27
|
abilities: {
|
24
28
|
functionCall: true,
|
29
|
+
search: true,
|
25
30
|
},
|
26
31
|
contextWindowTokens: 131_072,
|
27
32
|
description:
|
28
33
|
'旗舰级模型,擅长数据提取、编程和文本摘要等企业级应用,拥有金融、医疗、法律和科学等领域的深厚知识。',
|
29
|
-
displayName: 'Grok 3
|
30
|
-
id: 'grok-3-fast
|
34
|
+
displayName: 'Grok 3 (Fast mode)',
|
35
|
+
id: 'grok-3-fast',
|
31
36
|
pricing: {
|
32
37
|
input: 5,
|
33
38
|
output: 25,
|
34
39
|
},
|
35
40
|
releasedAt: '2025-04-03',
|
41
|
+
settings: {
|
42
|
+
searchImpl: 'params',
|
43
|
+
},
|
36
44
|
type: 'chat',
|
37
45
|
},
|
38
46
|
{
|
39
47
|
abilities: {
|
40
48
|
functionCall: true,
|
41
49
|
reasoning: true,
|
50
|
+
search: true,
|
42
51
|
},
|
43
52
|
contextWindowTokens: 131_072,
|
44
53
|
description:
|
45
54
|
'轻量级模型,回话前会先思考。运行快速、智能,适用于不需要深层领域知识的逻辑任务,并能获取原始的思维轨迹。',
|
46
|
-
displayName: 'Grok 3 Mini
|
55
|
+
displayName: 'Grok 3 Mini',
|
47
56
|
enabled: true,
|
48
|
-
id: 'grok-3-mini
|
57
|
+
id: 'grok-3-mini',
|
49
58
|
pricing: {
|
50
59
|
input: 0.3,
|
51
60
|
output: 0.5,
|
52
61
|
},
|
53
62
|
releasedAt: '2025-04-03',
|
63
|
+
settings: {
|
64
|
+
searchImpl: 'params',
|
65
|
+
},
|
54
66
|
type: 'chat',
|
55
67
|
},
|
56
68
|
{
|
57
69
|
abilities: {
|
58
70
|
functionCall: true,
|
59
71
|
reasoning: true,
|
72
|
+
search: true,
|
60
73
|
},
|
61
74
|
contextWindowTokens: 131_072,
|
62
75
|
description:
|
63
76
|
'轻量级模型,回话前会先思考。运行快速、智能,适用于不需要深层领域知识的逻辑任务,并能获取原始的思维轨迹。',
|
64
|
-
displayName: 'Grok 3 Mini
|
65
|
-
id: 'grok-3-mini-fast
|
77
|
+
displayName: 'Grok 3 Mini (Fast mode)',
|
78
|
+
id: 'grok-3-mini-fast',
|
66
79
|
pricing: {
|
67
80
|
input: 0.6,
|
68
81
|
output: 4,
|
69
82
|
},
|
70
83
|
releasedAt: '2025-04-03',
|
71
|
-
|
72
|
-
|
73
|
-
{
|
74
|
-
abilities: {
|
75
|
-
functionCall: true,
|
76
|
-
vision: true,
|
77
|
-
},
|
78
|
-
contextWindowTokens: 32_768,
|
79
|
-
description: '该模型在准确性、指令遵循和多语言能力方面有所改进。',
|
80
|
-
displayName: 'Grok 2 Vision 1212',
|
81
|
-
enabled: true,
|
82
|
-
id: 'grok-2-vision-1212',
|
83
|
-
pricing: {
|
84
|
-
input: 2,
|
85
|
-
output: 10,
|
84
|
+
settings: {
|
85
|
+
searchImpl: 'params',
|
86
86
|
},
|
87
|
-
releasedAt: '2024-12-12',
|
88
87
|
type: 'chat',
|
89
88
|
},
|
90
89
|
{
|
91
90
|
abilities: {
|
92
91
|
functionCall: true,
|
92
|
+
search: true,
|
93
93
|
},
|
94
94
|
contextWindowTokens: 131_072,
|
95
95
|
description: '该模型在准确性、指令遵循和多语言能力方面有所改进。',
|
@@ -100,34 +100,29 @@ const xaiChatModels: AIChatModelCard[] = [
|
|
100
100
|
output: 10,
|
101
101
|
},
|
102
102
|
releasedAt: '2024-12-12',
|
103
|
-
|
104
|
-
|
105
|
-
{
|
106
|
-
abilities: {
|
107
|
-
functionCall: true,
|
108
|
-
},
|
109
|
-
contextWindowTokens: 131_072,
|
110
|
-
description: '拥有与 Grok 2 相当的性能,但具有更高的效率、速度和功能。',
|
111
|
-
displayName: 'Grok Beta',
|
112
|
-
id: 'grok-beta', // legacy
|
113
|
-
pricing: {
|
114
|
-
input: 5,
|
115
|
-
output: 15,
|
103
|
+
settings: {
|
104
|
+
searchImpl: 'params',
|
116
105
|
},
|
117
106
|
type: 'chat',
|
118
107
|
},
|
119
108
|
{
|
120
109
|
abilities: {
|
121
110
|
functionCall: true,
|
111
|
+
search: true,
|
122
112
|
vision: true,
|
123
113
|
},
|
124
|
-
contextWindowTokens:
|
125
|
-
description: '
|
126
|
-
displayName: 'Grok Vision
|
127
|
-
|
114
|
+
contextWindowTokens: 32_768,
|
115
|
+
description: '该模型在准确性、指令遵循和多语言能力方面有所改进。',
|
116
|
+
displayName: 'Grok 2 Vision 1212',
|
117
|
+
enabled: true,
|
118
|
+
id: 'grok-2-vision-1212',
|
128
119
|
pricing: {
|
129
|
-
input:
|
130
|
-
output:
|
120
|
+
input: 2,
|
121
|
+
output: 10,
|
122
|
+
},
|
123
|
+
releasedAt: '2024-12-12',
|
124
|
+
settings: {
|
125
|
+
searchImpl: 'params',
|
131
126
|
},
|
132
127
|
type: 'chat',
|
133
128
|
},
|
@@ -130,7 +130,7 @@ describe('LobeAnthropicAI', () => {
|
|
130
130
|
// Assert
|
131
131
|
expect(instance['client'].messages.create).toHaveBeenCalledWith(
|
132
132
|
{
|
133
|
-
max_tokens:
|
133
|
+
max_tokens: 64000,
|
134
134
|
messages: [
|
135
135
|
{
|
136
136
|
content: [{ cache_control: { type: 'ephemeral' }, text: 'Hello', type: 'text' }],
|
@@ -147,8 +147,13 @@ describe('LobeAnthropicAI', () => {
|
|
147
147
|
},
|
148
148
|
],
|
149
149
|
temperature: 0,
|
150
|
+
metadata: undefined,
|
151
|
+
tools: undefined,
|
152
|
+
top_p: undefined,
|
153
|
+
},
|
154
|
+
{
|
155
|
+
signal: undefined,
|
150
156
|
},
|
151
|
-
{},
|
152
157
|
);
|
153
158
|
expect(result).toBeInstanceOf(Response);
|
154
159
|
});
|
@@ -617,7 +622,7 @@ describe('LobeAnthropicAI', () => {
|
|
617
622
|
const result = await instance['buildAnthropicPayload'](payload);
|
618
623
|
|
619
624
|
expect(result).toEqual({
|
620
|
-
max_tokens:
|
625
|
+
max_tokens: 4096,
|
621
626
|
messages: [
|
622
627
|
{
|
623
628
|
content: [
|
@@ -627,7 +632,9 @@ describe('LobeAnthropicAI', () => {
|
|
627
632
|
},
|
628
633
|
],
|
629
634
|
model: 'claude-3-haiku-20240307',
|
630
|
-
|
635
|
+
system: undefined,
|
636
|
+
thinking: { type: 'enabled', budget_tokens: 1024 },
|
637
|
+
tools: undefined,
|
631
638
|
});
|
632
639
|
});
|
633
640
|
|
@@ -653,7 +660,9 @@ describe('LobeAnthropicAI', () => {
|
|
653
660
|
},
|
654
661
|
],
|
655
662
|
model: 'claude-3-haiku-20240307',
|
656
|
-
|
663
|
+
system: undefined,
|
664
|
+
thinking: { type: 'enabled', budget_tokens: 1024 },
|
665
|
+
tools: undefined,
|
657
666
|
});
|
658
667
|
});
|
659
668
|
|
@@ -669,7 +678,7 @@ describe('LobeAnthropicAI', () => {
|
|
669
678
|
const result = await instance['buildAnthropicPayload'](payload);
|
670
679
|
|
671
680
|
expect(result).toEqual({
|
672
|
-
max_tokens:
|
681
|
+
max_tokens: 1000,
|
673
682
|
messages: [
|
674
683
|
{
|
675
684
|
content: [
|
@@ -679,7 +688,9 @@ describe('LobeAnthropicAI', () => {
|
|
679
688
|
},
|
680
689
|
],
|
681
690
|
model: 'claude-3-haiku-20240307',
|
682
|
-
|
691
|
+
system: undefined,
|
692
|
+
thinking: { type: 'enabled', budget_tokens: 999 },
|
693
|
+
tools: undefined,
|
683
694
|
});
|
684
695
|
});
|
685
696
|
|
@@ -695,7 +706,7 @@ describe('LobeAnthropicAI', () => {
|
|
695
706
|
const result = await instance['buildAnthropicPayload'](payload);
|
696
707
|
|
697
708
|
expect(result).toEqual({
|
698
|
-
max_tokens:
|
709
|
+
max_tokens: 10000,
|
699
710
|
messages: [
|
700
711
|
{
|
701
712
|
content: [
|
@@ -705,7 +716,9 @@ describe('LobeAnthropicAI', () => {
|
|
705
716
|
},
|
706
717
|
],
|
707
718
|
model: 'claude-3-haiku-20240307',
|
708
|
-
|
719
|
+
system: undefined,
|
720
|
+
thinking: { type: 'enabled', budget_tokens: 9999 },
|
721
|
+
tools: undefined,
|
709
722
|
});
|
710
723
|
});
|
711
724
|
|
@@ -730,7 +743,7 @@ describe('LobeAnthropicAI', () => {
|
|
730
743
|
|
731
744
|
const result = await instance['buildAnthropicPayload'](payload);
|
732
745
|
|
733
|
-
expect(result.max_tokens).toBe(
|
746
|
+
expect(result.max_tokens).toBe(4096);
|
734
747
|
});
|
735
748
|
|
736
749
|
it('should respect max_tokens when explicitly provided', async () => {
|
@@ -100,6 +100,18 @@ export class LobeAnthropicAI implements LobeRuntimeAI {
|
|
100
100
|
thinking,
|
101
101
|
enabledContextCaching = true,
|
102
102
|
} = payload;
|
103
|
+
|
104
|
+
const { default: anthropicModels } = await import('@/config/aiModels/anthropic');
|
105
|
+
const modelConfig = anthropicModels.find(m => m.id === model);
|
106
|
+
const defaultMaxOutput = modelConfig?.maxOutput;
|
107
|
+
|
108
|
+
// 配置优先级:用户设置 > 模型配置 > 硬编码默认值
|
109
|
+
const getMaxTokens = () => {
|
110
|
+
if (max_tokens) return max_tokens;
|
111
|
+
if (defaultMaxOutput) return defaultMaxOutput;
|
112
|
+
return undefined;
|
113
|
+
};
|
114
|
+
|
103
115
|
const system_message = messages.find((m) => m.role === 'system');
|
104
116
|
const user_messages = messages.filter((m) => m.role !== 'system');
|
105
117
|
|
@@ -118,12 +130,7 @@ export class LobeAnthropicAI implements LobeRuntimeAI {
|
|
118
130
|
const postTools = buildAnthropicTools(tools, { enabledContextCaching });
|
119
131
|
|
120
132
|
if (!!thinking && thinking.type === 'enabled') {
|
121
|
-
|
122
|
-
const maxTokens = !!max_tokens
|
123
|
-
? thinking?.budget_tokens && thinking?.budget_tokens > max_tokens
|
124
|
-
? Math.min(thinking?.budget_tokens + max_tokens, 64_000)
|
125
|
-
: max_tokens
|
126
|
-
: 64_000;
|
133
|
+
const maxTokens = getMaxTokens() || 32_000; // Claude Opus 4 has minimum maxOutput
|
127
134
|
|
128
135
|
// `temperature` may only be set to 1 when thinking is enabled.
|
129
136
|
// `top_p` must be unset when thinking is enabled.
|
@@ -132,7 +139,12 @@ export class LobeAnthropicAI implements LobeRuntimeAI {
|
|
132
139
|
messages: postMessages,
|
133
140
|
model,
|
134
141
|
system: systemPrompts,
|
135
|
-
thinking
|
142
|
+
thinking: {
|
143
|
+
...thinking,
|
144
|
+
budget_tokens: thinking?.budget_tokens
|
145
|
+
? Math.min(thinking.budget_tokens, maxTokens - 1) // `max_tokens` must be greater than `thinking.budget_tokens`.
|
146
|
+
: 1024,
|
147
|
+
},
|
136
148
|
tools: postTools,
|
137
149
|
} satisfies Anthropic.MessageCreateParams;
|
138
150
|
}
|
@@ -140,7 +152,7 @@ export class LobeAnthropicAI implements LobeRuntimeAI {
|
|
140
152
|
return {
|
141
153
|
// claude 3 series model hax max output token of 4096, 3.x series has 8192
|
142
154
|
// https://docs.anthropic.com/en/docs/about-claude/models/all-models#:~:text=200K-,Max%20output,-Normal%3A
|
143
|
-
max_tokens:
|
155
|
+
max_tokens: getMaxTokens() || (modelsWithSmallContextWindow.has(model) ? 4096 : 8192),
|
144
156
|
messages: postMessages,
|
145
157
|
model,
|
146
158
|
system: systemPrompts,
|
@@ -45,6 +45,11 @@ const modelsDisableInstuction = new Set([
|
|
45
45
|
'gemini-2.0-flash-exp',
|
46
46
|
'gemini-2.0-flash-exp-image-generation',
|
47
47
|
'gemini-2.0-flash-preview-image-generation',
|
48
|
+
'gemma-3-1b-it',
|
49
|
+
'gemma-3-4b-it',
|
50
|
+
'gemma-3-12b-it',
|
51
|
+
'gemma-3-27b-it',
|
52
|
+
'gemma-3n-e4b-it',
|
48
53
|
]);
|
49
54
|
|
50
55
|
export interface GoogleModelCard {
|