@ai-sdk/xai 4.0.0-beta.3 → 4.0.0-beta.31

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,227 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 4.0.0-beta.31
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [e311194]
8
+ - @ai-sdk/provider@4.0.0-beta.9
9
+ - @ai-sdk/openai-compatible@3.0.0-beta.20
10
+ - @ai-sdk/provider-utils@5.0.0-beta.15
11
+
12
+ ## 4.0.0-beta.30
13
+
14
+ ### Patch Changes
15
+
16
+ - e5bdc8d: fix (provider/xai): handle mid-stream error chunks
17
+
18
+ ## 4.0.0-beta.29
19
+
20
+ ### Patch Changes
21
+
22
+ - 813851f: fix (provider/xai): add response.incomplete and response.failed streaming event handling
23
+
24
+ ## 4.0.0-beta.28
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies [34bd95d]
29
+ - Updated dependencies [008271d]
30
+ - @ai-sdk/provider@4.0.0-beta.8
31
+ - @ai-sdk/openai-compatible@3.0.0-beta.19
32
+ - @ai-sdk/provider-utils@5.0.0-beta.14
33
+
34
+ ## 4.0.0-beta.27
35
+
36
+ ### Patch Changes
37
+
38
+ - Updated dependencies [b0c2869]
39
+ - Updated dependencies [7e26e81]
40
+ - @ai-sdk/provider-utils@5.0.0-beta.13
41
+ - @ai-sdk/openai-compatible@3.0.0-beta.18
42
+
43
+ ## 4.0.0-beta.26
44
+
45
+ ### Patch Changes
46
+
47
+ - Updated dependencies [816ff67]
48
+ - @ai-sdk/openai-compatible@3.0.0-beta.17
49
+
50
+ ## 4.0.0-beta.25
51
+
52
+ ### Patch Changes
53
+
54
+ - Updated dependencies [46d1149]
55
+ - @ai-sdk/provider-utils@5.0.0-beta.12
56
+ - @ai-sdk/openai-compatible@3.0.0-beta.16
57
+
58
+ ## 4.0.0-beta.24
59
+
60
+ ### Patch Changes
61
+
62
+ - Updated dependencies [6fd51c0]
63
+ - @ai-sdk/provider-utils@5.0.0-beta.11
64
+ - @ai-sdk/provider@4.0.0-beta.7
65
+ - @ai-sdk/openai-compatible@3.0.0-beta.15
66
+
67
+ ## 4.0.0-beta.23
68
+
69
+ ### Patch Changes
70
+
71
+ - c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
72
+ - Updated dependencies [c29a26f]
73
+ - @ai-sdk/openai-compatible@3.0.0-beta.14
74
+ - @ai-sdk/provider-utils@5.0.0-beta.10
75
+ - @ai-sdk/provider@4.0.0-beta.6
76
+
77
+ ## 4.0.0-beta.22
78
+
79
+ ### Patch Changes
80
+
81
+ - f51c95e: feat(provider/xai): add video extension and reference-to-video (R2V) support
82
+
83
+ ## 4.0.0-beta.21
84
+
85
+ ### Patch Changes
86
+
87
+ - 38fc777: Add AI Gateway hint to provider READMEs
88
+ - Updated dependencies [38fc777]
89
+ - @ai-sdk/openai-compatible@3.0.0-beta.13
90
+
91
+ ## 4.0.0-beta.20
92
+
93
+ ### Patch Changes
94
+
95
+ - Updated dependencies [2e17091]
96
+ - @ai-sdk/provider-utils@5.0.0-beta.9
97
+ - @ai-sdk/openai-compatible@3.0.0-beta.12
98
+
99
+ ## 4.0.0-beta.19
100
+
101
+ ### Patch Changes
102
+
103
+ - Updated dependencies [986c6fd]
104
+ - Updated dependencies [493295c]
105
+ - @ai-sdk/provider-utils@5.0.0-beta.8
106
+ - @ai-sdk/openai-compatible@3.0.0-beta.11
107
+
108
+ ## 4.0.0-beta.18
109
+
110
+ ### Patch Changes
111
+
112
+ - 9f20868: fix(provider/xai): correct finish reason for tool calls
113
+
114
+ ## 4.0.0-beta.17
115
+
116
+ ### Patch Changes
117
+
118
+ - Updated dependencies [1f509d4]
119
+ - @ai-sdk/provider-utils@5.0.0-beta.7
120
+ - @ai-sdk/provider@4.0.0-beta.5
121
+ - @ai-sdk/openai-compatible@3.0.0-beta.10
122
+
123
+ ## 4.0.0-beta.16
124
+
125
+ ### Patch Changes
126
+
127
+ - 4f91b5d: chore(provider/xai): update Grok 4.20 model IDs to their non-beta versions
128
+
129
+ ## 4.0.0-beta.15
130
+
131
+ ### Patch Changes
132
+
133
+ - 74d520f: feat: migrate providers to support new top-level `reasoning` parameter
134
+ - Updated dependencies [74d520f]
135
+ - @ai-sdk/openai-compatible@3.0.0-beta.9
136
+
137
+ ## 4.0.0-beta.14
138
+
139
+ ### Patch Changes
140
+
141
+ - Updated dependencies [3887c70]
142
+ - @ai-sdk/provider-utils@5.0.0-beta.6
143
+ - @ai-sdk/provider@4.0.0-beta.4
144
+ - @ai-sdk/openai-compatible@3.0.0-beta.8
145
+
146
+ ## 4.0.0-beta.13
147
+
148
+ ### Major Changes
149
+
150
+ - 776b617: feat(provider): adding new 'custom' content type
151
+
152
+ ### Patch Changes
153
+
154
+ - Updated dependencies [776b617]
155
+ - @ai-sdk/provider-utils@5.0.0-beta.5
156
+ - @ai-sdk/provider@4.0.0-beta.3
157
+ - @ai-sdk/openai-compatible@3.0.0-beta.7
158
+
159
+ ## 4.0.0-beta.12
160
+
161
+ ### Patch Changes
162
+
163
+ - d20829e: feat(provider/xai): add moderation error, and costInUsdTicks to video model
164
+ - Updated dependencies [61753c3]
165
+ - @ai-sdk/provider-utils@5.0.0-beta.4
166
+ - @ai-sdk/openai-compatible@3.0.0-beta.6
167
+
168
+ ## 4.0.0-beta.11
169
+
170
+ ### Patch Changes
171
+
172
+ - f7d4f01: feat(provider): add support for `reasoning-file` type for files that are part of reasoning
173
+ - Updated dependencies [f7d4f01]
174
+ - @ai-sdk/provider-utils@5.0.0-beta.3
175
+ - @ai-sdk/provider@4.0.0-beta.2
176
+ - @ai-sdk/openai-compatible@3.0.0-beta.5
177
+
178
+ ## 4.0.0-beta.10
179
+
180
+ ### Patch Changes
181
+
182
+ - Updated dependencies [5c2a5a2]
183
+ - @ai-sdk/provider@4.0.0-beta.1
184
+ - @ai-sdk/openai-compatible@3.0.0-beta.4
185
+ - @ai-sdk/provider-utils@5.0.0-beta.2
186
+
187
+ ## 4.0.0-beta.9
188
+
189
+ ### Patch Changes
190
+
191
+ - Updated dependencies [8f3e1da]
192
+ - @ai-sdk/openai-compatible@3.0.0-beta.3
193
+
194
+ ## 4.0.0-beta.8
195
+
196
+ ### Patch Changes
197
+
198
+ - 4799fa5: chore(provider/xai): update provider to use v4 types
199
+
200
+ ## 4.0.0-beta.7
201
+
202
+ ### Patch Changes
203
+
204
+ - 0f11f10: add reasoningSummary to responses API provider options
205
+ - 12115e9: fix reasoning text extraction from content in responses doGenerate
206
+
207
+ ## 4.0.0-beta.6
208
+
209
+ ### Major Changes
210
+
211
+ - f62681f: feat(provider/xai): make responses api the default
212
+
213
+ ## 4.0.0-beta.5
214
+
215
+ ### Patch Changes
216
+
217
+ - aa5a583: chore(provider/xai): remove obsolete Grok 2 models now that they are shut down in their API
218
+
219
+ ## 4.0.0-beta.4
220
+
221
+ ### Patch Changes
222
+
223
+ - 25f1837: feat(xai): add b64_json response format, usage cost tracking, and quality/user parameters for image models
224
+
3
225
  ## 4.0.0-beta.3
4
226
 
5
227
  ### Patch Changes
@@ -530,13 +752,13 @@
530
752
  Before
531
753
 
532
754
  ```ts
533
- model.textEmbeddingModel('my-model-id');
755
+ model.textEmbeddingModel("my-model-id");
534
756
  ```
535
757
 
536
758
  After
537
759
 
538
760
  ```ts
539
- model.embeddingModel('my-model-id');
761
+ model.embeddingModel("my-model-id");
540
762
  ```
541
763
 
542
764
  - 2625a04: feat(openai); update spec for mcp approval
@@ -794,13 +1016,13 @@
794
1016
  Before
795
1017
 
796
1018
  ```ts
797
- model.textEmbeddingModel('my-model-id');
1019
+ model.textEmbeddingModel("my-model-id");
798
1020
  ```
799
1021
 
800
1022
  After
801
1023
 
802
1024
  ```ts
803
- model.embeddingModel('my-model-id');
1025
+ model.embeddingModel("my-model-id");
804
1026
  ```
805
1027
 
806
1028
  - 8514146: add grok-4-1 model IDs
@@ -1343,7 +1565,7 @@
1343
1565
 
1344
1566
  ```js
1345
1567
  await generateImage({
1346
- model: luma.image('photon-flash-1', {
1568
+ model: luma.image("photon-flash-1", {
1347
1569
  maxImagesPerCall: 5,
1348
1570
  pollIntervalMillis: 500,
1349
1571
  }),
@@ -1356,7 +1578,7 @@
1356
1578
 
1357
1579
  ```js
1358
1580
  await generateImage({
1359
- model: luma.image('photon-flash-1'),
1581
+ model: luma.image("photon-flash-1"),
1360
1582
  prompt,
1361
1583
  n: 10,
1362
1584
  maxImagesPerCall: 5,
@@ -1672,7 +1894,7 @@
1672
1894
 
1673
1895
  ```js
1674
1896
  await generateImage({
1675
- model: luma.image('photon-flash-1', {
1897
+ model: luma.image("photon-flash-1", {
1676
1898
  maxImagesPerCall: 5,
1677
1899
  pollIntervalMillis: 500,
1678
1900
  }),
@@ -1685,7 +1907,7 @@
1685
1907
 
1686
1908
  ```js
1687
1909
  await generateImage({
1688
- model: luma.image('photon-flash-1'),
1910
+ model: luma.image("photon-flash-1"),
1689
1911
  prompt,
1690
1912
  n: 10,
1691
1913
  maxImagesPerCall: 5,
package/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
  The **[xAI Grok provider](https://ai-sdk.dev/providers/ai-sdk-providers/xai)** for the [AI SDK](https://ai-sdk.dev/docs)
4
4
  contains language model support for the xAI chat and completion APIs.
5
5
 
6
+ > **Deploying to Vercel?** With Vercel's AI Gateway you can access xAI (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).
7
+
6
8
  ## Setup
7
9
 
8
10
  The xAI Grok provider is available in the `@ai-sdk/xai` module. You can install it with
package/dist/index.d.mts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod/v4';
2
- import { ProviderV3, LanguageModelV3, ImageModelV3, Experimental_VideoModelV3 } from '@ai-sdk/provider';
3
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
4
- import { FetchFunction } from '@ai-sdk/provider-utils';
3
+ import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
4
+ import { ProviderV4, LanguageModelV4, ImageModelV4, Experimental_VideoModelV4, FilesV4 } from '@ai-sdk/provider';
5
5
 
6
- type XaiChatModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4-fast-non-reasoning' | 'grok-4-fast-reasoning' | 'grok-code-fast-1' | 'grok-4' | 'grok-4-0709' | 'grok-4-latest' | 'grok-3' | 'grok-3-latest' | 'grok-3-mini' | 'grok-3-mini-latest' | 'grok-2-vision-1212' | 'grok-2-vision' | 'grok-2-vision-latest' | 'grok-2-image-1212' | 'grok-2-image' | 'grok-2-image-latest' | (string & {});
6
+ type XaiChatModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4-fast-non-reasoning' | 'grok-4-fast-reasoning' | 'grok-4.20-0309-non-reasoning' | 'grok-4.20-0309-reasoning' | 'grok-4.20-multi-agent-0309' | 'grok-code-fast-1' | 'grok-4' | 'grok-4-0709' | 'grok-4-latest' | 'grok-3' | 'grok-3-latest' | 'grok-3-mini' | 'grok-3-mini-latest' | (string & {});
7
7
  declare const xaiLanguageModelChatOptions: z.ZodObject<{
8
8
  reasoningEffort: z.ZodOptional<z.ZodEnum<{
9
9
  low: "low";
@@ -58,7 +58,7 @@ declare const xaiErrorDataSchema: z.ZodObject<{
58
58
  }, z.core.$strip>;
59
59
  type XaiErrorData = z.infer<typeof xaiErrorDataSchema>;
60
60
 
61
- type XaiResponsesModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4' | 'grok-4-fast-non-reasoning' | 'grok-4-fast-reasoning' | (string & {});
61
+ type XaiResponsesModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4' | 'grok-4-fast-non-reasoning' | 'grok-4-fast-reasoning' | 'grok-4.20-0309-non-reasoning' | 'grok-4.20-0309-reasoning' | 'grok-4.20-multi-agent-0309' | (string & {});
62
62
  /**
63
63
  * @see https://docs.x.ai/docs/api-reference#create-new-response
64
64
  */
@@ -68,6 +68,11 @@ declare const xaiLanguageModelResponsesOptions: z.ZodObject<{
68
68
  high: "high";
69
69
  medium: "medium";
70
70
  }>>;
71
+ reasoningSummary: z.ZodOptional<z.ZodEnum<{
72
+ auto: "auto";
73
+ concise: "concise";
74
+ detailed: "detailed";
75
+ }>>;
71
76
  logprobs: z.ZodOptional<z.ZodBoolean>;
72
77
  topLogprobs: z.ZodOptional<z.ZodNumber>;
73
78
  store: z.ZodOptional<z.ZodBoolean>;
@@ -86,29 +91,105 @@ declare const xaiImageModelOptions: z.ZodObject<{
86
91
  "1k": "1k";
87
92
  "2k": "2k";
88
93
  }>>;
94
+ quality: z.ZodOptional<z.ZodEnum<{
95
+ low: "low";
96
+ high: "high";
97
+ medium: "medium";
98
+ }>>;
99
+ user: z.ZodOptional<z.ZodString>;
89
100
  }, z.core.$strip>;
90
101
  type XaiImageModelOptions = z.infer<typeof xaiImageModelOptions>;
91
102
 
92
103
  type XaiVideoModelId = 'grok-imagine-video' | (string & {});
93
104
 
94
- type XaiVideoModelOptions = {
105
+ declare const resolutionSchema: z.ZodEnum<{
106
+ "480p": "480p";
107
+ "720p": "720p";
108
+ }>;
109
+ type XaiVideoResolution = z.infer<typeof resolutionSchema>;
110
+ interface XaiVideoSharedOptions {
95
111
  pollIntervalMs?: number | null;
96
112
  pollTimeoutMs?: number | null;
97
- resolution?: '480p' | '720p' | null;
98
- videoUrl?: string | null;
99
- [key: string]: unknown;
100
- };
113
+ resolution?: XaiVideoResolution | null;
114
+ }
115
+ interface XaiVideoEditModeOptions extends XaiVideoSharedOptions {
116
+ /**
117
+ * Select edit-video mode explicitly for best autocomplete and narrowing.
118
+ */
119
+ mode: 'edit-video';
120
+ /** Source video URL to edit. */
121
+ videoUrl: string;
122
+ }
123
+ interface XaiVideoExtendModeOptions extends XaiVideoSharedOptions {
124
+ /**
125
+ * Select extend-video mode explicitly for best autocomplete and narrowing.
126
+ */
127
+ mode: 'extend-video';
128
+ /** Source video URL to extend from its last frame. */
129
+ videoUrl: string;
130
+ }
131
+ interface XaiVideoReferenceToVideoOptions extends XaiVideoSharedOptions {
132
+ /**
133
+ * Select reference-to-video mode explicitly for best autocomplete and narrowing.
134
+ */
135
+ mode: 'reference-to-video';
136
+ /** Reference image URLs (1-7) for R2V generation. */
137
+ referenceImageUrls: string[];
138
+ }
139
+ interface XaiVideoGenerationOptions extends XaiVideoSharedOptions {
140
+ mode?: undefined;
141
+ videoUrl?: undefined;
142
+ referenceImageUrls?: undefined;
143
+ }
144
+ interface XaiLegacyEditVideoOptions extends XaiVideoSharedOptions {
145
+ /**
146
+ * Legacy backward-compatible shape: omitting `mode` while providing
147
+ * `videoUrl` behaves like edit-video.
148
+ */
149
+ mode?: undefined;
150
+ videoUrl: string;
151
+ }
152
+ interface XaiLegacyReferenceToVideoOptions extends XaiVideoSharedOptions {
153
+ /**
154
+ * Legacy backward-compatible shape: omitting `mode` while providing
155
+ * `referenceImageUrls` behaves like reference-to-video.
156
+ */
157
+ mode?: undefined;
158
+ referenceImageUrls: string[];
159
+ }
160
+ /**
161
+ * Provider options for xAI video generation.
162
+ *
163
+ * Use the `mode` option to select the operation:
164
+ *
165
+ * - `'edit-video'` + `videoUrl` -- video editing (`POST /v1/videos/edits`)
166
+ * - `'extend-video'` + `videoUrl` -- video extension (`POST /v1/videos/extensions`)
167
+ * - `'reference-to-video'` + `referenceImageUrls` -- R2V generation (`POST /v1/videos/generations`)
168
+ * - no `mode` -- standard generation from text prompts or image input
169
+ *
170
+ * Runtime remains backward compatible with legacy auto-detected provider
171
+ * options, but the public TypeScript type is intentionally explicit so editors
172
+ * can suggest valid modes and flag invalid field combinations.
173
+ */
174
+ type XaiVideoModelOptions = XaiVideoGenerationOptions | XaiVideoEditModeOptions | XaiVideoExtendModeOptions | XaiVideoReferenceToVideoOptions | XaiLegacyEditVideoOptions | XaiLegacyReferenceToVideoOptions;
175
+
176
+ declare const xaiFilesOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
177
+ [x: string]: unknown;
178
+ teamId?: string | undefined;
179
+ filePath?: string | undefined;
180
+ }>;
181
+ type XaiFilesOptions = InferSchema<typeof xaiFilesOptionsSchema>;
101
182
 
102
- type XaiImageModelId = 'grok-2-image' | 'grok-2-image-1212' | 'grok-imagine-image' | 'grok-imagine-image-pro' | (string & {});
183
+ type XaiImageModelId = 'grok-imagine-image' | 'grok-imagine-image-pro' | (string & {});
103
184
 
104
185
  declare const codeExecutionToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
105
186
  output: string;
106
187
  error?: string | undefined;
107
- }, object>;
188
+ }, object, {}>;
108
189
  declare const codeExecution: (args?: Parameters<typeof codeExecutionToolFactory>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
109
190
  output: string;
110
191
  error?: string | undefined;
111
- }>;
192
+ }, {}>;
112
193
 
113
194
  declare const mcpServerToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
114
195
  name: string;
@@ -121,32 +202,32 @@ declare const mcpServerToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWi
121
202
  allowedTools?: string[];
122
203
  headers?: Record<string, string>;
123
204
  authorization?: string;
124
- }>;
205
+ }, {}>;
125
206
  declare const mcpServer: (args: Parameters<typeof mcpServerToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
126
207
  name: string;
127
208
  arguments: string;
128
209
  result: unknown;
129
- }>;
210
+ }, {}>;
130
211
 
131
212
  declare const viewImageToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
132
213
  description: string;
133
214
  objects?: string[] | undefined;
134
- }, object>;
215
+ }, object, {}>;
135
216
  declare const viewImage: (args?: Parameters<typeof viewImageToolFactory>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
136
217
  description: string;
137
218
  objects?: string[] | undefined;
138
- }>;
219
+ }, {}>;
139
220
 
140
221
  declare const viewXVideoToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
141
222
  description: string;
142
223
  transcript?: string | undefined;
143
224
  duration?: number | undefined;
144
- }, object>;
225
+ }, object, {}>;
145
226
  declare const viewXVideo: (args?: Parameters<typeof viewXVideoToolFactory>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
146
227
  description: string;
147
228
  transcript?: string | undefined;
148
229
  duration?: number | undefined;
149
- }>;
230
+ }, {}>;
150
231
 
151
232
  declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
152
233
  query: string;
@@ -159,7 +240,7 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWi
159
240
  allowedDomains?: string[];
160
241
  excludedDomains?: string[];
161
242
  enableImageUnderstanding?: boolean;
162
- }>;
243
+ }, {}>;
163
244
  declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
164
245
  query: string;
165
246
  sources: Array<{
@@ -167,7 +248,7 @@ declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) =>
167
248
  url: string;
168
249
  snippet: string;
169
250
  }>;
170
- }>;
251
+ }, {}>;
171
252
 
172
253
  declare const xSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
173
254
  query: string;
@@ -184,7 +265,7 @@ declare const xSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWith
184
265
  toDate?: string;
185
266
  enableImageUnderstanding?: boolean;
186
267
  enableVideoUnderstanding?: boolean;
187
- }>;
268
+ }, {}>;
188
269
  declare const xSearch: (args?: Parameters<typeof xSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
189
270
  query: string;
190
271
  posts: Array<{
@@ -193,16 +274,16 @@ declare const xSearch: (args?: Parameters<typeof xSearchToolFactory>[0]) => _ai_
193
274
  url: string;
194
275
  likes: number;
195
276
  }>;
196
- }>;
277
+ }, {}>;
197
278
 
198
279
  declare const xaiTools: {
199
280
  codeExecution: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
200
281
  output: string;
201
282
  error?: string | undefined;
202
- }, object>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
283
+ }, object, {}>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
203
284
  output: string;
204
285
  error?: string | undefined;
205
- }>;
286
+ }, {}>;
206
287
  fileSearch: (args: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
207
288
  queries: string[];
208
289
  results: null | {
@@ -214,7 +295,7 @@ declare const xaiTools: {
214
295
  }, {
215
296
  vectorStoreIds: string[];
216
297
  maxNumResults?: number;
217
- }>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
298
+ }, {}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
218
299
  queries: string[];
219
300
  results: null | {
220
301
  fileId: string;
@@ -222,7 +303,7 @@ declare const xaiTools: {
222
303
  score: number;
223
304
  text: string;
224
305
  }[];
225
- }>;
306
+ }, {}>;
226
307
  mcpServer: (args: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
227
308
  name: string;
228
309
  arguments: string;
@@ -234,27 +315,27 @@ declare const xaiTools: {
234
315
  allowedTools?: string[];
235
316
  headers?: Record<string, string>;
236
317
  authorization?: string;
237
- }>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
318
+ }, {}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
238
319
  name: string;
239
320
  arguments: string;
240
321
  result: unknown;
241
- }>;
322
+ }, {}>;
242
323
  viewImage: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
243
324
  description: string;
244
325
  objects?: string[] | undefined;
245
- }, object>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
326
+ }, object, {}>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
246
327
  description: string;
247
328
  objects?: string[] | undefined;
248
- }>;
329
+ }, {}>;
249
330
  viewXVideo: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
250
331
  description: string;
251
332
  transcript?: string | undefined;
252
333
  duration?: number | undefined;
253
- }, object>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
334
+ }, object, {}>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
254
335
  description: string;
255
336
  transcript?: string | undefined;
256
337
  duration?: number | undefined;
257
- }>;
338
+ }, {}>;
258
339
  webSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
259
340
  query: string;
260
341
  sources: Array<{
@@ -266,14 +347,14 @@ declare const xaiTools: {
266
347
  allowedDomains?: string[];
267
348
  excludedDomains?: string[];
268
349
  enableImageUnderstanding?: boolean;
269
- }>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
350
+ }, {}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
270
351
  query: string;
271
352
  sources: Array<{
272
353
  title: string;
273
354
  url: string;
274
355
  snippet: string;
275
356
  }>;
276
- }>;
357
+ }, {}>;
277
358
  xSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
278
359
  query: string;
279
360
  posts: Array<{
@@ -289,7 +370,7 @@ declare const xaiTools: {
289
370
  toDate?: string;
290
371
  enableImageUnderstanding?: boolean;
291
372
  enableVideoUnderstanding?: boolean;
292
- }>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
373
+ }, {}>>[0]) => _ai_sdk_provider_utils.Tool<{}, {
293
374
  query: string;
294
375
  posts: Array<{
295
376
  author: string;
@@ -297,42 +378,43 @@ declare const xaiTools: {
297
378
  url: string;
298
379
  likes: number;
299
380
  }>;
300
- }>;
381
+ }, {}>;
301
382
  };
302
383
 
303
- interface XaiProvider extends ProviderV3 {
304
- /**
305
- * Creates an Xai chat model for text generation.
306
- */
307
- (modelId: XaiChatModelId): LanguageModelV3;
384
+ interface XaiProvider extends ProviderV4 {
385
+ (modelId: XaiResponsesModelId): LanguageModelV4;
308
386
  /**
309
387
  * Creates an Xai language model for text generation.
310
388
  */
311
- languageModel(modelId: XaiChatModelId): LanguageModelV3;
389
+ languageModel(modelId: XaiResponsesModelId): LanguageModelV4;
312
390
  /**
313
391
  * Creates an Xai chat model for text generation.
314
392
  */
315
- chat: (modelId: XaiChatModelId) => LanguageModelV3;
393
+ chat: (modelId: XaiChatModelId) => LanguageModelV4;
316
394
  /**
317
- * Creates an Xai responses model for agentic tool calling.
395
+ * Creates an Xai responses model for text generation.
318
396
  */
319
- responses: (modelId: XaiResponsesModelId) => LanguageModelV3;
397
+ responses: (modelId: XaiResponsesModelId) => LanguageModelV4;
320
398
  /**
321
399
  * Creates an Xai image model for image generation.
322
400
  */
323
- image(modelId: XaiImageModelId): ImageModelV3;
401
+ image(modelId: XaiImageModelId): ImageModelV4;
324
402
  /**
325
403
  * Creates an Xai image model for image generation.
326
404
  */
327
- imageModel(modelId: XaiImageModelId): ImageModelV3;
405
+ imageModel(modelId: XaiImageModelId): ImageModelV4;
328
406
  /**
329
407
  * Creates an Xai video model for video generation.
330
408
  */
331
- video(modelId: XaiVideoModelId): Experimental_VideoModelV3;
409
+ video(modelId: XaiVideoModelId): Experimental_VideoModelV4;
332
410
  /**
333
411
  * Creates an Xai video model for video generation.
334
412
  */
335
- videoModel(modelId: XaiVideoModelId): Experimental_VideoModelV3;
413
+ videoModel(modelId: XaiVideoModelId): Experimental_VideoModelV4;
414
+ /**
415
+ * Returns the xAI files interface for uploading files.
416
+ */
417
+ files(): FilesV4;
336
418
  /**
337
419
  * Server-side agentic tools for use with the responses API.
338
420
  */
@@ -366,4 +448,4 @@ declare const xai: XaiProvider;
366
448
 
367
449
  declare const VERSION: string;
368
450
 
369
- export { VERSION, type XaiErrorData, type XaiImageModelOptions, type XaiImageModelOptions as XaiImageProviderOptions, type XaiLanguageModelChatOptions, type XaiLanguageModelResponsesOptions, type XaiProvider, type XaiLanguageModelChatOptions as XaiProviderOptions, type XaiProviderSettings, type XaiLanguageModelResponsesOptions as XaiResponsesProviderOptions, type XaiVideoModelId, type XaiVideoModelOptions, type XaiVideoModelOptions as XaiVideoProviderOptions, codeExecution, createXai, mcpServer, viewImage, viewXVideo, webSearch, xSearch, xai, xaiTools };
451
+ export { VERSION, type XaiErrorData, type XaiFilesOptions, type XaiImageModelOptions, type XaiImageModelOptions as XaiImageProviderOptions, type XaiLanguageModelChatOptions, type XaiLanguageModelResponsesOptions, type XaiProvider, type XaiLanguageModelChatOptions as XaiProviderOptions, type XaiProviderSettings, type XaiLanguageModelResponsesOptions as XaiResponsesProviderOptions, type XaiVideoModelId, type XaiVideoModelOptions, type XaiVideoModelOptions as XaiVideoProviderOptions, codeExecution, createXai, mcpServer, viewImage, viewXVideo, webSearch, xSearch, xai, xaiTools };