@ai-sdk/cerebras 3.0.74 → 3.0.76
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 +19 -0
- package/dist/index.js +1 -1
- package/docs/40-cerebras.mdx +52 -5
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @ai-sdk/cerebras
|
|
2
2
|
|
|
3
|
+
## 3.0.76
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [10026d1]
|
|
8
|
+
- @ai-sdk/provider@4.0.32
|
|
9
|
+
- @ai-sdk/openai-compatible@3.0.76
|
|
10
|
+
- @ai-sdk/provider-utils@5.0.66
|
|
11
|
+
|
|
12
|
+
## 3.0.75
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [b089ce8]
|
|
17
|
+
- Updated dependencies [39a776b]
|
|
18
|
+
- Updated dependencies [e619655]
|
|
19
|
+
- @ai-sdk/provider-utils@5.0.65
|
|
20
|
+
- @ai-sdk/openai-compatible@3.0.75
|
|
21
|
+
|
|
3
22
|
## 3.0.74
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -61,7 +61,7 @@ var CerebrasChatLanguageModel = class CerebrasChatLanguageModel extends OpenAICo
|
|
|
61
61
|
};
|
|
62
62
|
//#endregion
|
|
63
63
|
//#region src/version.ts
|
|
64
|
-
const VERSION = "3.0.
|
|
64
|
+
const VERSION = "3.0.76";
|
|
65
65
|
//#endregion
|
|
66
66
|
//#region src/cerebras-provider.ts
|
|
67
67
|
const cerebrasErrorStructure = {
|
package/docs/40-cerebras.mdx
CHANGED
|
@@ -1,19 +1,66 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Cerebras
|
|
3
|
-
description: Learn how to use Cerebras
|
|
3
|
+
description: Learn how to use Cerebras with AI Gateway and the direct provider.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Cerebras Provider
|
|
7
7
|
|
|
8
8
|
The [Cerebras](https://cerebras.ai) provider offers access to powerful language models through the Cerebras API, including their high-speed inference capabilities powered by Wafer-Scale Engines and CS-3 systems.
|
|
9
|
+
Start with [AI Gateway](/providers/ai-sdk-providers/ai-gateway) for models in its catalog (recommended), or use `@ai-sdk/cerebras` to connect directly to Cerebras.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
```ts provider="cerebras" model="openai/gpt-oss-120b"
|
|
12
|
+
import { generateText } from 'ai';
|
|
13
|
+
__PROVIDER_IMPORT__;
|
|
14
|
+
|
|
15
|
+
const { text } = await generateText({
|
|
16
|
+
model: __MODEL__,
|
|
17
|
+
prompt: 'Write a vegetarian lasagna recipe for 4 people.',
|
|
18
|
+
__GATEWAY_OPTIONS__,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
console.log(text);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Using AI Gateway
|
|
25
|
+
|
|
26
|
+
The AI SDK uses AI Gateway by default for model strings. Gateway provides access to models across providers through a single API key, with usage and cost tracking. Install `ai`:
|
|
27
|
+
|
|
28
|
+
<InstallPackages packages="ai" />
|
|
29
|
+
|
|
30
|
+
Set an [AI Gateway API key](https://vercel.com/docs/ai-gateway/getting-started) in your environment:
|
|
11
31
|
|
|
12
|
-
|
|
32
|
+
```bash
|
|
33
|
+
export AI_GATEWAY_API_KEY=your_api_key_here
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Vercel deployments can also use [OIDC authentication](/providers/ai-sdk-providers/ai-gateway#oidc-authentication-vercel-deployments).
|
|
37
|
+
See the [AI Gateway provider documentation](/providers/ai-sdk-providers/ai-gateway) for configuration and the [model catalog](https://vercel.com/ai-gateway/models) for available models.
|
|
38
|
+
|
|
39
|
+
The example sets `providerOptions.gateway.order` to `['cerebras']`. This sends the request to Cerebras first, then falls back to other available providers of the same model if Cerebras is unavailable or the request fails. `order` sets a preference; it does not restrict fallback to Cerebras. See [provider ordering](https://vercel.com/docs/ai-gateway/models-and-providers/provider-filtering-and-ordering).
|
|
40
|
+
|
|
41
|
+
The dropdown lists models served by Cerebras through Gateway with a corresponding direct-provider example. Provider availability depends on the model and your team's [Provider Allowlist](https://vercel.com/docs/ai-gateway/models-and-providers/provider-filtering-and-ordering).
|
|
42
|
+
|
|
43
|
+
## Using `@ai-sdk/cerebras`
|
|
44
|
+
|
|
45
|
+
For direct access to Cerebras, install `ai` and `@ai-sdk/cerebras`:
|
|
13
46
|
|
|
14
|
-
|
|
47
|
+
<InstallPackages packages="ai @ai-sdk/cerebras" />
|
|
15
48
|
|
|
16
|
-
|
|
49
|
+
Set your Cerebras API credential in the `CEREBRAS_API_KEY` environment variable:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
export CEREBRAS_API_KEY=your_api_key_here
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
AI Gateway does not expose every API in `@ai-sdk/cerebras`. Use the direct provider for provider-specific APIs or custom connection settings.
|
|
56
|
+
|
|
57
|
+
<Note>
|
|
58
|
+
The following sections document the direct `@ai-sdk/cerebras` provider,
|
|
59
|
+
including its model factories and settings. Gateway model and feature
|
|
60
|
+
availability can differ.
|
|
61
|
+
</Note>
|
|
62
|
+
|
|
63
|
+
API keys can be obtained from the [Cerebras Platform](https://cloud.cerebras.ai).
|
|
17
64
|
|
|
18
65
|
## Provider Instance
|
|
19
66
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/cerebras",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.76",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@ai-sdk/openai-compatible": "3.0.
|
|
33
|
-
"@ai-sdk/provider": "4.0.
|
|
34
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
32
|
+
"@ai-sdk/openai-compatible": "3.0.76",
|
|
33
|
+
"@ai-sdk/provider": "4.0.32",
|
|
34
|
+
"@ai-sdk/provider-utils": "5.0.66"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "22.19.19",
|