Skip to content

Commit 9cceaad

Browse files
authored
✨ feat: Add new provider Cerebras (lobehub#9559)
* ✨ feat: 添加 Cerebras 模型支持,包括模型定义和配置 * ✨ feat: 添加 Cerebras 模型支持,包括环境变量和模型描述 * ✨ feat: 在 OllamaCloud 模型中添加 GLM-4.6,增强推理和编码能力 * ✨ feat: 移除过时的 Grok 模型定义,优化模型列表
1 parent 7ab30fc commit 9cceaad

File tree

19 files changed

+281
-392
lines changed

19 files changed

+281
-392
lines changed

Dockerfile.database

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,8 @@ ENV \
302302
BFL_API_KEY="" BFL_MODEL_LIST="" \
303303
# Vercel AI Gateway
304304
VERCELAIGATEWAY_API_KEY="" VERCELAIGATEWAY_MODEL_LIST=""
305+
# Cerebras
306+
CEREBRAS_API_KEY="" CEREBRAS_MODEL_LIST=""
305307

306308
USER nextjs
307309

docs/self-hosting/environment-variables/model-provider.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,4 +717,20 @@ NewAPI is a multi-provider model aggregation service that supports automatic mod
717717
- Default: `-`
718718
- Example: `-all,+vercel-model-1,+vercel-model-2=vercel-special`
719719

720+
## Cerebras
721+
722+
### `CEREBRAS_API_KEY`
723+
724+
- Type: Required
725+
- Description: This is the API key you applied for in the Cerebras service.
726+
- Default: -
727+
- Example: `csk-xxxxxx...xxxxxx`
728+
729+
### `CEREBRAS_MODEL_LIST`
730+
731+
- Type: Optional
732+
- Description: Used to control the Cerebras model list. Use `+` to add a model, `-` to hide a model, and `model_name=display_name` to customize the display name of a model. Separate multiple entries with commas. The definition syntax follows the same rules as other providers' model lists.
733+
- Default: `-`
734+
- Example: `-all,+cerebras-model-1,+cerebras-model-2=cerebras-special`
735+
720736
[model-list]: /docs/self-hosting/advanced/model-list

docs/self-hosting/environment-variables/model-provider.zh-CN.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,4 +720,20 @@ LobeChat 在部署时提供了丰富的模型服务商相关的环境变量,
720720
- 默认值:`-`
721721
- 示例:`-all,+vercel-model-1,+vercel-model-2=vercel-special`
722722

723+
## Cerebras
724+
725+
### `CEREBRAS_API_KEY`
726+
727+
- 类型:必选
728+
- 描述:这是你在 Cerebras 服务中申请的 API 密钥
729+
- 默认值:-
730+
- 示例:`csk-xxxxxx...xxxxxx`
731+
732+
### `CEREBRAS_MODEL_LIST`
733+
734+
- 类型:可选
735+
- 描述:用来控制 Cerebras 模型列表,使用 `+` 增加一个模型,使用 `-` 来隐藏一个模型,使用 `模型名=展示名` 来自定义模型的展示名,用英文逗号隔开。模型定义语法规则与其他 provider 保持一致。
736+
- 默认值:`-`
737+
- 示例:`-all,+cerebras-model-1,+cerebras-model-2=cerebras-special`
738+
723739
[model-list]: /zh/docs/self-hosting/advanced/model-list

packages/model-bank/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"./baichuan": "./src/aiModels/baichuan.ts",
1616
"./bedrock": "./src/aiModels/bedrock.ts",
1717
"./bfl": "./src/aiModels/bfl.ts",
18+
"./cerebras": "./src/aiModels/cerebras.ts",
1819
"./cloudflare": "./src/aiModels/cloudflare.ts",
1920
"./cohere": "./src/aiModels/cohere.ts",
2021
"./cometapi": "./src/aiModels/cometapi.ts",
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
import { AIChatModelCard } from '../types/aiModel';
2+
3+
const cerebrasModels: AIChatModelCard[] = [
4+
{
5+
abilities: {
6+
functionCall: true,
7+
},
8+
contextWindowTokens: 32_768,
9+
description: 'Llama 4 Scout:高性能的 Llama 系列模型,适合需高吞吐与低延迟的场景。',
10+
displayName: 'Llama 4 Scout',
11+
id: 'llama-4-scout-17b-16e-instruct',
12+
pricing: {
13+
units: [
14+
{ name: 'textInput', rate: 0.65, strategy: 'fixed', unit: 'millionTokens' },
15+
{ name: 'textOutput', rate: 0.85, strategy: 'fixed', unit: 'millionTokens' },
16+
],
17+
},
18+
type: 'chat',
19+
},
20+
{
21+
abilities: {
22+
functionCall: true,
23+
},
24+
contextWindowTokens: 32_768,
25+
description:
26+
'Llama 4 Maverick:高性能的 Llama 系列模型,适合高级推理、复杂问题解决和指令跟随任务。',
27+
displayName: 'Llama 4 Maverick',
28+
id: 'llama-4-maverick-17b-128e-instruct',
29+
pricing: {
30+
units: [
31+
{ name: 'textInput', rate: 0.2, strategy: 'fixed', unit: 'millionTokens' },
32+
{ name: 'textOutput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
33+
],
34+
},
35+
type: 'chat',
36+
},
37+
{
38+
abilities: {
39+
functionCall: true,
40+
},
41+
contextWindowTokens: 32_768,
42+
description: 'Llama 3.1 8B:小体量、低延迟的 Llama 变体,适合轻量在线推理与交互场景。',
43+
displayName: 'Llama 3.1 8B',
44+
id: 'llama3.1-8b',
45+
pricing: {
46+
units: [
47+
{ name: 'textInput', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
48+
{ name: 'textOutput', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
49+
],
50+
},
51+
type: 'chat',
52+
},
53+
{
54+
abilities: {
55+
functionCall: true,
56+
},
57+
contextWindowTokens: 131_072,
58+
description: 'Llama 3.3 70B:中大型 Llama 模型,兼顾推理能力与吞吐。',
59+
displayName: 'Llama 3.3 70B',
60+
id: 'llama-3.3-70b',
61+
pricing: {
62+
units: [
63+
{ name: 'textInput', rate: 0.85, strategy: 'fixed', unit: 'millionTokens' },
64+
{ name: 'textOutput', rate: 1.2, strategy: 'fixed', unit: 'millionTokens' },
65+
],
66+
},
67+
type: 'chat',
68+
},
69+
{
70+
abilities: {
71+
functionCall: true,
72+
reasoning: true,
73+
},
74+
contextWindowTokens: 131_072,
75+
displayName: 'GPT OSS 120B',
76+
enabled: true,
77+
id: 'gpt-oss-120b',
78+
pricing: {
79+
units: [
80+
{ name: 'textInput', rate: 0.35, strategy: 'fixed', unit: 'millionTokens' },
81+
{ name: 'textOutput', rate: 0.75, strategy: 'fixed', unit: 'millionTokens' },
82+
],
83+
},
84+
settings: {
85+
extendParams: ['reasoningEffort'],
86+
},
87+
type: 'chat',
88+
},
89+
{
90+
abilities: {
91+
functionCall: true,
92+
reasoning: true,
93+
},
94+
contextWindowTokens: 131_072,
95+
description: 'Qwen 3 32B:Qwen 系列在多语言与编码任务上表现优良,适合中等规模生产化使用。',
96+
displayName: 'Qwen 3 32B',
97+
id: 'qwen-3-32b',
98+
pricing: {
99+
units: [
100+
{ name: 'textInput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
101+
{ name: 'textOutput', rate: 0.8, strategy: 'fixed', unit: 'millionTokens' },
102+
],
103+
},
104+
type: 'chat',
105+
},
106+
{
107+
abilities: {
108+
functionCall: true,
109+
},
110+
contextWindowTokens: 131_072,
111+
displayName: 'Qwen 3 235B Instruct',
112+
id: 'qwen-3-235b-a22b-instruct-2507',
113+
pricing: {
114+
units: [
115+
{ name: 'textInput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
116+
{ name: 'textOutput', rate: 1.2, strategy: 'fixed', unit: 'millionTokens' },
117+
],
118+
},
119+
type: 'chat',
120+
},
121+
{
122+
abilities: {
123+
reasoning: true,
124+
},
125+
contextWindowTokens: 131_072,
126+
displayName: 'Qwen 3 235B Thinking',
127+
id: 'qwen-3-235b-a22b-thinking-2507',
128+
pricing: {
129+
units: [
130+
{ name: 'textInput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
131+
{ name: 'textOutput', rate: 2.9, strategy: 'fixed', unit: 'millionTokens' },
132+
],
133+
},
134+
type: 'chat',
135+
},
136+
{
137+
abilities: {
138+
functionCall: true,
139+
},
140+
contextWindowTokens: 131_072,
141+
description: 'Qwen 3 Coder 480B:面向代码生成与复杂编程任务的长上下文模型。',
142+
displayName: 'Qwen 3 Coder 480B',
143+
id: 'qwen-3-coder-480b',
144+
pricing: {
145+
units: [
146+
{ name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
147+
{ name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
148+
],
149+
},
150+
type: 'chat',
151+
},
152+
];
153+
154+
export const allModels = [...cerebrasModels];
155+
156+
export default allModels;

packages/model-bank/src/aiModels/hunyuan.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ const hunyuanChatModels: AIChatModelCard[] = [
509509
},
510510
contextWindowTokens: 40_000,
511511
description:
512-
'混元多模态理解深度思考模型,支持多模态原生长思维链,擅长处理各种图片推理场景,在理科难题上相比快思考模型全面提升。',
512+
'混元最新版 t1-vision 视觉深度思考模型,相比上一版模型在通用图文问答、视觉定位、OCR、图表、拍题解题、看图创作等任务上全面提升,显著优化了英文和小语种能力。',
513513
displayName: 'Hunyuan T1 Vision 20250916',
514514
id: 'hunyuan-t1-vision-20250916',
515515
maxOutput: 16_000,

packages/model-bank/src/aiModels/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { default as azureai } from './azureai';
1010
import { default as baichuan } from './baichuan';
1111
import { default as bedrock } from './bedrock';
1212
import { default as bfl } from './bfl';
13+
import { default as cerebras } from './cerebras';
1314
import { default as cloudflare } from './cloudflare';
1415
import { default as cohere } from './cohere';
1516
import { default as cometapi } from './cometapi';
@@ -95,6 +96,7 @@ export const LOBE_DEFAULT_MODEL_LIST = buildDefaultModelList({
9596
baichuan,
9697
bedrock,
9798
bfl,
99+
cerebras,
98100
cloudflare,
99101
cohere,
100102
cometapi,
@@ -161,6 +163,7 @@ export { default as azureai } from './azureai';
161163
export { default as baichuan } from './baichuan';
162164
export { default as bedrock } from './bedrock';
163165
export { default as bfl } from './bfl';
166+
export { default as cerebras } from './cerebras';
164167
export { default as cloudflare } from './cloudflare';
165168
export { default as cohere } from './cohere';
166169
export { default as cometapi } from './cometapi';

0 commit comments

Comments
 (0)