@ai-sdk/xai 3.0.61 → 3.0.63
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 +14 -0
- package/README.md +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/docs/01-xai.mdx +9 -18
- package/package.json +4 -4
- package/src/responses/xai-responses-options.ts +1 -1
- package/src/xai-chat-options.ts +0 -9
package/docs/01-xai.mdx
CHANGED
|
@@ -142,7 +142,7 @@ The following optional provider options are available for xAI chat models:
|
|
|
142
142
|
You can use the xAI Responses API with the `xai.responses(modelId)` factory method for server-side agentic tool calling. This enables the model to autonomously orchestrate tool calls and research on xAI's servers.
|
|
143
143
|
|
|
144
144
|
```ts
|
|
145
|
-
const model = xai.responses('grok-4-fast');
|
|
145
|
+
const model = xai.responses('grok-4-fast-non-reasoning');
|
|
146
146
|
```
|
|
147
147
|
|
|
148
148
|
The Responses API provides server-side tools that the model can autonomously execute during its reasoning process:
|
|
@@ -186,7 +186,7 @@ import { xai } from '@ai-sdk/xai';
|
|
|
186
186
|
import { generateText } from 'ai';
|
|
187
187
|
|
|
188
188
|
const { text, sources } = await generateText({
|
|
189
|
-
model: xai.responses('grok-4-fast'),
|
|
189
|
+
model: xai.responses('grok-4-fast-non-reasoning'),
|
|
190
190
|
prompt: 'What are the latest developments in AI?',
|
|
191
191
|
tools: {
|
|
192
192
|
web_search: xai.tools.webSearch({
|
|
@@ -220,7 +220,7 @@ The X search tool enables searching X (Twitter) for posts, with filtering by han
|
|
|
220
220
|
|
|
221
221
|
```ts
|
|
222
222
|
const { text, sources } = await generateText({
|
|
223
|
-
model: xai.responses('grok-4-fast'),
|
|
223
|
+
model: xai.responses('grok-4-fast-non-reasoning'),
|
|
224
224
|
prompt: 'What are people saying about AI on X this week?',
|
|
225
225
|
tools: {
|
|
226
226
|
x_search: xai.tools.xSearch({
|
|
@@ -266,7 +266,7 @@ The code execution tool enables the model to write and execute Python code for c
|
|
|
266
266
|
|
|
267
267
|
```ts
|
|
268
268
|
const { text } = await generateText({
|
|
269
|
-
model: xai.responses('grok-4-fast'),
|
|
269
|
+
model: xai.responses('grok-4-fast-non-reasoning'),
|
|
270
270
|
prompt:
|
|
271
271
|
'Calculate the compound interest for $10,000 at 5% annually for 10 years',
|
|
272
272
|
tools: {
|
|
@@ -281,7 +281,7 @@ The view image tool enables the model to view and analyze images:
|
|
|
281
281
|
|
|
282
282
|
```ts
|
|
283
283
|
const { text } = await generateText({
|
|
284
|
-
model: xai.responses('grok-4-fast'),
|
|
284
|
+
model: xai.responses('grok-4-fast-non-reasoning'),
|
|
285
285
|
prompt: 'Describe what you see in the image',
|
|
286
286
|
tools: {
|
|
287
287
|
view_image: xai.tools.viewImage(),
|
|
@@ -295,7 +295,7 @@ The view X video tool enables the model to view and analyze videos from X (Twitt
|
|
|
295
295
|
|
|
296
296
|
```ts
|
|
297
297
|
const { text } = await generateText({
|
|
298
|
-
model: xai.responses('grok-4-fast'),
|
|
298
|
+
model: xai.responses('grok-4-fast-non-reasoning'),
|
|
299
299
|
prompt: 'Summarize the content of this X video',
|
|
300
300
|
tools: {
|
|
301
301
|
view_x_video: xai.tools.viewXVideo(),
|
|
@@ -309,7 +309,7 @@ The MCP server tool enables the model to connect to remote [Model Context Protoc
|
|
|
309
309
|
|
|
310
310
|
```ts
|
|
311
311
|
const { text } = await generateText({
|
|
312
|
-
model: xai.responses('grok-4-fast'),
|
|
312
|
+
model: xai.responses('grok-4-fast-non-reasoning'),
|
|
313
313
|
prompt: 'Use the weather tool to check conditions in San Francisco',
|
|
314
314
|
tools: {
|
|
315
315
|
weather_server: xai.tools.mcpServer({
|
|
@@ -404,7 +404,7 @@ import { xai } from '@ai-sdk/xai';
|
|
|
404
404
|
import { streamText } from 'ai';
|
|
405
405
|
|
|
406
406
|
const { fullStream } = streamText({
|
|
407
|
-
model: xai.responses('grok-4-fast'),
|
|
407
|
+
model: xai.responses('grok-4-fast-non-reasoning'),
|
|
408
408
|
prompt: 'Research AI safety developments and calculate risk metrics',
|
|
409
409
|
tools: {
|
|
410
410
|
web_search: xai.tools.webSearch(),
|
|
@@ -438,7 +438,7 @@ import { xai, type XaiLanguageModelResponsesOptions } from '@ai-sdk/xai';
|
|
|
438
438
|
import { generateText } from 'ai';
|
|
439
439
|
|
|
440
440
|
const result = await generateText({
|
|
441
|
-
model: xai.responses('grok-4-fast'),
|
|
441
|
+
model: xai.responses('grok-4-fast-non-reasoning'),
|
|
442
442
|
providerOptions: {
|
|
443
443
|
xai: {
|
|
444
444
|
reasoningEffort: 'high',
|
|
@@ -779,20 +779,11 @@ console.log('Sources:', await result.sources);
|
|
|
779
779
|
| `grok-4-latest` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
780
780
|
| `grok-3` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
781
781
|
| `grok-3-latest` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
782
|
-
| `grok-3-fast` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
783
|
-
| `grok-3-fast-latest` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
784
782
|
| `grok-3-mini` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
785
783
|
| `grok-3-mini-latest` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
786
|
-
| `grok-3-mini-fast` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
787
|
-
| `grok-3-mini-fast-latest` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
788
|
-
| `grok-2` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
789
|
-
| `grok-2-latest` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
790
|
-
| `grok-2-1212` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
791
784
|
| `grok-2-vision` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
792
785
|
| `grok-2-vision-latest` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
793
786
|
| `grok-2-vision-1212` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
794
|
-
| `grok-beta` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
|
|
795
|
-
| `grok-vision-beta` | <Check size={18} /> | <Cross size={18} /> | <Cross size={18} /> | <Cross size={18} /> | <Cross size={18} /> |
|
|
796
787
|
|
|
797
788
|
<Note>
|
|
798
789
|
The table above lists popular models. Please see the [xAI
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/xai",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.63",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@ai-sdk/openai-compatible": "2.0.
|
|
33
|
-
"@ai-sdk/provider
|
|
34
|
-
"@ai-sdk/provider": "
|
|
32
|
+
"@ai-sdk/openai-compatible": "2.0.32",
|
|
33
|
+
"@ai-sdk/provider": "3.0.8",
|
|
34
|
+
"@ai-sdk/provider-utils": "4.0.17"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "20.17.24",
|
package/src/xai-chat-options.ts
CHANGED
|
@@ -12,23 +12,14 @@ export type XaiChatModelId =
|
|
|
12
12
|
| 'grok-4-latest'
|
|
13
13
|
| 'grok-3'
|
|
14
14
|
| 'grok-3-latest'
|
|
15
|
-
| 'grok-3-fast'
|
|
16
|
-
| 'grok-3-fast-latest'
|
|
17
15
|
| 'grok-3-mini'
|
|
18
16
|
| 'grok-3-mini-latest'
|
|
19
|
-
| 'grok-3-mini-fast'
|
|
20
|
-
| 'grok-3-mini-fast-latest'
|
|
21
17
|
| 'grok-2-vision-1212'
|
|
22
18
|
| 'grok-2-vision'
|
|
23
19
|
| 'grok-2-vision-latest'
|
|
24
20
|
| 'grok-2-image-1212'
|
|
25
21
|
| 'grok-2-image'
|
|
26
22
|
| 'grok-2-image-latest'
|
|
27
|
-
| 'grok-2-1212'
|
|
28
|
-
| 'grok-2'
|
|
29
|
-
| 'grok-2-latest'
|
|
30
|
-
| 'grok-vision-beta'
|
|
31
|
-
| 'grok-beta'
|
|
32
23
|
| (string & {});
|
|
33
24
|
|
|
34
25
|
// search source schemas
|