@ai-sdk/xai 5.0.4 → 5.0.6

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/docs/01-xai.mdx CHANGED
@@ -59,10 +59,10 @@ You can use the following optional settings to customize the xAI provider instan
59
59
  ## Language Models
60
60
 
61
61
  You can create [xAI models](https://console.x.ai) using a provider instance. The
62
- first argument is the model id, e.g. `grok-4.6`.
62
+ first argument is the model id, e.g. `grok-4.7`.
63
63
 
64
64
  ```ts
65
- const model = xai('grok-4.6');
65
+ const model = xai('grok-4.7');
66
66
  ```
67
67
 
68
68
  ### Example
@@ -74,7 +74,7 @@ import { xai } from '@ai-sdk/xai';
74
74
  import { generateText } from 'ai';
75
75
 
76
76
  const { text } = await generateText({
77
- model: xai('grok-4.6'),
77
+ model: xai('grok-4.7'),
78
78
  prompt: 'Write a vegetarian lasagna recipe for 4 people.',
79
79
  });
80
80
  ```
@@ -140,7 +140,7 @@ import { xai } from '@ai-sdk/xai';
140
140
  import { generateText } from 'ai';
141
141
 
142
142
  const { providerMetadata } = await generateText({
143
- model: xai('grok-4.6'),
143
+ model: xai('grok-4.7'),
144
144
  prompt: 'Explain quantum entanglement.',
145
145
  providerOptions: {
146
146
  xai: { serviceTier: 'priority' },
@@ -189,7 +189,7 @@ calling pattern.
189
189
  The xAI Responses API is the default when using `xai(modelId)` (since AI SDK 7). You can also use `xai.responses(modelId)` explicitly. This enables the model to autonomously orchestrate tool calls and research on xAI's servers.
190
190
 
191
191
  ```ts
192
- const model = xai.responses('grok-4.6');
192
+ const model = xai.responses('grok-4.7');
193
193
  ```
194
194
 
195
195
  The Responses API provides server-side tools that the model can autonomously execute during its reasoning process:
@@ -211,7 +211,7 @@ import { xai } from '@ai-sdk/xai';
211
211
  import { generateText } from 'ai';
212
212
 
213
213
  const { text } = await generateText({
214
- model: xai.responses('grok-4.6'),
214
+ model: xai.responses('grok-4.7'),
215
215
  messages: [
216
216
  {
217
217
  role: 'user',
@@ -236,7 +236,7 @@ import { xai } from '@ai-sdk/xai';
236
236
  import { generateText } from 'ai';
237
237
 
238
238
  const { text } = await generateText({
239
- model: xai('grok-4.6'),
239
+ model: xai('grok-4.7'),
240
240
  messages: [
241
241
  {
242
242
  role: 'user',
@@ -273,7 +273,7 @@ import { xai } from '@ai-sdk/xai';
273
273
  import { generateText } from 'ai';
274
274
 
275
275
  const { text, sources } = await generateText({
276
- model: xai.responses('grok-4.6'),
276
+ model: xai.responses('grok-4.7'),
277
277
  prompt: 'What are the latest developments in AI?',
278
278
  tools: {
279
279
  web_search: xai.tools.webSearch({
@@ -311,7 +311,7 @@ The X search tool enables searching X (Twitter) for posts, with filtering by han
311
311
 
312
312
  ```ts
313
313
  const { text, sources } = await generateText({
314
- model: xai.responses('grok-4.6'),
314
+ model: xai.responses('grok-4.7'),
315
315
  prompt: 'What are people saying about AI on X this week?',
316
316
  tools: {
317
317
  x_search: xai.tools.xSearch({
@@ -357,7 +357,7 @@ The code execution tool enables the model to write and execute Python code for c
357
357
 
358
358
  ```ts
359
359
  const { text } = await generateText({
360
- model: xai.responses('grok-4.6'),
360
+ model: xai.responses('grok-4.7'),
361
361
  prompt:
362
362
  'Calculate the compound interest for $10,000 at 5% annually for 10 years',
363
363
  tools: {
@@ -372,7 +372,7 @@ The view image tool enables the model to view and analyze images:
372
372
 
373
373
  ```ts
374
374
  const { text } = await generateText({
375
- model: xai.responses('grok-4.6'),
375
+ model: xai.responses('grok-4.7'),
376
376
  prompt: 'Describe what you see in the image',
377
377
  tools: {
378
378
  view_image: xai.tools.viewImage(),
@@ -386,7 +386,7 @@ The view X video tool enables the model to view and analyze videos from X (Twitt
386
386
 
387
387
  ```ts
388
388
  const { text } = await generateText({
389
- model: xai.responses('grok-4.6'),
389
+ model: xai.responses('grok-4.7'),
390
390
  prompt: 'Summarize the content of this X video',
391
391
  tools: {
392
392
  view_x_video: xai.tools.viewXVideo(),
@@ -403,7 +403,7 @@ import { xai } from '@ai-sdk/xai';
403
403
  import { generateText } from 'ai';
404
404
 
405
405
  const result = await generateText({
406
- model: xai.responses('grok-4.6'),
406
+ model: xai.responses('grok-4.7'),
407
407
  prompt:
408
408
  'Generate an image of a corgi surfing a big wave, in the style of a Japanese woodblock print',
409
409
  tools: {
@@ -441,7 +441,7 @@ The MCP server tool enables the model to connect to remote [Model Context Protoc
441
441
 
442
442
  ```ts
443
443
  const { text } = await generateText({
444
- model: xai.responses('grok-4.6'),
444
+ model: xai.responses('grok-4.7'),
445
445
  prompt: 'Use the weather tool to check conditions in San Francisco',
446
446
  tools: {
447
447
  weather_server: xai.tools.mcpServer({
@@ -489,7 +489,7 @@ import { xai, type XaiLanguageModelResponsesOptions } from '@ai-sdk/xai';
489
489
  import { streamText } from 'ai';
490
490
 
491
491
  const result = streamText({
492
- model: xai.responses('grok-4.6'),
492
+ model: xai.responses('grok-4.7'),
493
493
  prompt: 'What documents do you have access to?',
494
494
  tools: {
495
495
  file_search: xai.tools.fileSearch({
@@ -536,7 +536,7 @@ import { xai } from '@ai-sdk/xai';
536
536
  import { streamText } from 'ai';
537
537
 
538
538
  const { stream } = streamText({
539
- model: xai.responses('grok-4.6'),
539
+ model: xai.responses('grok-4.7'),
540
540
  prompt: 'Research AI safety developments and calculate risk metrics',
541
541
  tools: {
542
542
  web_search: xai.tools.webSearch(),
@@ -570,7 +570,7 @@ import { xai, type XaiLanguageModelResponsesOptions } from '@ai-sdk/xai';
570
570
  import { generateText } from 'ai';
571
571
 
572
572
  const result = await generateText({
573
- model: xai.responses('grok-4.6'),
573
+ model: xai.responses('grok-4.7'),
574
574
  providerOptions: {
575
575
  xai: {
576
576
  reasoningEffort: 'high',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/xai",
3
- "version": "5.0.4",
3
+ "version": "5.0.6",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -29,8 +29,8 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@ai-sdk/provider": "4.0.17",
33
- "@ai-sdk/provider-utils": "5.0.45"
32
+ "@ai-sdk/provider": "4.0.18",
33
+ "@ai-sdk/provider-utils": "5.0.46"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@ai-sdk/test-server": "2.0.1",
@@ -6,6 +6,7 @@ export type XaiResponsesModelId =
6
6
  | 'grok-4.3'
7
7
  | 'grok-4.5'
8
8
  | 'grok-4.6'
9
+ | 'grok-4.7'
9
10
  | 'grok-latest'
10
11
  | (string & {});
11
12