@ai-sdk/cerebras 2.0.18 → 2.0.19

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/cerebras
2
2
 
3
+ ## 2.0.19
4
+
5
+ ### Patch Changes
6
+
7
+ - 2b8369d: chore: add docs to package dist
8
+
3
9
  ## 2.0.18
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ var import_provider_utils = require("@ai-sdk/provider-utils");
33
33
  var import_v4 = require("zod/v4");
34
34
 
35
35
  // src/version.ts
36
- var VERSION = true ? "2.0.18" : "0.0.0-test";
36
+ var VERSION = true ? "2.0.19" : "0.0.0-test";
37
37
 
38
38
  // src/cerebras-provider.ts
39
39
  var cerebrasErrorSchema = import_v4.z.object({
package/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  import { z } from "zod/v4";
12
12
 
13
13
  // src/version.ts
14
- var VERSION = true ? "2.0.18" : "0.0.0-test";
14
+ var VERSION = true ? "2.0.19" : "0.0.0-test";
15
15
 
16
16
  // src/cerebras-provider.ts
17
17
  var cerebrasErrorSchema = z.object({
@@ -0,0 +1,119 @@
1
+ ---
2
+ title: Cerebras
3
+ description: Learn how to use Cerebras's models with the AI SDK.
4
+ ---
5
+
6
+ # Cerebras Provider
7
+
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
+
10
+ API keys can be obtained from the [Cerebras Platform](https://cloud.cerebras.ai).
11
+
12
+ ## Setup
13
+
14
+ The Cerebras provider is available via the `@ai-sdk/cerebras` module. You can install it with:
15
+
16
+ <Tabs items={['pnpm', 'npm', 'yarn', 'bun']}>
17
+ <Tab>
18
+ <Snippet text="pnpm add @ai-sdk/cerebras" dark />
19
+ </Tab>
20
+ <Tab>
21
+ <Snippet text="npm install @ai-sdk/cerebras" dark />
22
+ </Tab>
23
+ <Tab>
24
+ <Snippet text="yarn add @ai-sdk/cerebras" dark />
25
+ </Tab>
26
+
27
+ <Tab>
28
+ <Snippet text="bun add @ai-sdk/cerebras" dark />
29
+ </Tab>
30
+ </Tabs>
31
+
32
+ ## Provider Instance
33
+
34
+ You can import the default provider instance `cerebras` from `@ai-sdk/cerebras`:
35
+
36
+ ```ts
37
+ import { cerebras } from '@ai-sdk/cerebras';
38
+ ```
39
+
40
+ For custom configuration, you can import `createCerebras` and create a provider instance with your settings:
41
+
42
+ ```ts
43
+ import { createCerebras } from '@ai-sdk/cerebras';
44
+
45
+ const cerebras = createCerebras({
46
+ apiKey: process.env.CEREBRAS_API_KEY ?? '',
47
+ });
48
+ ```
49
+
50
+ You can use the following optional settings to customize the Cerebras provider instance:
51
+
52
+ - **baseURL** _string_
53
+
54
+ Use a different URL prefix for API calls.
55
+ The default prefix is `https://api.cerebras.ai/v1`.
56
+
57
+ - **apiKey** _string_
58
+
59
+ API key that is being sent using the `Authorization` header. It defaults to
60
+ the `CEREBRAS_API_KEY` environment variable.
61
+
62
+ - **headers** _Record&lt;string,string&gt;_
63
+
64
+ Custom headers to include in the requests.
65
+
66
+ - **fetch** _(input: RequestInfo, init?: RequestInit) => Promise&lt;Response&gt;_
67
+
68
+ Custom [fetch](https://developer.mozilla.org/en-US/docs/Web/API/fetch) implementation.
69
+
70
+ ## Language Models
71
+
72
+ You can create language models using a provider instance:
73
+
74
+ ```ts
75
+ import { cerebras } from '@ai-sdk/cerebras';
76
+ import { generateText } from 'ai';
77
+
78
+ const { text } = await generateText({
79
+ model: cerebras('llama3.1-8b'),
80
+ prompt: 'Write a vegetarian lasagna recipe for 4 people.',
81
+ });
82
+ ```
83
+
84
+ Cerebras language models can be used in the `streamText` function
85
+ (see [AI SDK Core](/docs/ai-sdk-core)).
86
+
87
+ You can create Cerebras language models using a provider instance. The first argument is the model ID, e.g. `llama-3.3-70b`:
88
+
89
+ ```ts
90
+ const model = cerebras('llama-3.3-70b');
91
+ ```
92
+
93
+ You can also use the `.languageModel()` and `.chat()` methods:
94
+
95
+ ```ts
96
+ const model = cerebras.languageModel('llama-3.3-70b');
97
+ const model = cerebras.chat('llama-3.3-70b');
98
+ ```
99
+
100
+ ## Model Capabilities
101
+
102
+ | Model | Image Input | Object Generation | Tool Usage | Tool Streaming |
103
+ | -------------------------------- | ------------------- | ------------------- | ------------------- | ------------------- |
104
+ | `llama3.1-8b` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
105
+ | `llama-3.3-70b` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
106
+ | `gpt-oss-120b` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
107
+ | `qwen-3-32b` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
108
+ | `qwen-3-235b-a22b-instruct-2507` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
109
+ | `qwen-3-235b-a22b-thinking-2507` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
110
+ | `zai-glm-4.6` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
111
+ | `zai-glm-4.7` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
112
+
113
+ <Note>
114
+ Please see the [Cerebras
115
+ docs](https://inference-docs.cerebras.ai/introduction) for more details about
116
+ the available models. Note that context windows are temporarily limited to
117
+ 8192 tokens in the Free Tier. You can also pass any available provider model
118
+ ID as a string if needed.
119
+ </Note>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/cerebras",
3
- "version": "2.0.18",
3
+ "version": "2.0.19",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -8,10 +8,14 @@
8
8
  "types": "./dist/index.d.ts",
9
9
  "files": [
10
10
  "dist/**/*",
11
+ "docs/**/*",
11
12
  "src",
12
13
  "CHANGELOG.md",
13
14
  "README.md"
14
15
  ],
16
+ "directories": {
17
+ "doc": "./docs"
18
+ },
15
19
  "exports": {
16
20
  "./package.json": "./package.json",
17
21
  ".": {
@@ -58,7 +62,7 @@
58
62
  "scripts": {
59
63
  "build": "pnpm clean && tsup --tsconfig tsconfig.build.json",
60
64
  "build:watch": "pnpm clean && tsup --watch",
61
- "clean": "del-cli dist *.tsbuildinfo",
65
+ "clean": "del-cli dist docs *.tsbuildinfo",
62
66
  "lint": "eslint \"./**/*.ts*\"",
63
67
  "type-check": "tsc --build",
64
68
  "prettier-check": "prettier --check \"./**/*.ts*\"",