@ai-sdk/xai 4.0.0-canary.73 → 4.0.0
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 +153 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/docs/01-xai.mdx +4 -4
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,158 @@
|
|
|
1
1
|
# @ai-sdk/xai
|
|
2
2
|
|
|
3
|
+
## 4.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- f7d4f01: feat(provider): add support for `reasoning-file` type for files that are part of reasoning
|
|
8
|
+
- 776b617: feat(provider): adding new 'custom' content type
|
|
9
|
+
- ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
|
|
10
|
+
- c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
|
|
11
|
+
- 8359612: Start v7 pre-release
|
|
12
|
+
- 04e9009: chore: make provider implementations code patterns more consistent, including renaming certain exported symbols
|
|
13
|
+
|
|
14
|
+
For all externally exported symbols that were renamed, the old names continue to work via deprecated aliases.
|
|
15
|
+
|
|
16
|
+
- f62681f: feat(provider/xai): make responses api the default
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- 38fc777: Add AI Gateway hint to provider READMEs
|
|
21
|
+
- 85735d8: fix(xai): stop emitting additionalProperties flag
|
|
22
|
+
- 74d520f: feat: migrate providers to support new top-level `reasoning` parameter
|
|
23
|
+
- 25f1837: feat(xai): add b64_json response format, usage cost tracking, and quality/user parameters for image models
|
|
24
|
+
- a0b0a0c: expose costInUsdTicks in responses provider metadata
|
|
25
|
+
- aa5a583: chore(provider/xai): remove obsolete Grok 2 models now that they are shut down in their API
|
|
26
|
+
- e5bdc8d: fix (provider/xai): handle mid-stream error chunks
|
|
27
|
+
- 4799fa5: chore(provider/xai): update provider to use v4 types
|
|
28
|
+
- 813851f: fix (provider/xai): add response.incomplete and response.failed streaming event handling
|
|
29
|
+
- 2dc2a52: fix reasoning-start dedupe on multi-summary-part responses to prevent xai 400 on continuation requests
|
|
30
|
+
- 9f0e36c: trigger release for all packages after provenance setup
|
|
31
|
+
- 58a2ad7: fix: more precise default message for tool execution denial
|
|
32
|
+
- d20829e: feat(provider/xai): add moderation error, and costInUsdTicks to video model
|
|
33
|
+
- 7fc6bd6: Raise minimum supported Node.js version to 22. Supported versions: 22, 24, and 26.
|
|
34
|
+
- 0f11f10: add reasoningSummary to responses API provider options
|
|
35
|
+
- 23f9d72: deprecate searchParameters (xai live search) in favor of web_search/x_search agent tools
|
|
36
|
+
- 0c4c275: trigger initial canary release
|
|
37
|
+
- 1293885: surface full xai error detail in APICallError.message instead of falling back to http status text
|
|
38
|
+
- 8d87577: fix(xai): support encrypted reasoning round-trip for ZDR
|
|
39
|
+
- 9f20868: fix(provider/xai): correct finish reason for tool calls
|
|
40
|
+
- 4f91b5d: chore(provider/xai): update Grok 4.20 model IDs to their non-beta versions
|
|
41
|
+
- ce769dd: feat(provider): add experimental Realtime API support for voice conversations
|
|
42
|
+
|
|
43
|
+
Adds first-class support for realtime (speech-to-speech) APIs:
|
|
44
|
+
|
|
45
|
+
- `Experimental_RealtimeModelV4` spec in `@ai-sdk/provider` with normalized event types and factory
|
|
46
|
+
- OpenAI, Google, and xAI realtime provider implementations
|
|
47
|
+
- `openai.experimental_realtime()` / `google.experimental_realtime()` / `xai.experimental_realtime()` work in both server and browser
|
|
48
|
+
- `.getToken()` static method on each provider for server-side ephemeral token creation
|
|
49
|
+
- `experimental_getRealtimeToolDefinitions` helper for provider session tool definitions
|
|
50
|
+
- `experimental_useRealtime` hook in `@ai-sdk/react` returning `UIMessage[]` (aligned with `useChat`), with `onToolCall` and `addToolOutput` for client-driven tool execution
|
|
51
|
+
- `inputAudioTranscription` session config for showing transcribed user audio messages when supported by the provider
|
|
52
|
+
|
|
53
|
+
- 12115e9: fix reasoning text extraction from content in responses doGenerate
|
|
54
|
+
- 9bd6512: feat(provider): change file part data property to be tagged with a type and remove the image part type
|
|
55
|
+
- 258c093: chore: ensure consistent import handling and avoid import duplicates or cycles
|
|
56
|
+
- b8396f0: trigger initial beta release
|
|
57
|
+
- f51c95e: feat(provider/xai): add video extension and reference-to-video (R2V) support
|
|
58
|
+
- 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
|
|
59
|
+
- f5181ad: feat(provider/xai): support multiple input images for image editing
|
|
60
|
+
- b3976a2: Add workflow serialization support to all provider models.
|
|
61
|
+
|
|
62
|
+
**`@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.
|
|
63
|
+
|
|
64
|
+
**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.
|
|
65
|
+
|
|
66
|
+
All provider model classes now include `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` static methods, enabling them to cross workflow step boundaries without serialization errors.
|
|
67
|
+
|
|
68
|
+
- 1dbecd7: feat(provider/xai): add `enableImageSearch` to the xAI Web Search tool
|
|
69
|
+
|
|
70
|
+
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`.
|
|
71
|
+
|
|
72
|
+
- 80e1702: feat(xai): support `'none'` and `'medium'` reasoning effort for `grok-4.3`,
|
|
73
|
+
and curate the model ID autocomplete list
|
|
74
|
+
|
|
75
|
+
`grok-4.3` accepts `reasoning_effort` of `"none" | "low" | "medium" | "high"`,
|
|
76
|
+
where `"none"` disables reasoning entirely (no thinking tokens) and `"medium"`
|
|
77
|
+
provides more thinking for less-latency-sensitive applications.
|
|
78
|
+
|
|
79
|
+
- Adds `'none'` to the allowed values for `providerOptions.xai.reasoningEffort`
|
|
80
|
+
on both the chat (`xai()`) and responses (`xai.responses()`) language models.
|
|
81
|
+
- Adds `'medium'` to the chat model's `reasoningEffort` enum (the responses
|
|
82
|
+
model already supported it).
|
|
83
|
+
- Top-level `reasoning: 'medium'` now maps to `reasoning_effort: 'medium'` for
|
|
84
|
+
the chat model (previously it was coerced to `'low'` because `'medium'` was
|
|
85
|
+
not a valid value).
|
|
86
|
+
|
|
87
|
+
In addition, the `XaiChatModelId` and `XaiResponsesModelId` autocomplete unions
|
|
88
|
+
have been trimmed to xAI's current model lineup
|
|
89
|
+
([docs](https://docs.x.ai/docs/models)):
|
|
90
|
+
|
|
91
|
+
- `grok-4.20-non-reasoning`
|
|
92
|
+
- `grok-4.20-reasoning`
|
|
93
|
+
- `grok-4.3`
|
|
94
|
+
- `grok-latest`
|
|
95
|
+
|
|
96
|
+
Older entries (`grok-3*`, `grok-4`, `grok-4-0709`, `grok-4-latest`,
|
|
97
|
+
`grok-4-1-fast-*`, `grok-4-fast-*`, `grok-code-fast-1`, and
|
|
98
|
+
`grok-4.20-multi-agent-0309`) have been removed from the autocomplete list.
|
|
99
|
+
This is **not** a runtime change — the model ID type is still open
|
|
100
|
+
(`(string & {})`), so passing any model ID that the xAI API accepts continues
|
|
101
|
+
to work; only IDE autocomplete is affected.
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import { xai } from "@ai-sdk/xai";
|
|
105
|
+
import { generateText } from "ai";
|
|
106
|
+
|
|
107
|
+
await generateText({
|
|
108
|
+
model: xai("grok-4.3"),
|
|
109
|
+
prompt: "Hi",
|
|
110
|
+
providerOptions: {
|
|
111
|
+
xai: { reasoningEffort: "none" },
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
- 78b6433: feat(provider/xai): support non-image file parts (PDF, text, CSV) in the Responses API via `input_file` + `file_url`
|
|
117
|
+
|
|
118
|
+
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/`.
|
|
119
|
+
|
|
120
|
+
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.
|
|
121
|
+
|
|
122
|
+
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.
|
|
123
|
+
|
|
124
|
+
- 7486744: Add xAI speech-to-text transcription support.
|
|
125
|
+
- 7486744: feat(provider/xai): add text-to-speech support
|
|
126
|
+
|
|
127
|
+
## 4.0.0-beta.76
|
|
128
|
+
|
|
129
|
+
### Patch Changes
|
|
130
|
+
|
|
131
|
+
- Updated dependencies [0416e3e]
|
|
132
|
+
- @ai-sdk/provider@4.0.0-beta.20
|
|
133
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.58
|
|
134
|
+
- @ai-sdk/provider-utils@5.0.0-beta.50
|
|
135
|
+
|
|
136
|
+
## 4.0.0-beta.75
|
|
137
|
+
|
|
138
|
+
### Patch Changes
|
|
139
|
+
|
|
140
|
+
- b8396f0: trigger initial beta release
|
|
141
|
+
- Updated dependencies [b8396f0]
|
|
142
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.57
|
|
143
|
+
- @ai-sdk/provider-utils@5.0.0-beta.49
|
|
144
|
+
- @ai-sdk/provider@4.0.0-beta.19
|
|
145
|
+
|
|
146
|
+
## 4.0.0-canary.74
|
|
147
|
+
|
|
148
|
+
### Patch Changes
|
|
149
|
+
|
|
150
|
+
- Updated dependencies [aeda373]
|
|
151
|
+
- Updated dependencies [375fdd7]
|
|
152
|
+
- Updated dependencies [b4507d5]
|
|
153
|
+
- @ai-sdk/provider-utils@5.0.0-canary.48
|
|
154
|
+
- @ai-sdk/openai-compatible@3.0.0-canary.56
|
|
155
|
+
|
|
3
156
|
## 4.0.0-canary.73
|
|
4
157
|
|
|
5
158
|
### Patch Changes
|