@ai-sdk/xai 4.0.0-canary.74 → 4.0.1

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,154 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 4.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - ba6d510: chore: fix deprecated use of zod `.passthrough()`
8
+
9
+ ## 4.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - f7d4f01: feat(provider): add support for `reasoning-file` type for files that are part of reasoning
14
+ - 776b617: feat(provider): adding new 'custom' content type
15
+ - ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
16
+ - c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
17
+ - 8359612: Start v7 pre-release
18
+ - 04e9009: chore: make provider implementations code patterns more consistent, including renaming certain exported symbols
19
+
20
+ For all externally exported symbols that were renamed, the old names continue to work via deprecated aliases.
21
+
22
+ - f62681f: feat(provider/xai): make responses api the default
23
+
24
+ ### Patch Changes
25
+
26
+ - 38fc777: Add AI Gateway hint to provider READMEs
27
+ - 85735d8: fix(xai): stop emitting additionalProperties flag
28
+ - 74d520f: feat: migrate providers to support new top-level `reasoning` parameter
29
+ - 25f1837: feat(xai): add b64_json response format, usage cost tracking, and quality/user parameters for image models
30
+ - a0b0a0c: expose costInUsdTicks in responses provider metadata
31
+ - aa5a583: chore(provider/xai): remove obsolete Grok 2 models now that they are shut down in their API
32
+ - e5bdc8d: fix (provider/xai): handle mid-stream error chunks
33
+ - 4799fa5: chore(provider/xai): update provider to use v4 types
34
+ - 813851f: fix (provider/xai): add response.incomplete and response.failed streaming event handling
35
+ - 2dc2a52: fix reasoning-start dedupe on multi-summary-part responses to prevent xai 400 on continuation requests
36
+ - 9f0e36c: trigger release for all packages after provenance setup
37
+ - 58a2ad7: fix: more precise default message for tool execution denial
38
+ - d20829e: feat(provider/xai): add moderation error, and costInUsdTicks to video model
39
+ - 7fc6bd6: Raise minimum supported Node.js version to 22. Supported versions: 22, 24, and 26.
40
+ - 0f11f10: add reasoningSummary to responses API provider options
41
+ - 23f9d72: deprecate searchParameters (xai live search) in favor of web_search/x_search agent tools
42
+ - 0c4c275: trigger initial canary release
43
+ - 1293885: surface full xai error detail in APICallError.message instead of falling back to http status text
44
+ - 8d87577: fix(xai): support encrypted reasoning round-trip for ZDR
45
+ - 9f20868: fix(provider/xai): correct finish reason for tool calls
46
+ - 4f91b5d: chore(provider/xai): update Grok 4.20 model IDs to their non-beta versions
47
+ - ce769dd: feat(provider): add experimental Realtime API support for voice conversations
48
+
49
+ Adds first-class support for realtime (speech-to-speech) APIs:
50
+
51
+ - `Experimental_RealtimeModelV4` spec in `@ai-sdk/provider` with normalized event types and factory
52
+ - OpenAI, Google, and xAI realtime provider implementations
53
+ - `openai.experimental_realtime()` / `google.experimental_realtime()` / `xai.experimental_realtime()` work in both server and browser
54
+ - `.getToken()` static method on each provider for server-side ephemeral token creation
55
+ - `experimental_getRealtimeToolDefinitions` helper for provider session tool definitions
56
+ - `experimental_useRealtime` hook in `@ai-sdk/react` returning `UIMessage[]` (aligned with `useChat`), with `onToolCall` and `addToolOutput` for client-driven tool execution
57
+ - `inputAudioTranscription` session config for showing transcribed user audio messages when supported by the provider
58
+
59
+ - 12115e9: fix reasoning text extraction from content in responses doGenerate
60
+ - 9bd6512: feat(provider): change file part data property to be tagged with a type and remove the image part type
61
+ - 258c093: chore: ensure consistent import handling and avoid import duplicates or cycles
62
+ - b8396f0: trigger initial beta release
63
+ - f51c95e: feat(provider/xai): add video extension and reference-to-video (R2V) support
64
+ - 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
65
+ - f5181ad: feat(provider/xai): support multiple input images for image editing
66
+ - b3976a2: Add workflow serialization support to all provider models.
67
+
68
+ **`@ai-sdk/provider-utils`:** New `serializeModel()` helper that extracts only serializable properties from a model instance, filtering out functions and objects containing functions. Third-party provider authors can use this to add workflow support to their own models.
69
+
70
+ **All providers:** `headers` is now optional in provider config types. This is non-breaking — existing code that passes `headers` continues to work. Custom provider implementations that construct model configs manually can now omit `headers`, which is useful when models are deserialized from a workflow step boundary where auth is provided separately.
71
+
72
+ All provider model classes now include `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` static methods, enabling them to cross workflow step boundaries without serialization errors.
73
+
74
+ - 1dbecd7: feat(provider/xai): add `enableImageSearch` to the xAI Web Search tool
75
+
76
+ The xAI Responses API supports `enable_image_search` on Web Search tools. `xai.tools.webSearch()` now accepts `enableImageSearch` and sends it through to the API as `enable_image_search`.
77
+
78
+ - 80e1702: feat(xai): support `'none'` and `'medium'` reasoning effort for `grok-4.3`,
79
+ and curate the model ID autocomplete list
80
+
81
+ `grok-4.3` accepts `reasoning_effort` of `"none" | "low" | "medium" | "high"`,
82
+ where `"none"` disables reasoning entirely (no thinking tokens) and `"medium"`
83
+ provides more thinking for less-latency-sensitive applications.
84
+
85
+ - Adds `'none'` to the allowed values for `providerOptions.xai.reasoningEffort`
86
+ on both the chat (`xai()`) and responses (`xai.responses()`) language models.
87
+ - Adds `'medium'` to the chat model's `reasoningEffort` enum (the responses
88
+ model already supported it).
89
+ - Top-level `reasoning: 'medium'` now maps to `reasoning_effort: 'medium'` for
90
+ the chat model (previously it was coerced to `'low'` because `'medium'` was
91
+ not a valid value).
92
+
93
+ In addition, the `XaiChatModelId` and `XaiResponsesModelId` autocomplete unions
94
+ have been trimmed to xAI's current model lineup
95
+ ([docs](https://docs.x.ai/docs/models)):
96
+
97
+ - `grok-4.20-non-reasoning`
98
+ - `grok-4.20-reasoning`
99
+ - `grok-4.3`
100
+ - `grok-latest`
101
+
102
+ Older entries (`grok-3*`, `grok-4`, `grok-4-0709`, `grok-4-latest`,
103
+ `grok-4-1-fast-*`, `grok-4-fast-*`, `grok-code-fast-1`, and
104
+ `grok-4.20-multi-agent-0309`) have been removed from the autocomplete list.
105
+ This is **not** a runtime change — the model ID type is still open
106
+ (`(string & {})`), so passing any model ID that the xAI API accepts continues
107
+ to work; only IDE autocomplete is affected.
108
+
109
+ ```ts
110
+ import { xai } from "@ai-sdk/xai";
111
+ import { generateText } from "ai";
112
+
113
+ await generateText({
114
+ model: xai("grok-4.3"),
115
+ prompt: "Hi",
116
+ providerOptions: {
117
+ xai: { reasoningEffort: "none" },
118
+ },
119
+ });
120
+ ```
121
+
122
+ - 78b6433: feat(provider/xai): support non-image file parts (PDF, text, CSV) in the Responses API via `input_file` + `file_url`
123
+
124
+ The xAI Responses API accepts `{ type: 'input_file', file_url }` for non-image documents (see https://docs.x.ai/docs/guides/chat-with-files), but the AI SDK xAI Responses provider previously threw `UnsupportedFunctionalityError` for any file part whose `mediaType` did not start with `image/`.
125
+
126
+ When a file part is passed with `data: URL` and a non-image media type, the provider now emits `{ type: 'input_file', file_url }`. `application/pdf` and `text/*` are also added to `supportedUrls` so the SDK does not download them to bytes before reaching the converter.
127
+
128
+ Inline-byte (base64) inputs for non-image media types continue to throw, since xAI's Responses API requires either a public URL or a pre-uploaded `file_id` for non-image documents.
129
+
130
+ - 7486744: Add xAI speech-to-text transcription support.
131
+ - 7486744: feat(provider/xai): add text-to-speech support
132
+
133
+ ## 4.0.0-beta.76
134
+
135
+ ### Patch Changes
136
+
137
+ - Updated dependencies [0416e3e]
138
+ - @ai-sdk/provider@4.0.0-beta.20
139
+ - @ai-sdk/openai-compatible@3.0.0-beta.58
140
+ - @ai-sdk/provider-utils@5.0.0-beta.50
141
+
142
+ ## 4.0.0-beta.75
143
+
144
+ ### Patch Changes
145
+
146
+ - b8396f0: trigger initial beta release
147
+ - Updated dependencies [b8396f0]
148
+ - @ai-sdk/openai-compatible@3.0.0-beta.57
149
+ - @ai-sdk/provider-utils@5.0.0-beta.49
150
+ - @ai-sdk/provider@4.0.0-beta.19
151
+
3
152
  ## 4.0.0-canary.74
4
153
 
5
154
  ### Patch Changes
package/dist/index.js CHANGED
@@ -3393,7 +3393,7 @@ var xaiTools = {
3393
3393
  };
3394
3394
 
3395
3395
  // src/version.ts
3396
- var VERSION = true ? "4.0.0-canary.74" : "0.0.0-test";
3396
+ var VERSION = true ? "4.0.1" : "0.0.0-test";
3397
3397
 
3398
3398
  // src/files/xai-files.ts
3399
3399
  import {
@@ -3429,10 +3429,10 @@ import {
3429
3429
  import { z as z16 } from "zod/v4";
3430
3430
  var xaiFilesOptionsSchema = lazySchema6(
3431
3431
  () => zodSchema6(
3432
- z16.object({
3432
+ z16.looseObject({
3433
3433
  teamId: z16.string().optional(),
3434
3434
  filePath: z16.string().optional()
3435
- }).passthrough()
3435
+ })
3436
3436
  )
3437
3437
  );
3438
3438
 
@@ -3552,12 +3552,12 @@ var xaiVideoModelOptions = z17.union([
3552
3552
  referenceToVideoSchema,
3553
3553
  autoDetectSchema
3554
3554
  ]);
3555
- var runtimeSchema = z17.object({
3555
+ var runtimeSchema = z17.looseObject({
3556
3556
  mode: modeSchema.optional(),
3557
3557
  videoUrl: nonEmptyStringSchema.optional(),
3558
3558
  referenceImageUrls: z17.array(nonEmptyStringSchema).min(1).max(7).optional(),
3559
3559
  ...baseFields
3560
- }).passthrough();
3560
+ });
3561
3561
  var xaiVideoModelOptionsSchema = lazySchema7(
3562
3562
  () => zodSchema7(runtimeSchema)
3563
3563
  );